Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ELF] Fix the semantic of PROVIDE in linker scripts.
PROVIDE request us to define a symbol only if it is referenced and is not defined by any object included in the link. We created the symbol in the symbol table no matter what. Differential Revision: https://reviews.llvm.org/D22739 llvm-svn: 276592
- Loading branch information
Showing
3 changed files
with
29 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# REQUIRES: x86 | ||
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t | ||
|
||
# Provide new symbol. The value should be 1, like set in PROVIDE() | ||
# RUN: echo "SECTIONS { PROVIDE(newsym = 1);}" > %t.script | ||
# RUN: ld.lld -o %t1 --script %t.script %t | ||
# RUN: llvm-objdump -t %t1 | FileCheck --check-prefix=PROVIDE1 %s | ||
# PROVIDE1: 0000000000000001 *ABS* 00000000 newsym | ||
|
||
# Provide new symbol (hidden). The value should be 1 | ||
# RUN: echo "SECTIONS { PROVIDE_HIDDEN(newsym = 1);}" > %t.script | ||
# RUN: ld.lld -o %t1 --script %t.script %t | ||
# RUN: llvm-objdump -t %t1 | FileCheck --check-prefix=HIDDEN1 %s | ||
# HIDDEN1: 0000000000000001 *ABS* 00000000 .hidden newsym | ||
|
||
.global _start | ||
_start: | ||
nop | ||
|
||
.globl patatino | ||
patatino: | ||
movl newsym, %eax |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters