Skip to content

Commit

Permalink
Merge branch 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/gi…
Browse files Browse the repository at this point in the history
…t/mmarek/kbuild

Pull kbuild updates from Michal Marek:

 - EXPORT_SYMBOL for asm source by Al Viro.

   This does bring a regression, because genksyms no longer generates
   checksums for these symbols (CONFIG_MODVERSIONS). Nick Piggin is
   working on a patch to fix this.

   Plus, we are talking about functions like strcpy(), which rarely
   change prototypes.

 - Fixes for PPC fallout of the above by Stephen Rothwell and Nick
   Piggin

 - fixdep speedup by Alexey Dobriyan.

 - preparatory work by Nick Piggin to allow architectures to build with
   -ffunction-sections, -fdata-sections and --gc-sections

 - CONFIG_THIN_ARCHIVES support by Stephen Rothwell

 - fix for filenames with colons in the initramfs source by me.

* 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild: (22 commits)
  initramfs: Escape colons in depfile
  ppc: there is no clear_pages to export
  powerpc/64: whitelist unresolved modversions CRCs
  kbuild: -ffunction-sections fix for archs with conflicting sections
  kbuild: add arch specific post-link Makefile
  kbuild: allow archs to select link dead code/data elimination
  kbuild: allow architectures to use thin archives instead of ld -r
  kbuild: Regenerate genksyms lexer
  kbuild: genksyms fix for typeof handling
  fixdep: faster CONFIG_ search
  ia64: move exports to definitions
  sparc32: debride memcpy.S a bit
  [sparc] unify 32bit and 64bit string.h
  sparc: move exports to definitions
  ppc: move exports to definitions
  arm: move exports to definitions
  s390: move exports to definitions
  m68k: move exports to definitions
  alpha: move exports to actual definitions
  x86: move exports to actual definitions
  ...
  • Loading branch information
torvalds committed Oct 14, 2016
2 parents d4d24d2 + 590abbd commit 84d6984
Show file tree
Hide file tree
Showing 262 changed files with 1,094 additions and 1,403 deletions.
16 changes: 16 additions & 0 deletions Documentation/kbuild/makefiles.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ This document describes the Linux kernel Makefiles.
--- 6.8 Custom kbuild commands
--- 6.9 Preprocessing linker scripts
--- 6.10 Generic header files
--- 6.11 Post-link pass

=== 7 Kbuild syntax for exported headers
--- 7.1 header-y
Expand Down Expand Up @@ -1237,6 +1238,21 @@ When kbuild executes, the following steps are followed (roughly):
to list the file in the Kbuild file.
See "7.4 generic-y" for further info on syntax etc.

--- 6.11 Post-link pass

If the file arch/xxx/Makefile.postlink exists, this makefile
will be invoked for post-link objects (vmlinux and modules.ko)
for architectures to run post-link passes on. Must also handle
the clean target.

This pass runs after kallsyms generation. If the architecture
needs to modify symbol locations, rather than manipulate the
kallsyms, it may be easier to add another postlink target for
.tmp_vmlinux? targets to be called from link-vmlinux.sh.

For example, powerpc uses this to check relocation sanity of
the linked vmlinux file.

=== 7 Kbuild syntax for exported headers

The kernel includes a set of headers that is exported to userspace.
Expand Down
19 changes: 16 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -623,6 +623,11 @@ KBUILD_CFLAGS += $(call cc-option,-fno-delete-null-pointer-checks,)
KBUILD_CFLAGS += $(call cc-disable-warning,maybe-uninitialized,)
KBUILD_CFLAGS += $(call cc-disable-warning,frame-address,)

ifdef CONFIG_LD_DEAD_CODE_DATA_ELIMINATION
KBUILD_CFLAGS += $(call cc-option,-ffunction-sections,)
KBUILD_CFLAGS += $(call cc-option,-fdata-sections,)
endif

ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
KBUILD_CFLAGS += -Os
else
Expand Down Expand Up @@ -803,6 +808,10 @@ LDFLAGS_BUILD_ID = $(patsubst -Wl$(comma)%,%,\
KBUILD_LDFLAGS_MODULE += $(LDFLAGS_BUILD_ID)
LDFLAGS_vmlinux += $(LDFLAGS_BUILD_ID)

ifdef CONFIG_LD_DEAD_CODE_DATA_ELIMINATION
LDFLAGS_vmlinux += $(call ld-option, --gc-sections,)
endif

ifeq ($(CONFIG_STRIP_ASM_SYMS),y)
LDFLAGS_vmlinux += $(call ld-option, -X,)
endif
Expand Down Expand Up @@ -942,9 +951,12 @@ endif
include/generated/autoksyms.h: FORCE
$(Q)$(CONFIG_SHELL) $(srctree)/scripts/adjust_autoksyms.sh true

# Final link of vmlinux
cmd_link-vmlinux = $(CONFIG_SHELL) $< $(LD) $(LDFLAGS) $(LDFLAGS_vmlinux)
quiet_cmd_link-vmlinux = LINK $@
ARCH_POSTLINK := $(wildcard $(srctree)/arch/$(SRCARCH)/Makefile.postlink)

# Final link of vmlinux with optional arch pass after final link
cmd_link-vmlinux = \
$(CONFIG_SHELL) $< $(LD) $(LDFLAGS) $(LDFLAGS_vmlinux) ; \
$(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) $@, true)

