mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-22 04:03:58 +08:00
6d30e3a899
Several reports on inconsistent kallsyms data has been caused by the aliased symbols __sched_text_start and __down to shift places in the output of nm. The root cause was that on second pass ld aligned __sched_text_start to a 4 byte boundary which is the function alignment on i386. sched.text and spinlock.text is now aligned to an 8 byte boundary to make sure they are aligned to a function alignemnt on most (all?) archs. Tested by: Paulo Marques <pmarques@grupopie.com> Tested by: Alexander Stohr <Alexander.Stohr@gmx.de> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
100 lines
3.3 KiB
C
100 lines
3.3 KiB
C
#ifndef LOAD_OFFSET
|
|
#define LOAD_OFFSET 0
|
|
#endif
|
|
|
|
#ifndef VMLINUX_SYMBOL
|
|
#define VMLINUX_SYMBOL(_sym_) _sym_
|
|
#endif
|
|
|
|
/* Align . to a 8 byte boundary equals to maximum function alignment. */
|
|
#define ALIGN_FUNCTION() . = ALIGN(8)
|
|
|
|
#define RODATA \
|
|
.rodata : AT(ADDR(.rodata) - LOAD_OFFSET) { \
|
|
*(.rodata) *(.rodata.*) \
|
|
*(__vermagic) /* Kernel version magic */ \
|
|
} \
|
|
\
|
|
.rodata1 : AT(ADDR(.rodata1) - LOAD_OFFSET) { \
|
|
*(.rodata1) \
|
|
} \
|
|
\
|
|
/* PCI quirks */ \
|
|
.pci_fixup : AT(ADDR(.pci_fixup) - LOAD_OFFSET) { \
|
|
VMLINUX_SYMBOL(__start_pci_fixups_early) = .; \
|
|
*(.pci_fixup_early) \
|
|
VMLINUX_SYMBOL(__end_pci_fixups_early) = .; \
|
|
VMLINUX_SYMBOL(__start_pci_fixups_header) = .; \
|
|
*(.pci_fixup_header) \
|
|
VMLINUX_SYMBOL(__end_pci_fixups_header) = .; \
|
|
VMLINUX_SYMBOL(__start_pci_fixups_final) = .; \
|
|
*(.pci_fixup_final) \
|
|
VMLINUX_SYMBOL(__end_pci_fixups_final) = .; \
|
|
VMLINUX_SYMBOL(__start_pci_fixups_enable) = .; \
|
|
*(.pci_fixup_enable) \
|
|
VMLINUX_SYMBOL(__end_pci_fixups_enable) = .; \
|
|
} \
|
|
\
|
|
/* Kernel symbol table: Normal symbols */ \
|
|
__ksymtab : AT(ADDR(__ksymtab) - LOAD_OFFSET) { \
|
|
VMLINUX_SYMBOL(__start___ksymtab) = .; \
|
|
*(__ksymtab) \
|
|
VMLINUX_SYMBOL(__stop___ksymtab) = .; \
|
|
} \
|
|
\
|
|
/* Kernel symbol table: GPL-only symbols */ \
|
|
__ksymtab_gpl : AT(ADDR(__ksymtab_gpl) - LOAD_OFFSET) { \
|
|
VMLINUX_SYMBOL(__start___ksymtab_gpl) = .; \
|
|
*(__ksymtab_gpl) \
|
|
VMLINUX_SYMBOL(__stop___ksymtab_gpl) = .; \
|
|
} \
|
|
\
|
|
/* Kernel symbol table: Normal symbols */ \
|
|
__kcrctab : AT(ADDR(__kcrctab) - LOAD_OFFSET) { \
|
|
VMLINUX_SYMBOL(__start___kcrctab) = .; \
|
|
*(__kcrctab) \
|
|
VMLINUX_SYMBOL(__stop___kcrctab) = .; \
|
|
} \
|
|
\
|
|
/* Kernel symbol table: GPL-only symbols */ \
|
|
__kcrctab_gpl : AT(ADDR(__kcrctab_gpl) - LOAD_OFFSET) { \
|
|
VMLINUX_SYMBOL(__start___kcrctab_gpl) = .; \
|
|
*(__kcrctab_gpl) \
|
|
VMLINUX_SYMBOL(__stop___kcrctab_gpl) = .; \
|
|
} \
|
|
\
|
|
/* Kernel symbol table: strings */ \
|
|
__ksymtab_strings : AT(ADDR(__ksymtab_strings) - LOAD_OFFSET) { \
|
|
*(__ksymtab_strings) \
|
|
} \
|
|
\
|
|
/* Built-in module parameters. */ \
|
|
__param : AT(ADDR(__param) - LOAD_OFFSET) { \
|
|
VMLINUX_SYMBOL(__start___param) = .; \
|
|
*(__param) \
|
|
VMLINUX_SYMBOL(__stop___param) = .; \
|
|
}
|
|
|
|
#define SECURITY_INIT \
|
|
.security_initcall.init : AT(ADDR(.security_initcall.init) - LOAD_OFFSET) { \
|
|
VMLINUX_SYMBOL(__security_initcall_start) = .; \
|
|
*(.security_initcall.init) \
|
|
VMLINUX_SYMBOL(__security_initcall_end) = .; \
|
|
}
|
|
|
|
/* sched.text is aling to function alignment to secure we have same
|
|
* address even at second ld pass when generating System.map */
|
|
#define SCHED_TEXT \
|
|
ALIGN_FUNCTION(); \
|
|
VMLINUX_SYMBOL(__sched_text_start) = .; \
|
|
*(.sched.text) \
|
|
VMLINUX_SYMBOL(__sched_text_end) = .;
|
|
|
|
/* spinlock.text is aling to function alignment to secure we have same
|
|
* address even at second ld pass when generating System.map */
|
|
#define LOCK_TEXT \
|
|
ALIGN_FUNCTION(); \
|
|
VMLINUX_SYMBOL(__lock_text_start) = .; \
|
|
*(.spinlock.text) \
|
|
VMLINUX_SYMBOL(__lock_text_end) = .;
|