[PATCH] D63121: [ELF] Make the rule to create relative relocations in a writable section stricter
Peter Smith via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 12 09:10:39 PDT 2019
peter.smith added a comment.
A look at the differences between libclang.so with and without the patch is that what used to be a R_ARM_RELATIVE relocation is now a R_ARM_ABS32 relocation to an undefined symbol. The latter will likely resolve to 0. All of the difference is concentrated in the .init_array section which uses the R_ARM_TARGET1 relocation, which is treated as R_ARM_ABS32 by default but with an option be treated as R_ARM_REL32 (some embedded systems use offsets rather than addresses).
For example:
Good
Contents of section .init_array:
2d21008 c980c300 c46fb301 f89ab301 acfbb601 .....o..........
2d21018 8067b801 8040b901 403fbf01 00bec101 .g... at ..@?......
2d21028 c0bdc201 c873c301 8c52c501 7810c601 .....s...R..x...
...
02d21008 00000017 R_ARM_RELATIVE
02d2100c 00000017 R_ARM_RELATIVE
02d21010 00000017 R_ARM_RELATIVE
02d21014 00000017 R_ARM_RELATIVE
02d21018 00000017 R_ARM_RELATIVE
02d2101c 00000017 R_ARM_RELATIVE
02d21020 00000017 R_ARM_RELATIVE
02d21024 00000017 R_ARM_RELATIVE
02d21028 00000017 R_ARM_RELATIVE
Bad:
Contents of section .init_array:
2d21008 c980c300 00000000 00000000 00000000 ................
2d21018 00000000 00000000 00000000 00000000 ................
2d21028 00000000 00000000 00000000 00000000 ................
...
02d21008 00000017 R_ARM_RELATIVE
02d2100c 00000002 R_ARM_ABS32
02d21010 00000002 R_ARM_ABS32
02d21014 00000002 R_ARM_ABS32
02d21018 00000002 R_ARM_ABS32
02d2101c 00000002 R_ARM_ABS32
02d21020 00000002 R_ARM_ABS32
02d21024 00000002 R_ARM_ABS32
02d21028 00000002 R_ARM_ABS32
So far I've not been able to make a simpler reproducer, as can be seen from the first entry in the .init_array there must be some special case.
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D63121/new/
https://reviews.llvm.org/D63121
More information about the llvm-commits
mailing list