Skip to content

Commit 41e0e24

Browse files
committed
Merge branch 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild
Pull kbuild updates from Michal Marek: - prototypes for x86 asm-exported symbols (Adam Borowski) and a warning about missing CRCs (Nick Piggin) - asm-exports fix for LTO (Nicolas Pitre) - thin archives improvements (Nick Piggin) - linker script fix for CONFIG_LD_DEAD_CODE_DATA_ELIMINATION (Nick Piggin) - genksyms support for __builtin_va_list keyword - misc minor fixes * 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild: x86/kbuild: enable modversions for symbols exported from asm kbuild: fix scripts/adjust_autoksyms.sh* for the no modules case scripts/kallsyms: remove last remnants of --page-offset option make use of make variable CURDIR instead of calling pwd kbuild: cmd_export_list: tighten the sed script kbuild: minor improvement for thin archives build kbuild: modpost warn if export version crc is missing kbuild: keep data tables through dead code elimination kbuild: improve linker compatibility with lib-ksyms.o build genksyms: Regenerate parser kbuild/genksyms: handle va_list type kbuild: thin archives for multi-y targets kbuild: kallsyms allow 3-pass generation if symbols size has changed
2 parents 0aaf214 + 334bb77 commit 41e0e24

27 files changed

Lines changed: 503 additions & 455 deletions

File tree

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#include <asm/ftrace.h>
2+
#include <asm/uaccess.h>
3+
#include <asm/string.h>
4+
#include <asm/page.h>
5+
#include <asm/checksum.h>
6+
7+
#include <asm-generic/asm-prototypes.h>
8+
9+
#include <asm/page.h>
10+
#include <asm/pgtable.h>
11+
#include <asm/special_insns.h>
12+
#include <asm/preempt.h>
13+
14+
#ifndef CONFIG_X86_CMPXCHG64
15+
extern void cmpxchg8b_emu(void);
16+
#endif
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#include <linux/bitops.h>
2+
extern void *__memset(void *, int, __kernel_size_t);
3+
extern void *__memcpy(void *, const void *, __kernel_size_t);
4+
extern void *__memmove(void *, const void *, __kernel_size_t);
5+
extern void *memset(void *, int, __kernel_size_t);
6+
extern void *memcpy(void *, const void *, __kernel_size_t);
7+
extern void *memmove(void *, const void *, __kernel_size_t);

‎include/asm-generic/vmlinux.lds.h‎

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@
114114
#ifdef CONFIG_KPROBES
115115
#define KPROBE_BLACKLIST() . = ALIGN(8); \
116116
VMLINUX_SYMBOL(__start_kprobe_blacklist) = .; \
117-
*(_kprobe_blacklist) \
117+
KEEP(*(_kprobe_blacklist)) \
118118
VMLINUX_SYMBOL(__stop_kprobe_blacklist) = .;
119119
#else
120120
#define KPROBE_BLACKLIST()
@@ -123,21 +123,21 @@
123123
#ifdef CONFIG_EVENT_TRACING
124124
#define FTRACE_EVENTS() . = ALIGN(8); \
125125
VMLINUX_SYMBOL(__start_ftrace_events) = .; \
126-
*(_ftrace_events) \
126+
KEEP(*(_ftrace_events)) \
127127
VMLINUX_SYMBOL(__stop_ftrace_events) = .; \
128128
VMLINUX_SYMBOL(__start_ftrace_enum_maps) = .; \
129-
*(_ftrace_enum_map) \
129+
KEEP(*(_ftrace_enum_map)) \
130130
VMLINUX_SYMBOL(__stop_ftrace_enum_maps) = .;
131131
#else
132132
#define FTRACE_EVENTS()
133133
#endif
134134

