This is an archive of the discontinued LLVM Phabricator instance.

[lld][ARM] support position independent thunks for Armv4(T)
ClosedPublic

Authored by stuij on Jan 9 2023, 3:11 AM.

Details

Summary
  • Position independent thunks now work for both Armv4 and Armv4T
  • Armv4 arm->arm thunks don't emit a BX anymore, which doesn't exist for the arch. This fixes https://github.com/llvm/llvm-project/issues/50764.
  • Armv4 and Armv4T both have the same arm->arm behaviour. Which also is desirable for the above ticket.

Diff Detail

Event Timeline

stuij created this revision.Jan 9 2023, 3:11 AM
Herald added a project: Restricted Project. · View Herald Transcript
stuij requested review of this revision.Jan 9 2023, 3:11 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 9 2023, 3:11 AM
peter.smith accepted this revision.Jan 11 2023, 7:42 AM

I'm happy with these from the Arm v4 support perspective. I think some TODO comments may no longer apply, but these can easily be fixed up pre-commit.

lld/ELF/Thunks.cpp
1238–1239

Are these TODOs still applicable? If not then they can be removed.

This revision is now accepted and ready to land.Jan 11 2023, 7:42 AM
MaskRay added inline comments.Jan 11 2023, 4:24 PM
lld/ELF/Thunks.cpp
1249–1251
if (config->picThunk) {
  if (thumb_target)
    return ... 
  return ...
}

or

if (config->picThunk)
  return thumb_target ? make<...> : make<...>)
1257–1258

ditto

lld/test/ELF/arm-bl-v4.s
17
52

s/ +$// on this line

73

You could also use # for all comments in this file:)

MaskRay accepted this revision.Jan 11 2023, 4:24 PM
MaskRay added inline comments.Jan 11 2023, 4:27 PM
lld/test/ELF/arm-bl-v4.s
76

Ideally you combine near.lds and far.lds and let a.s contain both a near call and a far call.
This decreases the number of RUN lines

MaskRay added inline comments.Jan 11 2023, 4:30 PM
lld/test/ELF/arm-bl-v4.s
76

Similar to .mid in riscv-relax-call.s

This revision was landed with ongoing or failed builds.Jan 13 2023, 3:57 AM
This revision was automatically updated to reflect the committed changes.
stuij marked 5 inline comments as done.