summaryrefslogtreecommitdiffstats
path: root/lld/ELF/Writer.cpp
diff options
context:
space:
mode:
authorGeorge Rimar <grimar@accesssoftek.com>2017-06-05 12:49:21 +0000
committerGeorge Rimar <grimar@accesssoftek.com>2017-06-05 12:49:21 +0000
commit60a0ea161e81c7edcf77c68c3f7b998b448eddc8 (patch)
tree5e0d1b4e45ca54c19972c3fa1918be316617c928 /lld/ELF/Writer.cpp
parentfbe891ee05a5f6594025c800b468908911217500 (diff)
downloadbcm5719-llvm-60a0ea161e81c7edcf77c68c3f7b998b448eddc8.tar.gz
bcm5719-llvm-60a0ea161e81c7edcf77c68c3f7b998b448eddc8.zip
[ELF] - Make LLD remove gnu-lib compression prefix (".z") after decompression when using -r
This is PR33289. Previously LLD leaved section naming as is and that lead to wrong result, because we decompress sections when using -r, and hence should remove ".z" prefix. Differential revision: https://reviews.llvm.org/D33885 llvm-svn: 304711
Diffstat (limited to 'lld/ELF/Writer.cpp')
-rw-r--r--lld/ELF/Writer.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp
index 79ca67e7acd..4b36d884071 100644
--- a/lld/ELF/Writer.cpp
+++ b/lld/ELF/Writer.cpp
@@ -93,6 +93,11 @@ private:
} // anonymous namespace
StringRef elf::getOutputSectionName(StringRef Name) {
+ // ".zdebug_" is a prefix for ZLIB-compressed sections.
+ // Because we decompressed input sections, we want to remove 'z'.
+ if (Name.startswith(".zdebug_"))
+ return Saver.save("." + Name.substr(2));
+
if (Config->Relocatable)
return Name;
@@ -122,10 +127,6 @@ StringRef elf::getOutputSectionName(StringRef Name) {
if (Name == "COMMON")
return ".bss";
- // ".zdebug_" is a prefix for ZLIB-compressed sections.
- // Because we decompressed input sections, we want to remove 'z'.
- if (Name.startswith(".zdebug_"))
- return Saver.save("." + Name.substr(2));
return Name;
}
OpenPOWER on IntegriCloud