Page MenuHomePhabricator

[ELF] -r: don't parse @ (symbol versioning) for .symver inline asm in bitcode
ClosedPublic

Authored by MaskRay on Jun 23 2020, 10:42 PM.

Details

Summary

Fixes PR46420
Similar to D43307 for non-LTO.

Module-level inline assembly can use .symver to create a symbol with @ in the name.
For relocatable output, @ should be retained in the symbol name. @ver should
not be parsed and dropped.

Diff Detail

Event Timeline

MaskRay created this revision.Jun 23 2020, 10:42 PM
MaskRay updated this revision to Diff 272917.Jun 23 2020, 11:10 PM

Fix a comment and improve test

Used the exact same fix as a local workaround until further counsel on the bug report, so looks good to me.
Thank you!

psmith accepted this revision.Jun 24 2020, 12:43 AM

Looks good to me. Agree that symbol versioning should be passed through in a relocatable link.

This revision is now accepted and ready to land.Jun 24 2020, 12:43 AM
grimar accepted this revision.Jun 24 2020, 1:31 AM

Looks reasonable. You don't need SHNDX I think.

lld/test/ELF/lto/version-script2.ll
3–5

Test -> test

14

This defines SHNDX which is never used I think. Why just you didn't use a section index instead?

MaskRay updated this revision to Diff 273028.Jun 24 2020, 8:08 AM
MaskRay marked 3 inline comments as done.

Address comments

MaskRay added inline comments.Jun 24 2020, 8:20 AM
lld/test/ELF/lto/version-script2.ll
14

The variable name cannot be omitted:

% cat a.txt
CHECK: [[#%u:]]
% FileCheck a.txt
a.txt:1:11: error: invalid variable name
CHECK: [[#%u:]]
          ^

I'll use {{ instead.

This revision was automatically updated to reflect the committed changes.