Page MenuHomePhabricator

[Hexagon] Add support for general dynamic relocs
ClosedPublic

Authored by sidneym on Jan 10 2020, 10:10 AM.

Details

Summary

Add support for: R_HEX_GD_GOT_11/16_X and R_HEX_GD_GOT_32_6_X

Diff Detail

Event Timeline

sidneym created this revision.Jan 10 2020, 10:10 AM
MaskRay added inline comments.Jan 10 2020, 3:44 PM
lld/test/ELF/hexagon-tls-gd.s
13

Add llvm-readobj -r %t to test %t does not have a relocation.

GD->LD still applies, even if the code sequence does not change.

23

Doesn't Hexagon need to call __tls_get_addr?

35

Since the address is insignificant, 0x{{[0-9a-f]+}}

42

Check closing brace } as well.

[Hexagon] Add support for global dynamic relocs

GD has several names, "general dynamic", "generic dynamic" (typo), "global dynamic" (likely mistake, used by gcc/clang function attribute). "General dynamic" is the canonical one.

sidneym updated this revision to Diff 237991.Jan 14 2020, 9:53 AM
sidneym retitled this revision from [Hexagon] Add support for global dynamic relocs to [Hexagon] Add support for general dynamic relocs.

Update testcase.

  • Verify the absence of relocations in the executable.
  • hexagon may call tls_get_addr but the name is not explicitly stated in the ABI. The internally maintained linker will create the symbol to call which is generally "tls_get_addr". There are instances when it would not be "tls_get_addr" such as when a user built a static executable using objects built -shared -pic. In such a case the internal linker would create a stub called __hexagon_ie_tls_get_addr and call it. LLD for hexagon would not support doing this until some design could be agreed upon.
  • Don't check explicit addresses in GOT.
  • Added the check for the closing brace.
bcain added a comment.Jan 20 2020, 9:59 PM

Update testcase.

  • Verify the absence of relocations in the executable.
  • hexagon may call tls_get_addr but the name is not explicitly stated in the ABI. The internally maintained linker will create the symbol to call which is generally "tls_get_addr". There are instances when it would not be "tls_get_addr" such as when a user built a static executable using objects built -shared -pic. In such a case the internal linker would create a stub called __hexagon_ie_tls_get_addr and call it. LLD for hexagon would not support doing this until some design could be agreed upon.
  • Don't check explicit addresses in GOT.
  • Added the check for the closing brace.

LGTM, @sidneym. It would be more explicit if you marked the outstanding items on the review as 'DONE'.

@MaskRay / @ruiu what do you think?

sidneym marked 4 inline comments as done.Jan 21 2020, 7:12 AM
MaskRay accepted this revision.Jan 21 2020, 10:19 AM
MaskRay added inline comments.
lld/test/ELF/hexagon-tls-gd.s
5

excess space

13

excess space

This revision is now accepted and ready to land.Jan 21 2020, 10:19 AM
This revision was automatically updated to reflect the committed changes.