[PATCH] D24913: [ELF] - Fix for: Bug 30521 - lld exits non-zero return value linking a library with no entry symbol
George Rimar via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 26 06:52:58 PDT 2016
grimar created this revision.
grimar added reviewers: ruiu, rafael.
grimar added subscribers: llvm-commits, grimar, emaste, evgeny777.
PR30521 was about linking shared library. After r282295 may produce "entry symbol not found"
warning, what in combination with --fatal-errors lead to link fail.
Libraries does not have entry, so this patch disables logic that sets entry symbol for case when -shared is used.
https://reviews.llvm.org/D24913
Files:
ELF/Driver.cpp
test/ELF/entry.s
Index: test/ELF/entry.s
===================================================================
--- test/ELF/entry.s
+++ test/ELF/entry.s
@@ -3,7 +3,7 @@
# RUN: llvm-readobj -file-headers %t2 | FileCheck -check-prefix=NOENTRY %s
# 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: ld.lld %t1 --fatal-warnings -shared -o %t2 -e entry
# RUN: llvm-readobj -file-headers %t2 | FileCheck -check-prefix=DSO %s
# RUN: ld.lld %t1 -o %t2 --entry=4096
# RUN: llvm-readobj -file-headers %t2 | FileCheck -check-prefix=DEC %s
@@ -16,7 +16,7 @@
# NOENTRY: Entry: 0x0
# SYM: Entry: 0x11000
-# DSO: Entry: 0x1000
+# DSO: Entry: 0x0
# DEC: Entry: 0x1000
# HEX: Entry: 0xCAFE
# OCT: Entry: 0x1FF
Index: ELF/Driver.cpp
===================================================================
--- ELF/Driver.cpp
+++ ELF/Driver.cpp
@@ -675,7 +675,7 @@
// if it is resolvable.
Config->Entry = (Config->EMachine == EM_MIPS) ? "__start" : "_start";
}
- if (!HasEntryAddr) {
+ if (!Config->Shared && !HasEntryAddr) {
if (Symtab.find(Config->Entry))
Config->EntrySym = Symtab.addUndefined(Config->Entry);
else
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D24913.72475.patch
Type: text/x-patch
Size: 1224 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160926/65456a0b/attachment.bin>
More information about the llvm-commits
mailing list