[PATCH] D15454: lld: allow -e with -shared
Ed Maste via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 11 09:50:03 PST 2015
This revision was automatically updated to reflect the committed changes.
Closed by commit rL255349: ELF: Allow -e <entry> with -shared (authored by emaste).
Changed prior to commit:
http://reviews.llvm.org/D15454?vs=42528&id=42536#toc
Repository:
rL LLVM
http://reviews.llvm.org/D15454
Files:
lld/trunk/ELF/Driver.cpp
lld/trunk/test/ELF/entry.s
Index: lld/trunk/ELF/Driver.cpp
===================================================================
--- lld/trunk/ELF/Driver.cpp
+++ lld/trunk/ELF/Driver.cpp
@@ -248,11 +248,6 @@
if (Config->Entry.empty())
Config->Entry = (Config->EMachine == EM_MIPS) ? "__start" : "_start";
- // Set either EntryAddr (if S is a number) or EntrySym (otherwise).
- StringRef S = Config->Entry;
- if (S.getAsInteger(0, Config->EntryAddr))
- Config->EntrySym = Symtab.addUndefined(S);
-
// In the assembly for 32 bit x86 the _GLOBAL_OFFSET_TABLE_ symbol
// is magical and is used to produce a R_386_GOTPC relocation.
// The R_386_GOTPC relocation value doesn't actually depend on the
@@ -268,6 +263,13 @@
Symtab.addIgnoredSym("_GLOBAL_OFFSET_TABLE_");
}
+ if (!Config->Entry.empty()) {
+ // Set either EntryAddr (if S is a number) or EntrySym (otherwise).
+ StringRef S = Config->Entry;
+ if (S.getAsInteger(0, Config->EntryAddr))
+ Config->EntrySym = Symtab.addUndefined(S);
+ }
+
// Define _gp for MIPS. st_value of _gp symbol will be updated by Writer
// so that it points to an absolute address which is relative to GOT.
// See "Global Data Symbols" in Chapter 6 in the following document:
Index: lld/trunk/test/ELF/entry.s
===================================================================
--- lld/trunk/test/ELF/entry.s
+++ lld/trunk/test/ELF/entry.s
@@ -2,14 +2,17 @@
# RUN: not ld.lld %t1 -o %t2
# RUN: ld.lld %t1 -o %t2 -e entry
# RUN: llvm-readobj -file-headers %t2 | FileCheck -check-prefix=SYM %s
+# RUN: ld.lld %t1 -shared -o %t2 -e entry
+# RUN: llvm-readobj -file-headers %t2 | FileCheck -check-prefix=DSO %s
# RUN: ld.lld %t1 -o %t2 -e 4096
# RUN: llvm-readobj -file-headers %t2 | FileCheck -check-prefix=DEC %s
# RUN: ld.lld %t1 -o %t2 -e 0xcafe
# RUN: llvm-readobj -file-headers %t2 | FileCheck -check-prefix=HEX %s
# RUN: ld.lld %t1 -o %t2 -e 0777
# RUN: llvm-readobj -file-headers %t2 | FileCheck -check-prefix=OCT %s
# SYM: Entry: 0x11000
+# DSO: Entry: 0x1000
# DEC: Entry: 0x1000
# HEX: Entry: 0xCAFE
# OCT: Entry: 0x1FF
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D15454.42536.patch
Type: text/x-patch
Size: 2119 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151211/565dfef5/attachment.bin>
More information about the llvm-commits
mailing list