Skip to content

Commit 976c23a

Browse files
Victor Kamenskypaulburton
authored andcommitted
mips: vdso: add build time check that no 'jalr t9' calls left
vdso shared object cannot have GOT based PIC 'jalr t9' calls because nobody set GOT table in vdso. Contributing into vdso .o files are compiled in PIC mode and as result for internal static functions calls compiler will generate 'jalr t9' instructions. Those are supposed to be converted into PC relative 'bal' calls by linker when relocation are processed. Mips global GOT entries do have dynamic relocations and they will be caught by cmd_vdso_check Makefile rule. Static PIC calls go through mips local GOT entries that do not have dynamic relocations. For those 'jalr t9' calls could be present but without dynamic relocations and they need to be converted to 'bal' calls by linker. Add additional build time check to make sure that no 'jalr t9' slip through because of some toolchain misconfiguration that prevents 'jalr t9' to 'bal' conversion. Signed-off-by: Victor Kamensky <[email protected]> Signed-off-by: Paul Burton <[email protected]> Cc: [email protected] Cc: Ralf Baechle <[email protected]> Cc: James Hogan <[email protected]> Cc: Vincenzo Frascino <[email protected]> Cc: [email protected] Cc: [email protected]
1 parent 07015d7 commit 976c23a

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

arch/mips/vdso/Makefile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,18 @@ GCOV_PROFILE := n
9797
UBSAN_SANITIZE := n
9898
KCOV_INSTRUMENT := n
9999

100+
# Check that we don't have PIC 'jalr t9' calls left
101+
quiet_cmd_vdso_mips_check = VDSOCHK $@
102+
cmd_vdso_mips_check = if $(OBJDUMP) --disassemble $@ | egrep -h "jalr.*t9" > /dev/null; \
103+
then (echo >&2 "$@: PIC 'jalr t9' calls are not supported"; \
104+
rm -f $@; /bin/false); fi
105+
100106
#
101107
# Shared build commands.
102108
#
103109

104110
quiet_cmd_vdsold_and_vdso_check = LD $@
105-
cmd_vdsold_and_vdso_check = $(cmd_vdsold); $(cmd_vdso_check)
111+
cmd_vdsold_and_vdso_check = $(cmd_vdsold); $(cmd_vdso_check); $(cmd_vdso_mips_check)
106112

107113
quiet_cmd_vdsold = VDSO $@
108114
cmd_vdsold = $(CC) $(c_flags) $(VDSO_LDFLAGS) \

0 commit comments

Comments
 (0)