[PATCH] D34195: [ELF] Mark symbols referenced from linker script as live
Petr Hosek via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 14 22:35:04 PDT 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rL305452: [ELF] Mark symbols referenced from linker script as live (authored by phosek).
Changed prior to commit:
https://reviews.llvm.org/D34195?vs=102639&id=102640#toc
Repository:
rL LLVM
https://reviews.llvm.org/D34195
Files:
lld/trunk/ELF/MarkLive.cpp
lld/trunk/test/ELF/linkerscript/data-commands-gc.s
Index: lld/trunk/test/ELF/linkerscript/data-commands-gc.s
===================================================================
--- lld/trunk/test/ELF/linkerscript/data-commands-gc.s
+++ lld/trunk/test/ELF/linkerscript/data-commands-gc.s
@@ -0,0 +1,16 @@
+# REQUIRES: x86
+# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
+# RUN: echo "SECTIONS { .text : { *(.text*) QUAD(bar) } }" > %t.script
+# RUN: ld.lld --gc-sections -o %t %t.o --script %t.script | FileCheck -allow-empty %s
+
+# CHECK-NOT: unable to evaluate expression: input section .rodata.bar has no output section assigned
+
+.section .rodata.bar
+.quad 0x1122334455667788
+.global bar
+bar:
+
+.section .text
+.global _start
+_start:
+ nop
Index: lld/trunk/ELF/MarkLive.cpp
===================================================================
--- lld/trunk/ELF/MarkLive.cpp
+++ lld/trunk/ELF/MarkLive.cpp
@@ -230,6 +230,8 @@
MarkSymbol(Symtab<ELFT>::X->find(Config->Fini));
for (StringRef S : Config->Undefined)
MarkSymbol(Symtab<ELFT>::X->find(S));
+ for (StringRef S : Script->Opt.ReferencedSymbols)
+ MarkSymbol(Symtab<ELFT>::X->find(S));
// Preserve externally-visible symbols if the symbols defined by this
// file can interrupt other ELF file's symbols at runtime.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D34195.102640.patch
Type: text/x-patch
Size: 1275 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170615/19972357/attachment.bin>
More information about the llvm-commits
mailing list