llvm/lib
Tobias Edler von Koch 7f80f1bbf5 LTO: Pass SF_Executable flag through to InputFile::Symbol
Summary:
The linker needs to be able to determine whether a symbol is text or data to
handle the case of a common being overridden by a strong definition in an
archive. If the archive contains a text member of the same name as the common,
that function is discarded. However, if the archive contains a data member of
the same name, that strong definition overrides the common. This is a behavior
of ld.bfd, which the Qualcomm linker also supports in LTO.

Here's a test case to illustrate:

####

cat > 1.c << \!
int blah;
!

cat > 2.c << \!
int blah() {
  return 0;
}
!

cat > 3.c << \!
int blah = 20;
!

clang -c 1.c
clang -c 2.c
clang -c 3.c

ar cr lib.a 2.o 3.o
ld 1.o lib.a -t

####

The correct output is:

1.o
(lib.a)3.o

Thanks to Shankar Easwaran and Hemant Kulkarni for the test case!

Reviewers: mehdi_amini, rafael, pcc, davide

Reviewed By: pcc

Subscribers: davide, llvm-commits, inglorion

Differential Revision: https://reviews.llvm.org/D31901

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300205 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-13 16:24:14 +00:00
..
Analysis [InstSimplify] Don't try to constant fold AllocaInsts since it won't do anything. 2017-04-12 22:54:24 +00:00
AsmParser [IR] Take func, ret, and arg attrs separately in AttributeList::get 2017-04-13 00:58:09 +00:00
Bitcode Bitcode: Move version and global value module code parsers to separate functions. NFCI. 2017-04-12 20:02:09 +00:00
CodeGen Use methods to access data stored with frame instructions 2017-04-13 14:10:52 +00:00
DebugInfo [DWARF] - Simplify (use dyn_cast instead of isa + cast). 2017-04-13 09:52:50 +00:00
Demangle
ExecutionEngine [ORC] Add RPC and serialization support for Errors and Expecteds. 2017-04-13 03:51:35 +00:00
Fuzzer [libFuzzer] XFAIL fuzzer-oom.test on Darwin. 2017-04-12 23:15:10 +00:00
IR [IR] Take func, ret, and arg attrs separately in AttributeList::get 2017-04-13 00:58:09 +00:00
IRReader
LibDriver Fix some ArgList uses after API change in r300135. 2017-04-12 23:43:58 +00:00
LineEditor
Linker
LTO Support: Add a VCSRevision.h header file. 2017-04-13 01:26:12 +00:00
MC
Object LTO: Pass SF_Executable flag through to InputFile::Symbol 2017-04-13 16:24:14 +00:00
ObjectYAML
Option ArgList: cache index ranges containing arguments with each ID 2017-04-12 23:19:51 +00:00
Passes MemorySSA: Move to Analysis, from Transforms/Utils. It's used as 2017-04-11 20:06:36 +00:00
ProfileData
Support [APInt] Reorder fields to avoid a hole in the middle of the class 2017-04-13 04:59:11 +00:00
TableGen
Target [Hexagon] Implement HexagonTargetLowering::CanLowerReturn 2017-04-13 15:05:51 +00:00
Transforms [InstCombine] fix assert to not always be true 2017-04-13 16:05:01 +00:00
XRay
CMakeLists.txt
LLVMBuild.txt