mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-14 11:32:34 +00:00
c39f5dd0e2
Fixes PR19582. Previously, when an asm assignment (.set or =) was created, we would look up the section immediately in MCSymbol::setVariableValue. This caused symbols to receive the wrong section if the RHS of the assignment had not been seen yet. This had a knock-on effect in the object file emitters, causing them to emit extra symbols, or to give symbols the wrong visibility or the wrong section. For example, in the following asm: .data .Llocal: .text leaq .Llocal1(%rip), %rdi .Llocal1 = .Llocal2 .Llocal2 = .Llocal the first assignment would give .Llocal1 a null section, which would never get fixed up by the second assignment. This would cause the ELF object file emitter to consider .Llocal1 to be an undefined symbol and give it external linkage, even though .Llocal1 should not have been emitted at all in the object file. Or in the following asm: alias_to_local = Ltmp0 Ltmp0: the Mach-O object file emitter would give the alias_to_local symbol a n_type of N_SECT and a n_sect of 0. This is invalid under the Mach-O specification, which requires N_SECT symbols to receive a non-zero section number if the symbol is defined in a section in the object file. https://developer.apple.com/library/mac/documentation/DeveloperTools/Conceptual/MachORuntime/#//apple_ref/c/tag/nlist After this change we do not look up the section when the assignment is created, but instead look it up on demand and store it in Section, which is treated as a cache if the symbol is a variable symbol. This change also fixes a bug in MCExpr::FindAssociatedSection. Previously, if we saw a subtraction, we would return the first referenced section, even in cases where we should have been returning the absolute pseudo-section. Now we always return the absolute pseudo-section for expressions that subtract two section-derived expressions. This isn't always correct (e.g. if one of the sections ends up being laid out at an absolute address), but it's probably the best we can do without more context. This allows us to remove code in two places where we appear to have been working around this bug, in MachObjectWriter::markAbsoluteVariableSymbols and in X86AsmPrinter::EmitStartOfAsmFile. Re-applies r233595 (aka D8586), which was reverted in r233898. Differential Revision: http://reviews.llvm.org/D8798 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233995 91177308-0d34-0410-b5e6-96231b3b80d8 |
||
---|---|---|
.. | ||
AArch64 | ||
ARM | ||
absolute.s | ||
absolutize.s | ||
bad-darwin-x86_64-32-bit-abs-addr.s | ||
bad-darwin-x86_64-diff-relocs.s | ||
bad-darwin-x86_64-reloc-expr1.s | ||
bad-darwin-x86_64-reloc-expr2.s | ||
bad-darwin-x86_64-reloc-expr.s | ||
bad-dollar.s | ||
bad-indirect-symbols.s | ||
bad-macro.s | ||
bss.s | ||
comm-1.s | ||
cstexpr-gotpcrel-32.ll | ||
cstexpr-gotpcrel-64.ll | ||
darwin-complex-difference.s | ||
darwin-x86_64-diff-reloc-assign-2.s | ||
darwin-x86_64-diff-reloc-assign.s | ||
darwin-x86_64-diff-relocs.s | ||
darwin-x86_64-nobase-relocs.s | ||
darwin-x86_64-reloc-offsets.s | ||
darwin-x86_64-reloc.s | ||
data.s | ||
debug_frame.s | ||
diff-with-two-sections.s | ||
direction_labels.s | ||
eh_symbol.s | ||
eh-frame-reloc.s | ||
file.s | ||
gen-dwarf-cpp.s | ||
gen-dwarf-macro-cpp.s | ||
gen-dwarf-producer.s | ||
gen-dwarf.s | ||
i386-large-relocations.s | ||
indirect-symbols.s | ||
jcc.s | ||
lcomm-attributes.s | ||
linker-option-1.s | ||
linker-option-2.s | ||
linker-options.ll | ||
lit.local.cfg | ||
loc.s | ||
osx-version-min-load-command.s | ||
pcrel-to-other-section.s | ||
pr19185.s | ||
previous.s | ||
pushsection.s | ||
relax-jumps.s | ||
relax-recompute-align.s | ||
reloc-diff.s | ||
reloc-pcrel-offset.s | ||
reloc-pcrel.s | ||
reloc.s | ||
section-align-1.s | ||
section-align-2.s | ||
section-attributes.s | ||
section-flags.s | ||
string-table.s | ||
symbol-diff.s | ||
symbol-flags.s | ||
symbol-indirect.s | ||
symbols-1.s | ||
tbss.s | ||
tdata.s | ||
temp-labels.s | ||
thread_init_func.s | ||
tls.s | ||
tlv-bss.ll | ||
tlv-reloc.s | ||
tlv.s | ||
values.s | ||
variable-errors.s | ||
variable-exprs.s | ||
weakdef.s | ||
x86_32-optimal_nop.s | ||
x86_32-scattered-reloc-fallback.s | ||
x86_32-sections.s | ||
x86_32-symbols.s | ||
x86_64-mergeable.s | ||
x86_64-reloc-arithmetic.s | ||
x86_64-sections.s | ||
x86_64-symbols.s | ||
x86-data-in-code.ll | ||
zerofill-1.s | ||
zerofill-2.s | ||
zerofill-3.s | ||
zerofill-4.s | ||
zerofill-5.s | ||
zerofill-sect-align.s |