From: Rafael Espindola Date: Mon, 19 Sep 2016 19:59:21 +0000 (+0000) Subject: Map .data.rel.ro correctly. X-Git-Tag: llvmorg-4.0.0-rc1~9372 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7d38273636e590904ccc292c7034831bb9d26d8b;p=platform%2Fupstream%2Fllvm.git 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 --- diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp index f17f106..f8b6323 100644 --- a/lld/ELF/Writer.cpp +++ b/lld/ELF/Writer.cpp @@ -90,11 +90,14 @@ private: template StringRef elf::getOutputSectionName(InputSectionBase *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; } diff --git a/lld/test/ELF/section-name.s b/lld/test/ELF/section-name.s index 93cab7e..8274dc6 100644 --- a/lld/test/ELF/section-name.s +++ b/lld/test/ELF/section-name.s @@ -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