diff options
author | Fangrui Song <maskray@google.com> | 2020-02-05 11:24:15 -0800 |
---|---|---|
committer | Fangrui Song <maskray@google.com> | 2020-02-06 11:31:04 -0800 |
commit | 727362e87bb3e35e812a44f41d08791683a04f5d (patch) | |
tree | c72c249ed5350152954b6beba1ac17002e7ef326 /llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp | |
parent | 208470dd5d0a46bc3c24b66489b687eda4954262 (diff) | |
download | llvm-727362e87bb3e35e812a44f41d08791683a04f5d.zip llvm-727362e87bb3e35e812a44f41d08791683a04f5d.tar.gz llvm-727362e87bb3e35e812a44f41d08791683a04f5d.tar.bz2 |
[MC][ELF] Rename MC related "Associated" to "LinkedToSym"
"linked-to section" is used by the ELF spec. By analogy, "linked-to
symbol" is a good name for the signature symbol. The word "linked-to"
implies a directed edge and makes it clear its relation with "sh_link",
while one can argue that "associated" means an undirected edge.
Also, combine tests and add precise SMLoc to improve diagnostics.
Reviewed By: eugenis, grimar, jhenderson
Differential Revision: https://reviews.llvm.org/D74082
Diffstat (limited to 'llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp')
-rw-r--r-- | llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp index 3e9e0fc..25df646 100644 --- a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp +++ b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp @@ -512,8 +512,8 @@ static const Comdat *getELFComdat(const GlobalValue *GV) { return C; } -static const MCSymbolELF *getAssociatedSymbol(const GlobalObject *GO, - const TargetMachine &TM) { +static const MCSymbolELF *getLinkedToSymbol(const GlobalObject *GO, + const TargetMachine &TM) { MDNode *MD = GO->getMetadata(LLVMContext::MD_associated); if (!MD) return nullptr; @@ -592,18 +592,18 @@ MCSection *TargetLoweringObjectFileELF::getExplicitSectionGlobal( // A section can have at most one associated section. Put each global with // MD_associated in a unique section. unsigned UniqueID = MCContext::GenericSectionID; - const MCSymbolELF *AssociatedSymbol = getAssociatedSymbol(GO, TM); - if (AssociatedSymbol) { + const MCSymbolELF *LinkedToSym = getLinkedToSymbol(GO, TM); + if (LinkedToSym) { UniqueID = NextUniqueID++; Flags |= ELF::SHF_LINK_ORDER; } MCSectionELF *Section = getContext().getELFSection( SectionName, getELFSectionType(SectionName, Kind), Flags, - getEntrySizeForKind(Kind), Group, UniqueID, AssociatedSymbol); + getEntrySizeForKind(Kind), Group, UniqueID, LinkedToSym); // Make sure that we did not get some other section with incompatible sh_link. // This should not be possible due to UniqueID code above. - assert(Section->getAssociatedSymbol() == AssociatedSymbol && + assert(Section->getLinkedToSymbol() == LinkedToSym && "Associated symbol mismatch between sections"); return Section; } @@ -696,16 +696,16 @@ MCSection *TargetLoweringObjectFileELF::SelectSectionForGlobal( } EmitUniqueSection |= GO->hasComdat(); - const MCSymbolELF *AssociatedSymbol = getAssociatedSymbol(GO, TM); - if (AssociatedSymbol) { + const MCSymbolELF *LinkedToSym = getLinkedToSymbol(GO, TM); + if (LinkedToSym) { EmitUniqueSection = true; Flags |= ELF::SHF_LINK_ORDER; } MCSectionELF *Section = selectELFSectionForGlobal( getContext(), GO, Kind, getMangler(), TM, EmitUniqueSection, Flags, - &NextUniqueID, AssociatedSymbol); - assert(Section->getAssociatedSymbol() == AssociatedSymbol); + &NextUniqueID, LinkedToSym); + assert(Section->getLinkedToSymbol() == LinkedToSym); return Section; } |