s390: vmlinux.lds.S: explicitly handle '.got' and '.plt' sections
When building with CONFIG_LD_ORPHAN_WARN after selecting CONFIG_ARCH_HAS_LD_ORPHAN_WARN, there are a lot of warnings around the GOT and PLT sections: s390-linux-ld: warning: orphan section `.plt' from `arch/s390/kernel/head64.o' being placed in section `.plt' s390-linux-ld: warning: orphan section `.got' from `arch/s390/kernel/head64.o' being placed in section `.got' s390-linux-ld: warning: orphan section `.got.plt' from `arch/s390/kernel/head64.o' being placed in section `.got.plt' s390-linux-ld: warning: orphan section `.iplt' from `arch/s390/kernel/head64.o' being placed in section `.iplt' s390-linux-ld: warning: orphan section `.igot.plt' from `arch/s390/kernel/head64.o' being placed in section `.igot.plt' s390-linux-ld: warning: orphan section `.iplt' from `arch/s390/boot/head.o' being placed in section `.iplt' s390-linux-ld: warning: orphan section `.igot.plt' from `arch/s390/boot/head.o' being placed in section `.igot.plt' s390-linux-ld: warning: orphan section `.got' from `arch/s390/boot/head.o' being placed in section `.got' Currently, only the '.got' section is actually emitted in the final binary. In a manner similar to other architectures, put the '.got' section near the '.data' section and coalesce the PLT sections, checking that the final section is zero sized, which is a safe/tested approach versus full discard. Signed-off-by: Nathan Chancellor <nathan@kernel.org> Tested-by: Justin Stitt <justinstitt@google.com> Link: https://lore.kernel.org/r/20240207-s390-lld-and-orphan-warn-v1-3-8a665b3346ab@kernel.org Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
This commit is contained in:
parent
bdf2cd27a3
commit
30226853d6
2 changed files with 32 additions and 0 deletions
|
@ -39,6 +39,9 @@ SECTIONS
|
||||||
*(.rodata.*)
|
*(.rodata.*)
|
||||||
_erodata = . ;
|
_erodata = . ;
|
||||||
}
|
}
|
||||||
|
.got : {
|
||||||
|
*(.got)
|
||||||
|
}
|
||||||
NOTES
|
NOTES
|
||||||
.data : {
|
.data : {
|
||||||
_data = . ;
|
_data = . ;
|
||||||
|
@ -118,6 +121,19 @@ SECTIONS
|
||||||
}
|
}
|
||||||
_end = .;
|
_end = .;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Sections that should stay zero sized, which is safer to
|
||||||
|
* explicitly check instead of blindly discarding.
|
||||||
|
*/
|
||||||
|
.got.plt : {
|
||||||
|
*(.got.plt)
|
||||||
|
}
|
||||||
|
ASSERT(SIZEOF(.got.plt) == 0, "Unexpected GOT/PLT entries detected!")
|
||||||
|
.plt : {
|
||||||
|
*(.plt) *(.plt.*) *(.iplt) *(.igot .igot.plt)
|
||||||
|
}
|
||||||
|
ASSERT(SIZEOF(.plt) == 0, "Unexpected run-time procedure linkages detected!")
|
||||||
|
|
||||||
/* Sections to be discarded */
|
/* Sections to be discarded */
|
||||||
/DISCARD/ : {
|
/DISCARD/ : {
|
||||||
*(.eh_frame)
|
*(.eh_frame)
|
||||||
|
|
|
@ -62,6 +62,9 @@ SECTIONS
|
||||||
.data.rel.ro : {
|
.data.rel.ro : {
|
||||||
*(.data.rel.ro .data.rel.ro.*)
|
*(.data.rel.ro .data.rel.ro.*)
|
||||||
}
|
}
|
||||||
|
.got : {
|
||||||
|
*(.got)
|
||||||
|
}
|
||||||
|
|
||||||
. = ALIGN(PAGE_SIZE);
|
. = ALIGN(PAGE_SIZE);
|
||||||
_sdata = .; /* Start of data section */
|
_sdata = .; /* Start of data section */
|
||||||
|
@ -241,6 +244,19 @@ SECTIONS
|
||||||
DWARF_DEBUG
|
DWARF_DEBUG
|
||||||
ELF_DETAILS
|
ELF_DETAILS
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Sections that should stay zero sized, which is safer to
|
||||||
|
* explicitly check instead of blindly discarding.
|
||||||
|
*/
|
||||||
|
.got.plt : {
|
||||||
|
*(.got.plt)
|
||||||
|
}
|
||||||
|
ASSERT(SIZEOF(.got.plt) == 0, "Unexpected GOT/PLT entries detected!")
|
||||||
|
.plt : {
|
||||||
|
*(.plt) *(.plt.*) *(.iplt) *(.igot .igot.plt)
|
||||||
|
}
|
||||||
|
ASSERT(SIZEOF(.plt) == 0, "Unexpected run-time procedure linkages detected!")
|
||||||
|
|
||||||
/* Sections to be discarded */
|
/* Sections to be discarded */
|
||||||
DISCARDS
|
DISCARDS
|
||||||
/DISCARD/ : {
|
/DISCARD/ : {
|
||||||
|
|
Loading…
Add table
Reference in a new issue