[PATCH] D22300: [ELF] Allow overriding reserved symbols in linker script
Eugene Leviant via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 13 13:09:57 PDT 2016
evgeny777 updated this revision to Diff 63849.
evgeny777 added a comment.
Created separate test case. Review updated
Repository:
rL LLVM
http://reviews.llvm.org/D22300
Files:
ELF/LinkerScript.cpp
test/ELF/linkerscript-symbol-conflict.s
Index: test/ELF/linkerscript-symbol-conflict.s
===================================================================
--- test/ELF/linkerscript-symbol-conflict.s
+++ test/ELF/linkerscript-symbol-conflict.s
@@ -0,0 +1,11 @@
+# REQUIRES: x86
+# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
+
+# RUN: echo "SECTIONS {.text : {*(.text.*)} end = .;}" > %t.script
+# RUN: ld.lld -o %t1 --script %t.script %t
+# RUN: llvm-objdump -t %t1 | FileCheck %s
+# CHECK: 0000000000000121 *ABS* 00000000 end
+
+.global _start
+_start:
+ nop
Index: ELF/LinkerScript.cpp
===================================================================
--- ELF/LinkerScript.cpp
+++ ELF/LinkerScript.cpp
@@ -309,10 +309,10 @@
return I < J ? -1 : 1;
}
-template <class ELFT>
-void LinkerScript<ELFT>::addScriptedSymbols() {
+template <class ELFT> void LinkerScript<ELFT>::addScriptedSymbols() {
for (SectionsCommand &Cmd : Opt.Commands)
- if (Cmd.Kind == SymbolAssignmentKind)
+ if (Cmd.Kind == SymbolAssignmentKind &&
+ Symtab<ELFT>::X->find(Cmd.Name) == nullptr)
Symtab<ELFT>::X->addAbsolute(Cmd.Name, STV_DEFAULT);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D22300.63849.patch
Type: text/x-patch
Size: 1145 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160713/277c2a3c/attachment.bin>
More information about the llvm-commits
mailing list