[llvm] r339066 - MC: Redirect .addrsig directives referring to private (.L) symbols to the section symbol.
Peter Collingbourne via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 6 14:59:59 PDT 2018
Author: pcc
Date: Mon Aug 6 14:59:58 2018
New Revision: 339066
URL: http://llvm.org/viewvc/llvm-project?rev=339066&view=rev
Log:
MC: Redirect .addrsig directives referring to private (.L) symbols to the section symbol.
This matches our behaviour for regular (i.e. relocated) references to
private symbols and therefore avoids needing to unnecessarily write
address-significant .L symbols to the object file's symbol table,
which can interfere with stack traces.
Fixes check-cfi after r339050.
Modified:
llvm/trunk/lib/MC/ELFObjectWriter.cpp
llvm/trunk/test/MC/ELF/addrsig.s
Modified: llvm/trunk/lib/MC/ELFObjectWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/ELFObjectWriter.cpp?rev=339066&r1=339065&r2=339066&view=diff
==============================================================================
--- llvm/trunk/lib/MC/ELFObjectWriter.cpp (original)
+++ llvm/trunk/lib/MC/ELFObjectWriter.cpp Mon Aug 6 14:59:58 2018
@@ -1273,6 +1273,8 @@ void ELFObjectWriter::executePostLayoutB
for (const MCSymbol *&Sym : AddrsigSyms) {
if (const MCSymbol *R = Renames.lookup(cast<MCSymbolELF>(Sym)))
Sym = R;
+ if (Sym->isInSection() && Sym->getName().startswith(".L"))
+ Sym = Sym->getSection().getBeginSymbol();
Sym->setUsedInReloc();
}
}
Modified: llvm/trunk/test/MC/ELF/addrsig.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/addrsig.s?rev=339066&r1=339065&r2=339066&view=diff
==============================================================================
--- llvm/trunk/test/MC/ELF/addrsig.s (original)
+++ llvm/trunk/test/MC/ELF/addrsig.s Mon Aug 6 14:59:58 2018
@@ -16,29 +16,29 @@
// CHECK-NEXT: AddressAlignment: 1
// CHECK-NEXT: EntrySize: 0
// CHECK-NEXT: SectionData (
-// CHECK-NEXT: 0000: 03050201
+// CHECK-NEXT: 0000: 03050102
// CHECK-NEXT: )
// CHECK-NEXT: }
// CHECK-NEXT: Section {
// CHECK-NEXT: Index: 4
// CHECK-NEXT: Name: .symtab
-// CHECK: Name: .Llocal
+// CHECK: Name: local
// CHECK-NEXT: Value:
// CHECK-NEXT: Size:
// CHECK-NEXT: Binding:
// CHECK-NEXT: Type:
// CHECK-NEXT: Other:
-// CHECK-NEXT: Section:
+// CHECK-NEXT: Section: [[SEC:.*]]
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
-// CHECK-NEXT: Name: local
+// CHECK-NEXT: Name:
// CHECK-NEXT: Value:
// CHECK-NEXT: Size:
// CHECK-NEXT: Binding:
// CHECK-NEXT: Type:
// CHECK-NEXT: Other:
-// CHECK-NEXT: Section:
+// CHECK-NEXT: Section: [[SEC]]
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: g1
@@ -64,8 +64,8 @@
// CHECK: Addrsig [
// CHECK-NEXT: Sym: g1 (3)
// CHECK-NEXT: Sym: g3 (5)
-// CHECK-NEXT: Sym: local (2)
-// CHECK-NEXT: Sym: .Llocal (1)
+// CHECK-NEXT: Sym: local (1)
+// CHECK-NEXT: Sym: (2)
// CHECK-NEXT: ]
// ASM: .addrsig
More information about the llvm-commits
mailing list