vmlinux: scripts/link-vmlinux.sh vmlinux_prereq $(vmlinux-deps) FORCE
+$(call if_changed,link-vmlinux)
Expand Down Expand Up @@ -1271,6 +1283,7 @@ $(clean-dirs):

vmlinuxclean:
$(Q)$(CONFIG_SHELL) $(srctree)/scripts/link-vmlinux.sh clean
$(Q)$(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) clean)

clean: archclean vmlinuxclean

Expand Down
21 changes: 21 additions & 0 deletions arch/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,27 @@ config CC_STACKPROTECTOR_STRONG

endchoice

config THIN_ARCHIVES
bool
help
Select this if the architecture wants to use thin archives
instead of ld -r to create the built-in.o files.

config LD_DEAD_CODE_DATA_ELIMINATION
bool
help
Select this if the architecture wants to do dead code and
data elimination with the linker by compiling with
-ffunction-sections -fdata-sections and linking with
--gc-sections.

This requires that the arch annotates or otherwise protects
its external entry points from being discarded. Linker scripts
must also merge .text.*, .data.*, and .bss.* correctly into
output sections. Care must be taken not to pull in unrelated
sections (e.g., '.text.init'). Typically '.' in section names
is used to distinguish them from label names / C identifiers.

config HAVE_ARCH_WITHIN_STACK_FRAMES
bool
help
Expand Down
1 change: 1 addition & 0 deletions arch/alpha/include/asm/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
generic-y += clkdev.h
generic-y += cputime.h
generic-y += exec.h
generic-y += export.h
generic-y += irq_work.h
generic-y += mcs_spinlock.h
generic-y += mm-arch-hooks.h
Expand Down
2 changes: 1 addition & 1 deletion arch/alpha/kernel/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ ccflags-y := -Wno-sign-compare

obj-y := entry.o traps.o process.o osf_sys.o irq.o \
irq_alpha.o signal.o setup.o ptrace.o time.o \
alpha_ksyms.o systbls.o err_common.o io.o
systbls.o err_common.o io.o

obj-$(CONFIG_VGA_HOSE) += console.o
obj-$(CONFIG_SMP) += smp.o
Expand Down
102 changes: 0 additions & 102 deletions arch/alpha/kernel/alpha_ksyms.c

This file was deleted.

