[ELF/Linkerscript] Define an absolute if we find an undefined.
Otherwhise undefined references to symbols defined in linker scripts are never resolved. Differential Revision: https://reviews.llvm.org/D22664 llvm-svn: 276536
This commit is contained in:
parent
9e99dd9e8b
commit
8ab4108df2
|
@ -532,7 +532,8 @@ template <class ELFT> void LinkerScript<ELFT>::addScriptedSymbols() {
|
|||
if (!Cmd || Cmd->Name == ".")
|
||||
continue;
|
||||
|
||||
if (Symtab<ELFT>::X->find(Cmd->Name) == nullptr)
|
||||
SymbolBody *B = Symtab<ELFT>::X->find(Cmd->Name);
|
||||
if (!B || B->isUndefined())
|
||||
Symtab<ELFT>::X->addAbsolute(Cmd->Name,
|
||||
Cmd->Hidden ? STV_HIDDEN : STV_DEFAULT);
|
||||
else
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
# REQUIRES: x86
|
||||
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
|
||||
|
||||
# RUN: echo "SECTIONS { patatino = 0x1234; }" > %t.script
|
||||
# RUN: ld.lld -o %t1 --script %t.script %t
|
||||
# RUN: llvm-objdump -t %t1 | FileCheck %s
|
||||
# CHECK: 0000000000001234 *ABS* 00000000 patatino
|
||||
|
||||
.global _start
|
||||
_start:
|
||||
call patatino
|
Loading…
Reference in New Issue