135135
#ifdef CONFIG_TRACING
136136
#define TRACE_PRINTKS() VMLINUX_SYMBOL(__start___trace_bprintk_fmt) = .; \
137-
*(__trace_printk_fmt) /* Trace_printk fmt' pointer */ \
137+
KEEP(*(__trace_printk_fmt)) /* Trace_printk fmt' pointer */ \
138138
VMLINUX_SYMBOL(__stop___trace_bprintk_fmt) = .;
139139
#define TRACEPOINT_STR() VMLINUX_SYMBOL(__start___tracepoint_str) = .; \
140-
*(__tracepoint_str) /* Trace_printk fmt' pointer */ \
140+
KEEP(*(__tracepoint_str)) /* Trace_printk fmt' pointer */ \
141141
VMLINUX_SYMBOL(__stop___tracepoint_str) = .;
142142
#else
143143
#define TRACE_PRINTKS()
@@ -147,7 +147,7 @@
147147
#ifdef CONFIG_FTRACE_SYSCALLS
148148
#define TRACE_SYSCALLS() . = ALIGN(8); \
149149
VMLINUX_SYMBOL(__start_syscalls_metadata) = .; \
150-
*(__syscalls_metadata) \
150+
KEEP(*(__syscalls_metadata)) \
151151
VMLINUX_SYMBOL(__stop_syscalls_metadata) = .;
152152
#else
153153
#define TRACE_SYSCALLS()
@@ -156,7 +156,7 @@
156156
#ifdef CONFIG_SERIAL_EARLYCON
157157
#define EARLYCON_TABLE() STRUCT_ALIGN(); \
158158
VMLINUX_SYMBOL(__earlycon_table) = .; \
159-
*(__earlycon_table) \
159+
KEEP(*(__earlycon_table)) \
160160
VMLINUX_SYMBOL(__earlycon_table_end) = .;
161161
#else
162162
#define EARLYCON_TABLE()
@@ -169,8 +169,8 @@
169169
#define _OF_TABLE_1(name) \
170170
. = ALIGN(8); \
171171
VMLINUX_SYMBOL(__##name##_of_table) = .; \
172-
*(__##name##_of_table) \
173-
*(__##name##_of_table_end)
172+
KEEP(*(__##name##_of_table)) \
173+
KEEP(*(__##name##_of_table_end))
174174

175175
#define CLKSRC_OF_TABLES() OF_TABLE(CONFIG_CLKSRC_OF, clksrc)
176176
#define IRQCHIP_OF_MATCH_TABLE() OF_TABLE(CONFIG_IRQCHIP, irqchip)
@@ -184,7 +184,7 @@
184184
#define ACPI_PROBE_TABLE(name) \
185185
. = ALIGN(8); \
186186
VMLINUX_SYMBOL(__##name##_acpi_probe_table) = .; \
187-
*(__##name##_acpi_probe_table) \
187+
KEEP(*(__##name##_acpi_probe_table)) \
188188
VMLINUX_SYMBOL(__##name##_acpi_probe_table_end) = .;
189189
#else
190190
#define ACPI_PROBE_TABLE(name)
@@ -193,7 +193,7 @@
193193
#define KERNEL_DTB() \
194194
STRUCT_ALIGN(); \
195195
VMLINUX_SYMBOL(__dtb_start) = .; \
196-
*(.dtb.init.rodata) \
196+
KEEP(*(.dtb.init.rodata)) \
197197
VMLINUX_SYMBOL(__dtb_end) = .;
198198

199199
/*
@@ -214,11 +214,11 @@
214214
/* implement dynamic printk debug */ \
215215
. = ALIGN(8); \
216216
VMLINUX_SYMBOL(__start___jump_table) = .; \
217-
*(__jump_table) \
217+
KEEP(*(__jump_table)) \
218218
VMLINUX_SYMBOL(__stop___jump_table) = .; \
219219
. = ALIGN(8); \
220220
VMLINUX_SYMBOL(__start___verbose) = .; \
221-
*(__verbose) \
221+
KEEP(*(__verbose)) \
222222
VMLINUX_SYMBOL(__stop___verbose) = .; \
223223
LIKELY_PROFILE() \
224224
BRANCH_PROFILE() \
@@ -274,10 +274,10 @@
274274
VMLINUX_SYMBOL(__start_rodata) = .; \
275275
*(.rodata) *(.rodata.*) \
276276
RO_AFTER_INIT_DATA /* Read only after init */ \
277-
*(__vermagic) /* Kernel version magic */ \
277+
KEEP(*(__vermagic)) /* Kernel version magic */ \
278278
. = ALIGN(8); \
279279
VMLINUX_SYMBOL(__start___tracepoints_ptrs) = .; \
280-
*(__tracepoints_ptrs) /* Tracepoints: pointer array */\
280+
KEEP(*(__tracepoints_ptrs)) /* Tracepoints: pointer array */ \
281281
VMLINUX_SYMBOL(__stop___tracepoints_ptrs) = .; \
282282
*(__tracepoints_strings)/* Tracepoints: strings */ \
283283
} \
@@ -291,35 +291,35 @@
291291
/* PCI quirks */ \
292292
.pci_fixup : AT(ADDR(.pci_fixup) - LOAD_OFFSET) { \
293293
VMLINUX_SYMBOL(__start_pci_fixups_early) = .; \
294-
*(.pci_fixup_early) \
294+
KEEP(*(.pci_fixup_early)) \
295295
VMLINUX_SYMBOL(__end_pci_fixups_early) = .; \
296296
VMLINUX_SYMBOL(__start_pci_fixups_header) = .; \
297-
*(.pci_fixup_header) \
297+
KEEP(*(.pci_fixup_header)) \
298298
VMLINUX_SYMBOL(__end_pci_fixups_header) = .; \
299299
VMLINUX_SYMBOL(__start_pci_fixups_final) = .; \
300-
*(.pci_fixup_final) \
300+
KEEP(*(.pci_fixup_final)) \
301301
VMLINUX_SYMBOL(__end_pci_fixups_final) = .; \
302302
VMLINUX_SYMBOL(__start_pci_fixups_enable) = .; \
303-
*(.pci_fixup_enable) \
303+
KEEP(*(.pci_fixup_enable)) \
304304
VMLINUX_SYMBOL(__end_pci_fixups_enable) = .; \
305305
VMLINUX_SYMBOL(__start_pci_fixups_resume) = .; \
306-
*(.pci_fixup_resume) \
306+
KEEP(*(.pci_fixup_resume)) \
307307
VMLINUX_SYMBOL(__end_pci_fixups_resume) = .; \
308308
VMLINUX_SYMBOL(__start_pci_fixups_resume_early) = .; \
309-
*(.pci_fixup_resume_early) \
309+
KEEP(*(.pci_fixup_resume_early)) \
310310
VMLINUX_SYMBOL(__end_pci_fixups_resume_early) = .; \
311311
VMLINUX_SYMBOL(__start_pci_fixups_suspend) = .; \
312-
*(.pci_fixup_suspend) \
312+
KEEP(*(.pci_fixup_suspend)) \
313313
VMLINUX_SYMBOL(__end_pci_fixups_suspend) = .; \
314314
VMLINUX_SYMBOL(__start_pci_fixups_suspend_late) = .; \
315-
*(.pci_fixup_suspend_late) \
315+
KEEP(*(.pci_fixup_suspend_late)) \
316316
VMLINUX_SYMBOL(__end_pci_fixups_suspend_late) = .; \
317317
} \
318318
\
319319
/* Built-in firmware blobs */ \
320320
.builtin_fw : AT(ADDR(.builtin_fw) - LOAD_OFFSET) { \
321321
VMLINUX_SYMBOL(__start_builtin_fw) = .; \
322-
*(.builtin_fw) \
322+
KEEP(*(.builtin_fw)) \
323323
VMLINUX_SYMBOL(__end_builtin_fw) = .; \
324324
} \
325325
\
@@ -397,7 +397,7 @@
397397
\
398398
/* Kernel symbol table: strings */ \
399399
__ksymtab_strings : AT(ADDR(__ksymtab_strings) - LOAD_OFFSET) { \
400-
KEEP(*(__ksymtab_strings)) \
400+
*(__ksymtab_strings) \
401401
} \
402402
\
403403
/* __*init sections */ \
@@ -410,14 +410,14 @@
410410
/* Built-in module parameters. */ \
411411
__param : AT(ADDR(__param) - LOAD_OFFSET) { \
412412
VMLINUX_SYMBOL(__start___param) = .; \
413-
*(__param) \
413+
KEEP(*(__param)) \
414414
VMLINUX_SYMBOL(__stop___param) = .; \
415415
} \
416416
\
417417
/* Built-in module versions. */ \
418418
__modver : AT(ADDR(__modver) - LOAD_OFFSET) { \
419419
VMLINUX_SYMBOL(__start___modver) = .; \
420-
*(__modver) \
420+
KEEP(*(__modver)) \
421421
VMLINUX_SYMBOL(__stop___modver) = .; \
422422
. = ALIGN((align)); \
423423
VMLINUX_SYMBOL(__end_rodata) = .; \
@@ -520,7 +520,7 @@
520520
. = ALIGN(align); \
521521
__ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) { \
522522
VMLINUX_SYMBOL(__start___ex_table) = .; \
523-
*(__ex_table) \
523+
KEEP(*(__ex_table)) \
524524
VMLINUX_SYMBOL(__stop___ex_table) = .; \
525525
}
526526

@@ -536,9 +536,9 @@
536536
#ifdef CONFIG_CONSTRUCTORS
537537
#define KERNEL_CTORS() . = ALIGN(8); \
538538
VMLINUX_SYMBOL(__ctors_start) = .; \
539-
*(.ctors) \
540-
*(SORT(.init_array.*)) \
541-
*(.init_array) \
539+
KEEP(*(.ctors)) \
540+
KEEP(*(SORT(.init_array.*))) \
541+
KEEP(*(.init_array)) \
542542
VMLINUX_SYMBOL(__ctors_end) = .;
543543
#else
544544
#define KERNEL_CTORS()
@@ -663,7 +663,7 @@
663663
. = ALIGN(8); \
664664
__bug_table : AT(ADDR(__bug_table) - LOAD_OFFSET) { \
665665
VMLINUX_SYMBOL(__start___bug_table) = .; \
666-
*(__bug_table) \
666+
KEEP(*(__bug_table)) \
667667
VMLINUX_SYMBOL(__stop___bug_table) = .; \
668668
}
669669
#else
@@ -675,7 +675,7 @@
675675
. = ALIGN(4); \
676676
.tracedata : AT(ADDR(.tracedata) - LOAD_OFFSET) { \
677677
VMLINUX_SYMBOL(__tracedata_start) = .; \
678-
*(.tracedata) \
678+
KEEP(*(.tracedata)) \
679679
VMLINUX_SYMBOL(__tracedata_end) = .; \
680680
}
681681
#else
@@ -692,7 +692,7 @@
692692
#define INIT_SETUP(initsetup_align) \
693693
. = ALIGN(initsetup_align); \
694694
VMLINUX_SYMBOL(__setup_start) = .; \
695-
*(.init.setup) \
695+
KEEP(*(.init.setup)) \
696696
VMLINUX_SYMBOL(__setup_end) = .;
697697

698698
#define INIT_CALLS_LEVEL(level) \

‎samples/bpf/Makefile‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,10 +141,10 @@ CLANG ?= clang
141141

142142
# Trick to allow make to be run from this directory
143143
all:
144-
$(MAKE) -C ../../ $$PWD/
144+
$(MAKE) -C ../../ $(CURDIR)/
145145

146146
clean:
147-
$(MAKE) -C ../../ M=$$PWD clean
147+
$(MAKE) -C ../../ M=$(CURDIR) clean
148148
@rm -f *~
149149

150150
# Verify LLVM compiler tools are available and bpf target is supported by llc

‎samples/connector/Makefile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ HOSTCFLAGS_ucon.o += -I$(objtree)/usr/include
1313
all: modules
1414

1515
modules clean:
16-
$(MAKE) -C ../.. SUBDIRS=$(PWD) $@
16+
$(MAKE) -C ../.. SUBDIRS=$(CURDIR) $@

‎scripts/Makefile.build‎

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -488,9 +488,9 @@ endif
488488

489489
quiet_cmd_export_list = EXPORTS $@
490490
cmd_export_list = $(OBJDUMP) -h $< | \
491-
sed -ne '/___ksymtab/{s/.*+/$(ref_prefix)/;s/ .*/)/;p}' >$(ksyms-lds);\
491+
sed -ne '/___ksymtab/s/.*+\([^ ]*\).*/$(ref_prefix)\1)/p' >$(ksyms-lds);\
492492
rm -f $(dummy-object);\
493-
$(AR) rcs$(KBUILD_ARFLAGS) $(dummy-object);\
493+
echo | $(CC) $(a_flags) -c -o $(dummy-object) -x assembler -;\
494494
$(LD) $(ld_flags) -r -o $@ -T $(ksyms-lds) $(dummy-object);\
495495
rm $(dummy-object) $(ksyms-lds)
496496

@@ -517,11 +517,18 @@ $($(subst $(obj)/,,$(@:.o=-objs))) \
517517
$($(subst $(obj)/,,$(@:.o=-y))) \
518518
$($(subst $(obj)/,,$(@:.o=-m)))), $^)
519519

520-
quiet_cmd_link_multi-y = LD $@
521-
cmd_link_multi-y = $(LD) $(ld_flags) -r -o $@ $(link_multi_deps) $(cmd_secanalysis)
520+
cmd_link_multi-link = $(LD) $(ld_flags) -r -o $@ $(link_multi_deps) $(cmd_secanalysis)
521+
522+
ifdef CONFIG_THIN_ARCHIVES
523+
quiet_cmd_link_multi-y = AR $@
524+
cmd_link_multi-y = rm -f $@; $(AR) rcST$(KBUILD_ARFLAGS) $@ $(link_multi_deps)
525+
else
526+
quiet_cmd_link_multi-y = LD $@
527+
cmd_link_multi-y = $(cmd_link_multi-link)
528+
endif
522529

523530
quiet_cmd_link_multi-m = LD [M] $@
524-
cmd_link_multi-m = $(cmd_link_multi-y)
531+
cmd_link_multi-m = $(cmd_link_multi-link)
525532

526533
$(multi-used-y): FORCE
527534
$(call if_changed,link_multi-y)

‎scripts/adjust_autoksyms.sh‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ cat > "$new_ksyms_file" << EOT
5959
*/
6060
6161
EOT
62+
[ "$(ls -A "$MODVERDIR")" ] &&
6263
sed -ns -e '3{s/ /\n/g;/^$/!p;}' "$MODVERDIR"/*.mod | sort -u |
6364
while read sym; do
6465
if [ -n "$CONFIG_HAVE_UNDERSCORE_SYMBOL_PREFIX" ]; then

‎scripts/genksyms/keywords.gperf‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ __typeof, TYPEOF_KEYW
2727
__typeof__, TYPEOF_KEYW
2828
__volatile, VOLATILE_KEYW
2929
__volatile__, VOLATILE_KEYW
30+
__builtin_va_list, VA_LIST_KEYW
3031
# According to rth, c99 defines _Bool, __restrict, __restrict__, restrict. KAO
3132
_Bool, BOOL_KEYW
3233
_restrict, RESTRICT_KEYW

0 commit comments

Comments
 (0)