This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Hi, In PR 20608, we have a case where a Thumb2 branch to PLT using b.w targets the pre-PLT Thumb-ARM stub that is too far away. Indeed, the linker is able to insert a pre-PLT Thumb->ARM stub to handle Thumb mode calls through a PLT, but the check if a farcall stub is needed doesn't take this into account correctly. Depending on the branch-target distance, there is a 4 bytes windows that is not handled properly: the closer range is handled by a direct branch to the pre-PLT stub, while the further range is handle by a farcall stub directly targeting the PLT. Between the 2 ranges, there are 2 possible distances where a b.w instruction would result in a "relocation truncated" error. The attached patch fixes that by taking into account the actual final distance when checking if a farcall stub is needed. I hope I updated my comments in a clear way :-) Regarding the testcase, I have added farcall-mixed-app2, which is a copy of farcall-mixed-app with a new mid-range section right at the offending frontier. I added a new testcase instead of updating this existing one because adding b.w instructions enabled the linker to replace bl by blx when needed, implying necessary modifications to the expected results, and in effect removing tests for old architectures. So now, we have farcall-mixed-app, farcall-mixed-app-v5 (the same one, linked with --use-blx to allow the linker to replace bl with blx) and farcall-mixed-app2 which uses b.w. It seems this problem has been causing numerous random failures in LLVM buildbots. OK? Thanks, Christophe
Attachment:
binutils-pr20608.log.txt
Description: Text document
Attachment:
binutils-pr20608.patch.txt
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |