[RFC,4/7] x86/boot/compressed: Adapt sed command if head code is built as PIE
Commit Message
When x86/head64_identity.c is built as PIE, all symbols would be set as
hidden to omit GOT references. According to the generic ABI, a hidden
symbol contained in a relocatable object must be either removed or
converted to STB_LOCAL binding by the link-editor when the relocatable
object is included in an executable file or shared object. Both gold and
ld.lld change the binding of a STV_HIDDEND symbol to STB_LOCAL. However,
for GNU ld, it will keep the global hidden. The sed command to generate
voffset.h only captures global symbols, so an empty voffset.h would be
generated with ld.lld. Therefore, local symbols should also be captured
in the sed command.
Signed-off-by: Hou Wenlong <houwenlong.hwl@antgroup.com>
---
arch/x86/boot/compressed/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
@@ -79,7 +79,7 @@ LDFLAGS_vmlinux += -T
hostprogs := mkpiggy
HOST_EXTRACFLAGS += -I$(srctree)/tools/include
-sed-voffset := -e 's/^\([0-9a-fA-F]*\) [ABCDGRSTVW] \(_text\|__bss_start\|_end\)$$/\#define VO_\2 _AC(0x\1,UL)/p'
+sed-voffset := -e 's/^\([0-9a-fA-F]*\) [ABCDGRSTVWabcdgrstvw] \(_text\|__bss_start\|_end\)$$/\#define VO_\2 _AC(0x\1,UL)/p'
quiet_cmd_voffset = VOFFSET $@
cmd_voffset = $(NM) $< | sed -n $(sed-voffset) > $@