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.

llvm-svn: 281931
This commit is contained in:
Rafael Espindola 2016-09-19 19:59:21 +00:00
parent 3d90318aff
commit 7d38273636
2 changed files with 10 additions and 7 deletions

View File

@ -90,11 +90,14 @@ private:
template <class ELFT> template <class ELFT>
StringRef elf::getOutputSectionName(InputSectionBase<ELFT> *S) { StringRef elf::getOutputSectionName(InputSectionBase<ELFT> *S) {
StringRef Name = S->Name; StringRef Name = S->Name;
for (StringRef V : {".text.", ".rodata.", ".data.rel.ro.", ".data.", ".bss.", for (StringRef V :
".init_array.", ".fini_array.", ".ctors.", ".dtors.", {".text.", ".rodata.", ".data.rel.ro.", ".data.", ".bss.",
".tbss.", ".gcc_except_table.", ".tdata.", ".ARM.exidx."}) ".init_array.", ".fini_array.", ".ctors.", ".dtors.", ".tbss.",
if (Name.startswith(V)) ".gcc_except_table.", ".tdata.", ".ARM.exidx."}) {
return V.drop_back(); StringRef Prefix = V.drop_back();
if (Name.startswith(V) || Name == Prefix)
return Prefix;
}
return Name; return Name;
} }

View File

@ -47,8 +47,8 @@ _start:
// CHECK: 3 .text 00000002 // CHECK: 3 .text 00000002
// CHECK: 4 .tdata 00000001 // CHECK: 4 .tdata 00000001
// CHECK: 5 .tbss 00000001 // CHECK: 5 .tbss 00000001
// CHECK: 6 .data.rel.ro 00000003 // CHECK: 6 .data.rel.ro 00000004
// CHECK: 7 .data 00000003 // CHECK: 7 .data 00000002
// CHECK: 8 .foo.a 00000001 // CHECK: 8 .foo.a 00000001
// CHECK: 9 .foo 00000001 // CHECK: 9 .foo 00000001
// CHECK: 10 .bss 00000001 // CHECK: 10 .bss 00000001