6 changes: 4 additions & 2 deletions arch/alpha/kernel/machvec_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,11 @@
else beforehand. Fine. We'll do it ourselves. */
#if 0
#define ALIAS_MV(system) \
struct alpha_machine_vector alpha_mv __attribute__((alias(#system "_mv")));
struct alpha_machine_vector alpha_mv __attribute__((alias(#system "_mv"))); \
EXPORT_SYMBOL(alpha_mv);
#else
#define ALIAS_MV(system) \
asm(".global alpha_mv\nalpha_mv = " #system "_mv");
asm(".global alpha_mv\nalpha_mv = " #system "_mv"); \
EXPORT_SYMBOL(alpha_mv);
#endif
#endif /* GENERIC */
1 change: 1 addition & 0 deletions arch/alpha/kernel/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ unsigned long alpha_agpgart_size = DEFAULT_AGP_APER_SIZE;

#ifdef CONFIG_ALPHA_GENERIC
struct alpha_machine_vector alpha_mv;
EXPORT_SYMBOL(alpha_mv);
#endif

#ifndef alpha_using_srm
Expand Down
5 changes: 5 additions & 0 deletions arch/alpha/lib/callback_srm.S
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
*/

#include <asm/console.h>
#include <asm/export.h>

.text
#define HWRPB_CRB_OFFSET 0xc0
Expand Down Expand Up @@ -92,6 +93,10 @@ CALLBACK(reset_env, CCB_RESET_ENV, 4)
CALLBACK(save_env, CCB_SAVE_ENV, 1)
CALLBACK(pswitch, CCB_PSWITCH, 3)
CALLBACK(bios_emul, CCB_BIOS_EMUL, 5)

EXPORT_SYMBOL(callback_getenv)
EXPORT_SYMBOL(callback_setenv)
EXPORT_SYMBOL(callback_save_env)

.data
__alpha_using_srm: # For use by bootpheader
Expand Down
3 changes: 3 additions & 0 deletions arch/alpha/lib/checksum.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr,
(__force u64)saddr + (__force u64)daddr +
(__force u64)sum + ((len + proto) << 8));
}
EXPORT_SYMBOL(csum_tcpudp_magic);

__wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
__u32 len, __u8 proto, __wsum sum)
Expand Down Expand Up @@ -144,6 +145,7 @@ __sum16 ip_fast_csum(const void *iph, unsigned int ihl)
{
return (__force __sum16)~do_csum(iph,ihl*4);
}
EXPORT_SYMBOL(ip_fast_csum);

/*
* computes the checksum of a memory block at buff, length len,
Expand Down Expand Up @@ -178,3 +180,4 @@ __sum16 ip_compute_csum(const void *buff, int len)
{
return (__force __sum16)~from64to16(do_csum(buff,len));
}
EXPORT_SYMBOL(ip_compute_csum);
3 changes: 2 additions & 1 deletion arch/alpha/lib/clear_page.S
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*
* Zero an entire page.
*/

#include <asm/export.h>
.text
.align 4
.global clear_page
Expand Down Expand Up @@ -37,3 +37,4 @@ clear_page:
nop

.end clear_page
EXPORT_SYMBOL(clear_page)
2 changes: 2 additions & 0 deletions arch/alpha/lib/clear_user.S
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
* Clobbers:
* $1,$2,$3,$4,$5,$6
*/
#include <asm/export.h>

/* Allow an exception for an insn; exit if we get one. */
#define EX(x,y...) \
Expand Down Expand Up @@ -111,3 +112,4 @@ $exception:
ret $31, ($28), 1 # .. e1 :

.end __do_clear_user
EXPORT_SYMBOL(__do_clear_user)
3 changes: 2 additions & 1 deletion arch/alpha/lib/copy_page.S
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*
* Copy an entire page.
*/

#include <asm/export.h>
.text
.align 4
.global copy_page
Expand Down Expand Up @@ -47,3 +47,4 @@ copy_page:
nop

.end copy_page
EXPORT_SYMBOL(copy_page)
3 changes: 3 additions & 0 deletions arch/alpha/lib/copy_user.S
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
* $1,$2,$3,$4,$5,$6,$7
*/

#include <asm/export.h>

/* Allow an exception for an insn; exit if we get one. */
#define EXI(x,y...) \
99: x,##y; \
Expand Down Expand Up @@ -143,3 +145,4 @@ $101:
ret $31,($28),1

.end __copy_user
EXPORT_SYMBOL(__copy_user)
2 changes: 2 additions & 0 deletions arch/alpha/lib/csum_ipv6_magic.S
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
* added by Ivan Kokshaysky <[email protected]>
*/

#include <asm/export.h>
.globl csum_ipv6_magic
.align 4
.ent csum_ipv6_magic
Expand Down Expand Up @@ -113,3 +114,4 @@ csum_ipv6_magic:
ret # .. e1 :

.end csum_ipv6_magic
EXPORT_SYMBOL(csum_ipv6_magic)
2 changes: 2 additions & 0 deletions arch/alpha/lib/csum_partial_copy.c
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,7 @@ csum_partial_copy_from_user(const void __user *src, void *dst, int len,
}
return (__force __wsum)checksum;
}
EXPORT_SYMBOL(csum_partial_copy_from_user);

__wsum
csum_partial_copy_nocheck(const void *src, void *dst, int len, __wsum sum)
Expand All @@ -386,3 +387,4 @@ csum_partial_copy_nocheck(const void *src, void *dst, int len, __wsum sum)
set_fs(oldfs);
return checksum;
}
EXPORT_SYMBOL(csum_partial_copy_nocheck);
2 changes: 2 additions & 0 deletions arch/alpha/lib/dec_and_lock.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

#include <linux/spinlock.h>
#include <linux/atomic.h>
#include <linux/export.h>

asm (".text \n\
.global _atomic_dec_and_lock \n\
Expand Down Expand Up @@ -39,3 +40,4 @@ static int __used atomic_dec_and_lock_1(atomic_t *atomic, spinlock_t *lock)
spin_unlock(lock);
return 0;
}
EXPORT_SYMBOL(_atomic_dec_and_lock);
Loading

0 comments on commit 84d6984

Please sign in to comment.