[lld] r281931 - Map .data.rel.ro correctly.
Rafael Espindola via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 19 12:59:21 PDT 2016
Author: rafael
Date: Mon Sep 19 14:59:21 2016
New Revision: 281931
URL: http://llvm.org/viewvc/llvm-project?rev=281931&view=rev
Log:
Map .data.rel.ro correctly.
An input section named .data.rel.ro now maps to an output section
named .data.rel.ro. Before we were mapping it to .data.
Modified:
lld/trunk/ELF/Writer.cpp
lld/trunk/test/ELF/section-name.s
Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=281931&r1=281930&r2=281931&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Mon Sep 19 14:59:21 2016
@@ -90,11 +90,14 @@ private:
template <class ELFT>
StringRef elf::getOutputSectionName(InputSectionBase<ELFT> *S) {
StringRef Name = S->Name;
- for (StringRef V : {".text.", ".rodata.", ".data.rel.ro.", ".data.", ".bss.",
- ".init_array.", ".fini_array.", ".ctors.", ".dtors.",
- ".tbss.", ".gcc_except_table.", ".tdata.", ".ARM.exidx."})
- if (Name.startswith(V))
- return V.drop_back();
+ for (StringRef V :
+ {".text.", ".rodata.", ".data.rel.ro.", ".data.", ".bss.",
+ ".init_array.", ".fini_array.", ".ctors.", ".dtors.", ".tbss.",
+ ".gcc_except_table.", ".tdata.", ".ARM.exidx."}) {
+ StringRef Prefix = V.drop_back();
+ if (Name.startswith(V) || Name == Prefix)
+ return Prefix;
+ }
return Name;
}
Modified: lld/trunk/test/ELF/section-name.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/section-name.s?rev=281931&r1=281930&r2=281931&view=diff
==============================================================================
--- lld/trunk/test/ELF/section-name.s (original)
+++ lld/trunk/test/ELF/section-name.s Mon Sep 19 14:59:21 2016
@@ -47,8 +47,8 @@ _start:
// CHECK: 3 .text 00000002
// CHECK: 4 .tdata 00000001
// CHECK: 5 .tbss 00000001
-// CHECK: 6 .data.rel.ro 00000003
-// CHECK: 7 .data 00000003
+// CHECK: 6 .data.rel.ro 00000004
+// CHECK: 7 .data 00000002
// CHECK: 8 .foo.a 00000001
// CHECK: 9 .foo 00000001
// CHECK: 10 .bss 00000001
More information about the llvm-commits
mailing list