x86/build: work around older GNU ld not leaving .got.plt empty

The initial three entries in .got.plt are "static", i.e. present
independent of actual entries allocation of which is triggered by
respective relocations. When no real entries are needed, halfway recent
ld discards the "static" portion of the table as well, but older GNU ld
fails to do so.

Fixes: dedb0aa42c ("x86/build: use --orphan-handling linker option if available")
Reported-by: Julien Grall <jgrall@amazon.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
Tested-by: Julien Grall <jgrall@amazon.com>
This commit is contained in:
Jan Beulich committed 2022-03-22 13:10:59 +01:00
1 parent b68664ab89
commit a2b8da2574
1 file changed
+7 -1
+7 -1
View File
@@ -497,7 +497,13 @@ ASSERT(IS_ALIGNED(__bss_end, 8), "__bss_end misaligned")
#ifndef EFI
ASSERT(!SIZEOF(.got), ".got non-empty")
ASSERT(!SIZEOF(.got.plt), ".got.plt non-empty")
/*
* At least GNU ld 2.30 and earlier fail to discard the generic part of
* .got.plt when no actual entries were allocated. Permit this case alongside
* the section being empty.
*/
ASSERT(!SIZEOF(.got.plt) || SIZEOF(.got.plt) == 3 * 8,
"unexpected .got.plt size")
ASSERT(!SIZEOF(.igot.plt), ".igot.plt non-empty")
ASSERT(!SIZEOF(.iplt), ".iplt non-empty")
ASSERT(!SIZEOF(.plt), ".plt non-empty")
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.