mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-18 18:42:46 +02:00
[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
This commit is contained in:
parent
713501bcf3
commit
7c84cd8ff5
@ -296,7 +296,7 @@ namespace llvm {
|
|||||||
unsigned EntrySize,
|
unsigned EntrySize,
|
||||||
const MCSymbolELF *Group,
|
const MCSymbolELF *Group,
|
||||||
unsigned UniqueID,
|
unsigned UniqueID,
|
||||||
const MCSymbolELF *Associated);
|
const MCSymbolELF *LinkedToSym);
|
||||||
|
|
||||||
/// Map of currently defined macros.
|
/// Map of currently defined macros.
|
||||||
StringMap<MCAsmMacro> MacroMap;
|
StringMap<MCAsmMacro> MacroMap;
|
||||||
@ -442,12 +442,12 @@ namespace llvm {
|
|||||||
MCSectionELF *getELFSection(const Twine &Section, unsigned Type,
|
MCSectionELF *getELFSection(const Twine &Section, unsigned Type,
|
||||||
unsigned Flags, unsigned EntrySize,
|
unsigned Flags, unsigned EntrySize,
|
||||||
const Twine &Group, unsigned UniqueID,
|
const Twine &Group, unsigned UniqueID,
|
||||||
const MCSymbolELF *Associated);
|
const MCSymbolELF *LinkedToSym);
|
||||||
|
|
||||||
MCSectionELF *getELFSection(const Twine &Section, unsigned Type,
|
MCSectionELF *getELFSection(const Twine &Section, unsigned Type,
|
||||||
unsigned Flags, unsigned EntrySize,
|
unsigned Flags, unsigned EntrySize,
|
||||||
const MCSymbolELF *Group, unsigned UniqueID,
|
const MCSymbolELF *Group, unsigned UniqueID,
|
||||||
const MCSymbolELF *Associated);
|
const MCSymbolELF *LinkedToSym);
|
||||||
|
|
||||||
/// Get a section with the provided group identifier. This section is
|
/// Get a section with the provided group identifier. This section is
|
||||||
/// named by concatenating \p Prefix with '.' then \p Suffix. The \p Type
|
/// named by concatenating \p Prefix with '.' then \p Suffix. The \p Type
|
||||||
|
@ -44,18 +44,19 @@ class MCSectionELF final : public MCSection {
|
|||||||
|
|
||||||
const MCSymbolELF *Group;
|
const MCSymbolELF *Group;
|
||||||
|
|
||||||
/// sh_info for SHF_LINK_ORDER (can be null).
|
/// Used by SHF_LINK_ORDER. If non-null, the sh_link field will be set to the
|
||||||
const MCSymbol *AssociatedSymbol;
|
/// section header index of the section where LinkedToSym is defined.
|
||||||
|
const MCSymbol *LinkedToSym;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class MCContext;
|
friend class MCContext;
|
||||||
|
|
||||||
MCSectionELF(StringRef Section, unsigned type, unsigned flags, SectionKind K,
|
MCSectionELF(StringRef Section, unsigned type, unsigned flags, SectionKind K,
|
||||||
unsigned entrySize, const MCSymbolELF *group, unsigned UniqueID,
|
unsigned entrySize, const MCSymbolELF *group, unsigned UniqueID,
|
||||||
MCSymbol *Begin, const MCSymbolELF *AssociatedSymbol)
|
MCSymbol *Begin, const MCSymbolELF *LinkedToSym)
|
||||||
: MCSection(SV_ELF, K, Begin), SectionName(Section), Type(type),
|
: MCSection(SV_ELF, K, Begin), SectionName(Section), Type(type),
|
||||||
Flags(flags), UniqueID(UniqueID), EntrySize(entrySize), Group(group),
|
Flags(flags), UniqueID(UniqueID), EntrySize(entrySize), Group(group),
|
||||||
AssociatedSymbol(AssociatedSymbol) {
|
LinkedToSym(LinkedToSym) {
|
||||||
if (Group)
|
if (Group)
|
||||||
Group->setIsSignature();
|
Group->setIsSignature();
|
||||||
}
|
}
|
||||||
@ -83,8 +84,10 @@ public:
|
|||||||
bool isUnique() const { return UniqueID != ~0U; }
|
bool isUnique() const { return UniqueID != ~0U; }
|
||||||
unsigned getUniqueID() const { return UniqueID; }
|
unsigned getUniqueID() const { return UniqueID; }
|
||||||
|
|
||||||
const MCSection *getAssociatedSection() const { return &AssociatedSymbol->getSection(); }
|
const MCSection *getLinkedToSection() const {
|
||||||
const MCSymbol *getAssociatedSymbol() const { return AssociatedSymbol; }
|
return &LinkedToSym->getSection();
|
||||||
|
}
|
||||||
|
const MCSymbol *getLinkedToSymbol() const { return LinkedToSym; }
|
||||||
|
|
||||||
static bool classof(const MCSection *S) {
|
static bool classof(const MCSection *S) {
|
||||||
return S->getVariant() == SV_ELF;
|
return S->getVariant() == SV_ELF;
|
||||||
|
@ -3180,8 +3180,8 @@ void AsmPrinter::emitXRayTable() {
|
|||||||
MCSection *InstMap = nullptr;
|
MCSection *InstMap = nullptr;
|
||||||
MCSection *FnSledIndex = nullptr;
|
MCSection *FnSledIndex = nullptr;
|
||||||
if (MF->getSubtarget().getTargetTriple().isOSBinFormatELF()) {
|
if (MF->getSubtarget().getTargetTriple().isOSBinFormatELF()) {
|
||||||
auto Associated = dyn_cast<MCSymbolELF>(CurrentFnSym);
|
auto LinkedToSym = dyn_cast<MCSymbolELF>(CurrentFnSym);
|
||||||
assert(Associated != nullptr);
|
assert(LinkedToSym != nullptr);
|
||||||
auto Flags = ELF::SHF_WRITE | ELF::SHF_ALLOC | ELF::SHF_LINK_ORDER;
|
auto Flags = ELF::SHF_WRITE | ELF::SHF_ALLOC | ELF::SHF_LINK_ORDER;
|
||||||
std::string GroupName;
|
std::string GroupName;
|
||||||
if (F.hasComdat()) {
|
if (F.hasComdat()) {
|
||||||
@ -3192,10 +3192,10 @@ void AsmPrinter::emitXRayTable() {
|
|||||||
auto UniqueID = ++XRayFnUniqueID;
|
auto UniqueID = ++XRayFnUniqueID;
|
||||||
InstMap =
|
InstMap =
|
||||||
OutContext.getELFSection("xray_instr_map", ELF::SHT_PROGBITS, Flags, 0,
|
OutContext.getELFSection("xray_instr_map", ELF::SHT_PROGBITS, Flags, 0,
|
||||||
GroupName, UniqueID, Associated);
|
GroupName, UniqueID, LinkedToSym);
|
||||||
FnSledIndex =
|
FnSledIndex =
|
||||||
OutContext.getELFSection("xray_fn_idx", ELF::SHT_PROGBITS, Flags, 0,
|
OutContext.getELFSection("xray_fn_idx", ELF::SHT_PROGBITS, Flags, 0,
|
||||||
GroupName, UniqueID, Associated);
|
GroupName, UniqueID, LinkedToSym);
|
||||||
} else if (MF->getSubtarget().getTargetTriple().isOSBinFormatMachO()) {
|
} else if (MF->getSubtarget().getTargetTriple().isOSBinFormatMachO()) {
|
||||||
InstMap = OutContext.getMachOSection("__DATA", "xray_instr_map", 0,
|
InstMap = OutContext.getMachOSection("__DATA", "xray_instr_map", 0,
|
||||||
SectionKind::getReadOnlyWithRel());
|
SectionKind::getReadOnlyWithRel());
|
||||||
|
@ -512,7 +512,7 @@ static const Comdat *getELFComdat(const GlobalValue *GV) {
|
|||||||
return C;
|
return C;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const MCSymbolELF *getAssociatedSymbol(const GlobalObject *GO,
|
static const MCSymbolELF *getLinkedToSymbol(const GlobalObject *GO,
|
||||||
const TargetMachine &TM) {
|
const TargetMachine &TM) {
|
||||||
MDNode *MD = GO->getMetadata(LLVMContext::MD_associated);
|
MDNode *MD = GO->getMetadata(LLVMContext::MD_associated);
|
||||||
if (!MD)
|
if (!MD)
|
||||||
@ -592,18 +592,18 @@ MCSection *TargetLoweringObjectFileELF::getExplicitSectionGlobal(
|
|||||||
// A section can have at most one associated section. Put each global with
|
// A section can have at most one associated section. Put each global with
|
||||||
// MD_associated in a unique section.
|
// MD_associated in a unique section.
|
||||||
unsigned UniqueID = MCContext::GenericSectionID;
|
unsigned UniqueID = MCContext::GenericSectionID;
|
||||||
const MCSymbolELF *AssociatedSymbol = getAssociatedSymbol(GO, TM);
|
const MCSymbolELF *LinkedToSym = getLinkedToSymbol(GO, TM);
|
||||||
if (AssociatedSymbol) {
|
if (LinkedToSym) {
|
||||||
UniqueID = NextUniqueID++;
|
UniqueID = NextUniqueID++;
|
||||||
Flags |= ELF::SHF_LINK_ORDER;
|
Flags |= ELF::SHF_LINK_ORDER;
|
||||||
}
|
}
|
||||||
|
|
||||||
MCSectionELF *Section = getContext().getELFSection(
|
MCSectionELF *Section = getContext().getELFSection(
|
||||||
SectionName, getELFSectionType(SectionName, Kind), Flags,
|
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.
|
// Make sure that we did not get some other section with incompatible sh_link.
|
||||||
// This should not be possible due to UniqueID code above.
|
// This should not be possible due to UniqueID code above.
|
||||||
assert(Section->getAssociatedSymbol() == AssociatedSymbol &&
|
assert(Section->getLinkedToSymbol() == LinkedToSym &&
|
||||||
"Associated symbol mismatch between sections");
|
"Associated symbol mismatch between sections");
|
||||||
return Section;
|
return Section;
|
||||||
}
|
}
|
||||||
@ -696,16 +696,16 @@ MCSection *TargetLoweringObjectFileELF::SelectSectionForGlobal(
|
|||||||
}
|
}
|
||||||
EmitUniqueSection |= GO->hasComdat();
|
EmitUniqueSection |= GO->hasComdat();
|
||||||
|
|
||||||
const MCSymbolELF *AssociatedSymbol = getAssociatedSymbol(GO, TM);
|
const MCSymbolELF *LinkedToSym = getLinkedToSymbol(GO, TM);
|
||||||
if (AssociatedSymbol) {
|
if (LinkedToSym) {
|
||||||
EmitUniqueSection = true;
|
EmitUniqueSection = true;
|
||||||
Flags |= ELF::SHF_LINK_ORDER;
|
Flags |= ELF::SHF_LINK_ORDER;
|
||||||
}
|
}
|
||||||
|
|
||||||
MCSectionELF *Section = selectELFSectionForGlobal(
|
MCSectionELF *Section = selectELFSectionForGlobal(
|
||||||
getContext(), GO, Kind, getMangler(), TM, EmitUniqueSection, Flags,
|
getContext(), GO, Kind, getMangler(), TM, EmitUniqueSection, Flags,
|
||||||
&NextUniqueID, AssociatedSymbol);
|
&NextUniqueID, LinkedToSym);
|
||||||
assert(Section->getAssociatedSymbol() == AssociatedSymbol);
|
assert(Section->getLinkedToSymbol() == LinkedToSym);
|
||||||
return Section;
|
return Section;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1001,7 +1001,7 @@ void ELFWriter::writeSection(const SectionIndexMapTy &SectionIndexMap,
|
|||||||
case ELF::SHT_RELA: {
|
case ELF::SHT_RELA: {
|
||||||
sh_link = SymbolTableIndex;
|
sh_link = SymbolTableIndex;
|
||||||
assert(sh_link && ".symtab not found");
|
assert(sh_link && ".symtab not found");
|
||||||
const MCSection *InfoSection = Section.getAssociatedSection();
|
const MCSection *InfoSection = Section.getLinkedToSection();
|
||||||
sh_info = SectionIndexMap.lookup(cast<MCSectionELF>(InfoSection));
|
sh_info = SectionIndexMap.lookup(cast<MCSectionELF>(InfoSection));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1024,7 +1024,7 @@ void ELFWriter::writeSection(const SectionIndexMapTy &SectionIndexMap,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (Section.getFlags() & ELF::SHF_LINK_ORDER) {
|
if (Section.getFlags() & ELF::SHF_LINK_ORDER) {
|
||||||
const MCSymbol *Sym = Section.getAssociatedSymbol();
|
const MCSymbol *Sym = Section.getLinkedToSymbol();
|
||||||
const MCSectionELF *Sec = cast<MCSectionELF>(&Sym->getSection());
|
const MCSectionELF *Sec = cast<MCSectionELF>(&Sym->getSection());
|
||||||
sh_link = SectionIndexMap.lookup(Sec);
|
sh_link = SectionIndexMap.lookup(Sec);
|
||||||
}
|
}
|
||||||
@ -1180,7 +1180,7 @@ uint64_t ELFWriter::writeObject(MCAssembler &Asm, const MCAsmLayout &Layout) {
|
|||||||
uint64_t SecStart = W.OS.tell();
|
uint64_t SecStart = W.OS.tell();
|
||||||
|
|
||||||
writeRelocations(Asm,
|
writeRelocations(Asm,
|
||||||
cast<MCSectionELF>(*RelSection->getAssociatedSection()));
|
cast<MCSectionELF>(*RelSection->getLinkedToSection()));
|
||||||
|
|
||||||
uint64_t SecEnd = W.OS.tell();
|
uint64_t SecEnd = W.OS.tell();
|
||||||
SectionOffsets[RelSection] = std::make_pair(SecStart, SecEnd);
|
SectionOffsets[RelSection] = std::make_pair(SecStart, SecEnd);
|
||||||
|
@ -332,7 +332,7 @@ MCSectionELF *MCContext::createELFSectionImpl(StringRef Section, unsigned Type,
|
|||||||
unsigned EntrySize,
|
unsigned EntrySize,
|
||||||
const MCSymbolELF *Group,
|
const MCSymbolELF *Group,
|
||||||
unsigned UniqueID,
|
unsigned UniqueID,
|
||||||
const MCSymbolELF *Associated) {
|
const MCSymbolELF *LinkedToSym) {
|
||||||
MCSymbolELF *R;
|
MCSymbolELF *R;
|
||||||
MCSymbol *&Sym = Symbols[Section];
|
MCSymbol *&Sym = Symbols[Section];
|
||||||
// A section symbol can not redefine regular symbols. There may be multiple
|
// A section symbol can not redefine regular symbols. There may be multiple
|
||||||
@ -352,7 +352,7 @@ MCSectionELF *MCContext::createELFSectionImpl(StringRef Section, unsigned Type,
|
|||||||
R->setType(ELF::STT_SECTION);
|
R->setType(ELF::STT_SECTION);
|
||||||
|
|
||||||
auto *Ret = new (ELFAllocator.Allocate()) MCSectionELF(
|
auto *Ret = new (ELFAllocator.Allocate()) MCSectionELF(
|
||||||
Section, Type, Flags, K, EntrySize, Group, UniqueID, R, Associated);
|
Section, Type, Flags, K, EntrySize, Group, UniqueID, R, LinkedToSym);
|
||||||
|
|
||||||
auto *F = new MCDataFragment();
|
auto *F = new MCDataFragment();
|
||||||
Ret->getFragmentList().insert(Ret->begin(), F);
|
Ret->getFragmentList().insert(Ret->begin(), F);
|
||||||
@ -386,20 +386,20 @@ MCSectionELF *MCContext::getELFNamedSection(const Twine &Prefix,
|
|||||||
MCSectionELF *MCContext::getELFSection(const Twine &Section, unsigned Type,
|
MCSectionELF *MCContext::getELFSection(const Twine &Section, unsigned Type,
|
||||||
unsigned Flags, unsigned EntrySize,
|
unsigned Flags, unsigned EntrySize,
|
||||||
const Twine &Group, unsigned UniqueID,
|
const Twine &Group, unsigned UniqueID,
|
||||||
const MCSymbolELF *Associated) {
|
const MCSymbolELF *LinkedToSym) {
|
||||||
MCSymbolELF *GroupSym = nullptr;
|
MCSymbolELF *GroupSym = nullptr;
|
||||||
if (!Group.isTriviallyEmpty() && !Group.str().empty())
|
if (!Group.isTriviallyEmpty() && !Group.str().empty())
|
||||||
GroupSym = cast<MCSymbolELF>(getOrCreateSymbol(Group));
|
GroupSym = cast<MCSymbolELF>(getOrCreateSymbol(Group));
|
||||||
|
|
||||||
return getELFSection(Section, Type, Flags, EntrySize, GroupSym, UniqueID,
|
return getELFSection(Section, Type, Flags, EntrySize, GroupSym, UniqueID,
|
||||||
Associated);
|
LinkedToSym);
|
||||||
}
|
}
|
||||||
|
|
||||||
MCSectionELF *MCContext::getELFSection(const Twine &Section, unsigned Type,
|
MCSectionELF *MCContext::getELFSection(const Twine &Section, unsigned Type,
|
||||||
unsigned Flags, unsigned EntrySize,
|
unsigned Flags, unsigned EntrySize,
|
||||||
const MCSymbolELF *GroupSym,
|
const MCSymbolELF *GroupSym,
|
||||||
unsigned UniqueID,
|
unsigned UniqueID,
|
||||||
const MCSymbolELF *Associated) {
|
const MCSymbolELF *LinkedToSym) {
|
||||||
StringRef Group = "";
|
StringRef Group = "";
|
||||||
if (GroupSym)
|
if (GroupSym)
|
||||||
Group = GroupSym->getName();
|
Group = GroupSym->getName();
|
||||||
@ -420,8 +420,9 @@ MCSectionELF *MCContext::getELFSection(const Twine &Section, unsigned Type,
|
|||||||
else
|
else
|
||||||
Kind = SectionKind::getReadOnly();
|
Kind = SectionKind::getReadOnly();
|
||||||
|
|
||||||
MCSectionELF *Result = createELFSectionImpl(
|
MCSectionELF *Result =
|
||||||
CachedName, Type, Flags, Kind, EntrySize, GroupSym, UniqueID, Associated);
|
createELFSectionImpl(CachedName, Type, Flags, Kind, EntrySize, GroupSym,
|
||||||
|
UniqueID, LinkedToSym);
|
||||||
Entry.second = Result;
|
Entry.second = Result;
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
@ -158,7 +158,7 @@ private:
|
|||||||
bool maybeParseSectionType(StringRef &TypeName);
|
bool maybeParseSectionType(StringRef &TypeName);
|
||||||
bool parseMergeSize(int64_t &Size);
|
bool parseMergeSize(int64_t &Size);
|
||||||
bool parseGroup(StringRef &GroupName);
|
bool parseGroup(StringRef &GroupName);
|
||||||
bool parseMetadataSym(MCSymbolELF *&Associated);
|
bool parseLinkedToSym(MCSymbolELF *&LinkedToSym);
|
||||||
bool maybeParseUniqueID(int64_t &UniqueID);
|
bool maybeParseUniqueID(int64_t &UniqueID);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -443,17 +443,18 @@ bool ELFAsmParser::parseGroup(StringRef &GroupName) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ELFAsmParser::parseMetadataSym(MCSymbolELF *&Associated) {
|
bool ELFAsmParser::parseLinkedToSym(MCSymbolELF *&LinkedToSym) {
|
||||||
MCAsmLexer &L = getLexer();
|
MCAsmLexer &L = getLexer();
|
||||||
if (L.isNot(AsmToken::Comma))
|
if (L.isNot(AsmToken::Comma))
|
||||||
return TokError("expected metadata symbol");
|
return TokError("expected linked-to symbol");
|
||||||
Lex();
|
Lex();
|
||||||
StringRef Name;
|
StringRef Name;
|
||||||
|
SMLoc StartLoc = L.getLoc();
|
||||||
if (getParser().parseIdentifier(Name))
|
if (getParser().parseIdentifier(Name))
|
||||||
return TokError("invalid metadata symbol");
|
return TokError("invalid linked-to symbol");
|
||||||
Associated = dyn_cast_or_null<MCSymbolELF>(getContext().lookupSymbol(Name));
|
LinkedToSym = dyn_cast_or_null<MCSymbolELF>(getContext().lookupSymbol(Name));
|
||||||
if (!Associated || !Associated->isInSection())
|
if (!LinkedToSym || !LinkedToSym->isInSection())
|
||||||
return TokError("symbol is not in a section: " + Name);
|
return Error(StartLoc, "linked-to symbol is not in a section: " + Name);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -495,7 +496,7 @@ bool ELFAsmParser::ParseSectionArguments(bool IsPush, SMLoc loc) {
|
|||||||
unsigned Flags = 0;
|
unsigned Flags = 0;
|
||||||
const MCExpr *Subsection = nullptr;
|
const MCExpr *Subsection = nullptr;
|
||||||
bool UseLastGroup = false;
|
bool UseLastGroup = false;
|
||||||
MCSymbolELF *Associated = nullptr;
|
MCSymbolELF *LinkedToSym = nullptr;
|
||||||
int64_t UniqueID = ~0;
|
int64_t UniqueID = ~0;
|
||||||
|
|
||||||
// Set the defaults first.
|
// Set the defaults first.
|
||||||
@ -568,7 +569,7 @@ bool ELFAsmParser::ParseSectionArguments(bool IsPush, SMLoc loc) {
|
|||||||
if (parseGroup(GroupName))
|
if (parseGroup(GroupName))
|
||||||
return true;
|
return true;
|
||||||
if (Flags & ELF::SHF_LINK_ORDER)
|
if (Flags & ELF::SHF_LINK_ORDER)
|
||||||
if (parseMetadataSym(Associated))
|
if (parseLinkedToSym(LinkedToSym))
|
||||||
return true;
|
return true;
|
||||||
if (maybeParseUniqueID(UniqueID))
|
if (maybeParseUniqueID(UniqueID))
|
||||||
return true;
|
return true;
|
||||||
@ -633,9 +634,8 @@ EndStmt:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MCSection *ELFSection =
|
MCSection *ELFSection = getContext().getELFSection(
|
||||||
getContext().getELFSection(SectionName, Type, Flags, Size, GroupName,
|
SectionName, Type, Flags, Size, GroupName, UniqueID, LinkedToSym);
|
||||||
UniqueID, Associated);
|
|
||||||
getStreamer().SwitchSection(ELFSection, Subsection);
|
getStreamer().SwitchSection(ELFSection, Subsection);
|
||||||
|
|
||||||
if (getContext().getGenDwarfForAssembly()) {
|
if (getContext().getGenDwarfForAssembly()) {
|
||||||
|
@ -172,9 +172,9 @@ void MCSectionELF::PrintSwitchToSection(const MCAsmInfo &MAI, const Triple &T,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (Flags & ELF::SHF_LINK_ORDER) {
|
if (Flags & ELF::SHF_LINK_ORDER) {
|
||||||
assert(AssociatedSymbol);
|
assert(LinkedToSym);
|
||||||
OS << ",";
|
OS << ",";
|
||||||
printName(OS, AssociatedSymbol->getName());
|
printName(OS, LinkedToSym->getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isUnique())
|
if (isUnique())
|
||||||
|
@ -1,10 +0,0 @@
|
|||||||
// RUN: not llvm-mc -triple x86_64-pc-linux-gnu %s \
|
|
||||||
// RUN: -filetype=obj -o %t.o 2>&1 | FileCheck %s
|
|
||||||
|
|
||||||
// Check we do not silently ignore invalid metadata symbol (123).
|
|
||||||
// CHECK: error: invalid metadata symbol
|
|
||||||
|
|
||||||
.section .foo,"a"
|
|
||||||
.quad 0
|
|
||||||
|
|
||||||
.section bar,"ao",@progbits,123
|
|
18
test/MC/ELF/section-linkorder-error.s
Normal file
18
test/MC/ELF/section-linkorder-error.s
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
# RUN: not llvm-mc -triple x86_64 %s -o /dev/null 2>&1 | FileCheck %s
|
||||||
|
|
||||||
|
# CHECK: {{.*}}.s:[[# @LINE+1]]:30: error: expected linked-to symbol
|
||||||
|
.section .link,"ao",@progbits
|
||||||
|
|
||||||
|
# CHECK: {{.*}}.s:[[# @LINE+1]]:31: error: invalid linked-to symbol
|
||||||
|
.section .link,"ao",@progbits,123
|
||||||
|
|
||||||
|
# CHECK: {{.*}}.s:[[# @LINE+1]]:31: error: linked-to symbol is not in a section: foo
|
||||||
|
.section .link,"ao",@progbits,foo
|
||||||
|
|
||||||
|
# CHECK: {{.*}}.s:[[# @LINE+2]]:31: error: linked-to symbol is not in a section: bar
|
||||||
|
bar = 42
|
||||||
|
.section .link,"ao",@progbits,bar
|
||||||
|
|
||||||
|
# CHECK: {{.*}}.s:[[# @LINE+2]]:31: error: linked-to symbol is not in a section: baz
|
||||||
|
.quad baz
|
||||||
|
.section .link,"ao",@progbits,baz
|
@ -1,5 +0,0 @@
|
|||||||
// RUN: not llvm-mc -triple x86_64-pc-linux-gnu %s -o - 2>&1 | FileCheck %s
|
|
||||||
|
|
||||||
// CHECK: error: symbol is not in a section: foo
|
|
||||||
|
|
||||||
.section .shf_metadata,"ao",@progbits,foo
|
|
@ -1,6 +0,0 @@
|
|||||||
// RUN: not llvm-mc -triple x86_64-pc-linux-gnu %s -o - 2>&1 | FileCheck %s
|
|
||||||
|
|
||||||
// CHECK: error: symbol is not in a section: foo
|
|
||||||
|
|
||||||
.quad foo
|
|
||||||
.section .shf_metadata,"ao",@progbits,foo
|
|
@ -1,6 +0,0 @@
|
|||||||
// RUN: not llvm-mc -triple x86_64-pc-linux-gnu %s -o - 2>&1 | FileCheck %s
|
|
||||||
|
|
||||||
// CHECK: error: symbol is not in a section: foo
|
|
||||||
|
|
||||||
foo = 42
|
|
||||||
.section .shf_metadata,"ao",@progbits,foo
|
|
@ -1,5 +0,0 @@
|
|||||||
// RUN: not llvm-mc -triple x86_64-pc-linux-gnu %s -o - 2>&1 | FileCheck %s
|
|
||||||
|
|
||||||
// CHECK: error: expected metadata symbol
|
|
||||||
|
|
||||||
.section .shf_metadata,"ao",@progbits
|
|
Loading…
Reference in New Issue
Block a user