This is an archive of the discontinued LLVM Phabricator instance.

Don't treat .symver as a regular alias definition
ClosedPublic

Authored by espindola on Mar 8 2018, 5:31 PM.

Details

Reviewers
pcc
vitalybuka
Summary

This patch starts simplifying the handling of .symver.

For now it just moves the responsibility for creating an alias down to the streamer. With that the asm streamer can pass a .symver unchanged, which is nice since gas cannot parse "foo@bar = zed".

In a followup I hope to move the handling down to the writer so that we don't need special hacks for avoiding breaking names with @@@ on windows.

Diff Detail

Event Timeline

espindola created this revision.Mar 8 2018, 5:31 PM
vitalybuka accepted this revision.Mar 8 2018, 5:38 PM
This revision is now accepted and ready to land.Mar 8 2018, 5:38 PM
vitalybuka added inline comments.Mar 8 2018, 5:42 PM
lib/MC/MCParser/ELFAsmParser.cpp
774

Can we still pass AliasName instead of created Alias ?

pcc accepted this revision.Mar 8 2018, 5:47 PM

LGTM

lib/MC/MCParser/ELFAsmParser.cpp
774

Most clients will want to consume the MCSymbol, so it seems a little simpler to create it here.

vitalybuka added inline comments.Mar 8 2018, 5:50 PM
lib/MC/MCParser/ELFAsmParser.cpp
774

Then I am sure when to replace @@@ with @ or @@

vitalybuka added inline comments.Mar 8 2018, 5:51 PM
lib/MC/MCParser/ELFAsmParser.cpp
774

I can e.g. discard already created MCSymbol and replace with new one

pcc added inline comments.Mar 8 2018, 5:57 PM
lib/MC/MCParser/ELFAsmParser.cpp
774

Either that or see if we can avoid creating the new MCSymbol at all.

Vitaly Buka via Phabricator via llvm-commits
<llvm-commits@lists.llvm.org> writes:

vitalybuka added inline comments.

Comment at: lib/MC/MCParser/ELFAsmParser.cpp:774

MCSymbol *Sym = getContext().getOrCreateSymbol(Name);
  • const MCExpr *Value = MCSymbolRefExpr::create(Sym, getContext()); -
  • getStreamer().EmitAssignment(Alias, Value); getStreamer().emitELFSymverDirective(Alias, Sym); return false; ----------------

Can we still pass AliasName instead of created Alias ?

That is what I intend to do in a followup patch. That way we only create
the symbol once we know if @@@ should be a @@ or a @.

Cheers,
Rafael