mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-25 13:24:46 +00:00
Correctly handle references to section symbols.
When processing assembly like .long .text we were creating a new undefined symbol .text. GAS on the other hand would handle that as a reference to the .text section. This patch implements that by creating the section symbols earlier so that they are visible during asm parsing. The patch also updates llvm-readobj to print the symbol number in the relocation dump so that the test can differentiate between two sections with the same name. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219829 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -113,6 +113,23 @@ MCSymbol *MCContext::GetOrCreateSymbol(StringRef Name) {
|
||||
return Sym;
|
||||
}
|
||||
|
||||
MCSymbol *MCContext::getOrCreateSectionSymbol(const MCSectionELF &Section) {
|
||||
MCSymbol *&Sym = SectionSymbols[&Section];
|
||||
if (Sym)
|
||||
return Sym;
|
||||
|
||||
StringRef Name = Section.getSectionName();
|
||||
StringMapEntry<bool> *NameEntry = &UsedNames.GetOrCreateValue(Name);
|
||||
NameEntry->setValue(true);
|
||||
Sym = new (*this) MCSymbol(NameEntry->getKey(), /*isTemporary*/ false);
|
||||
|
||||
StringMapEntry<MCSymbol*> &Entry = Symbols.GetOrCreateValue(Name);
|
||||
if (!Entry.getValue())
|
||||
Entry.setValue(Sym);
|
||||
|
||||
return Sym;
|
||||
}
|
||||
|
||||
MCSymbol *MCContext::CreateSymbol(StringRef Name) {
|
||||
// Determine whether this is an assembler temporary or normal label, if used.
|
||||
bool isTemporary = false;
|
||||
|
Reference in New Issue
Block a user