summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lld/ELF/LTO.cpp5
-rw-r--r--lld/test/ELF/lto/section-name.ll11
2 files changed, 14 insertions, 2 deletions
diff --git a/lld/ELF/LTO.cpp b/lld/ELF/LTO.cpp
index f21a304087f..66f2a2a124e 100644
--- a/lld/ELF/LTO.cpp
+++ b/lld/ELF/LTO.cpp
@@ -136,8 +136,9 @@ void BitcodeCompiler::add(BitcodeFile &F) {
// be removed.
R.Prevailing = !ObjSym.isUndefined() && B->File == &F;
- R.VisibleToRegularObj =
- Sym->IsUsedInRegularObj || (R.Prevailing && Sym->includeInDynsym());
+ R.VisibleToRegularObj = Sym->IsUsedInRegularObj ||
+ (R.Prevailing && Sym->includeInDynsym()) ||
+ isValidCIdentifier(ObjSym.getSectionName());
if (R.Prevailing)
undefine(Sym);
R.LinkerRedefined = Config->RenamedSymbols.count(Sym);
diff --git a/lld/test/ELF/lto/section-name.ll b/lld/test/ELF/lto/section-name.ll
new file mode 100644
index 00000000000..1e62769764e
--- /dev/null
+++ b/lld/test/ELF/lto/section-name.ll
@@ -0,0 +1,11 @@
+; REQUIRES: x86
+; RUN: llvm-as %s -o %t.o
+; RUN: ld.lld %t.o -o %t.so -shared
+; RUN: llvm-readelf -s %t.so | FileCheck %s
+
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+@foo = hidden global i32 42, section "foo_section"
+
+; CHECK: foo_section PROGBITS
OpenPOWER on IntegriCloud