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>
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;
}

View File

@ -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