[PATCH] D43051: Symbols defined in linker scripts should not have dso_local flag set in LTO resolutions

Dmitry Mikulin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 7 20:27:47 PST 2018


This revision was not accepted when it landed; it landed in state "Needs Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rLLD324559: Symbols defined in linker scripts should not have dso_local flag set in LTO… (authored by dmikulin, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D43051?vs=133350&id=133364#toc

Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D43051

Files:
  ELF/LTO.cpp
  test/ELF/lto/abs-resol.ll


Index: test/ELF/lto/abs-resol.ll
===================================================================
--- test/ELF/lto/abs-resol.ll
+++ test/ELF/lto/abs-resol.ll
@@ -2,7 +2,10 @@
 
 ; RUN: llvm-as %s -o %t.o
 ; RUN: llvm-mc -triple=x86_64-pc-linux %p/Inputs/absolute.s -o %t2.o -filetype=obj
-; RUN: ld.lld %t.o %t2.o -o %t.out -pie
+; RUN: ld.lld %t.o %t2.o -o %t3.out -pie
+
+; RUN: echo "blah = 0xdeadfeef;" > %t.script
+; RUN: ld.lld %t.o -T%t.script -o %t4.out -pie
 
 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-unknown-linux-gnu"
Index: ELF/LTO.cpp
===================================================================
--- ELF/LTO.cpp
+++ ELF/LTO.cpp
@@ -160,8 +160,9 @@
         // Skip absolute symbols from ELF objects, otherwise PC-rel relocations
         // will be generated by for them, triggering linker errors.
         // Symbol section is always null for bitcode symbols, hence the check
-        // for isElf().
-        !(Sym->File && Sym->File->isElf() && DR->Section == nullptr);
+        // for isElf(). Skip linker script defined symbols as well: they have
+        // no File defined.
+        !(DR->Section == nullptr && (!Sym->File || Sym->File->isElf()));
 
     if (R.Prevailing)
       undefine(Sym);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43051.133364.patch
Type: text/x-patch
Size: 1270 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180208/83b2e019/attachment.bin>


More information about the llvm-commits mailing list