Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ELF] - Do not use HeaderSize for conditions in PltSection.
Previously we checked (HeaderSize == 0) to find out if PltSection section is IPLT or PLT. Some targets does not set HeaderSize though. For example PPC64 has no lazy binding implemented and does not set PltHeaderSize constant. Because of that using of both IPLT and PLT relocations worked incorrectly there (testcase is provided). Patch fixes the issue. Differential revision: https://reviews.llvm.org/D41613 llvm-svn: 322362
- Loading branch information
George Rimar
committed
Jan 12, 2018
1 parent
5627c21
commit 9fc2c64
Showing
4 changed files
with
52 additions
and
11 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
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,41 @@ | ||
# REQUIRES: ppc | ||
# RUN: llvm-mc -filetype=obj -triple=powerpc64-unknown-linux %s -o %t.o | ||
# RUN: llvm-mc -filetype=obj -triple=powerpc64-unknown-linux %p/Inputs/shared-ppc64.s -o %t2.o | ||
# RUN: ld.lld -shared %t2.o -o %t2.so | ||
# RUN: ld.lld %t.o %t2.so -o %t | ||
# RUN: llvm-objdump -d %t | FileCheck %s | ||
|
||
# CHECK: _start: | ||
# CHECK-NEXT: 10010004: {{.*}} bl .+12 | ||
# CHECK-NEXT: 10010008: {{.*}} bl .+40 | ||
|
||
# 0x10010004 + 12 = 0x10010010 (PLT entry 0) | ||
# 0x10010008 + 40 = 0x10010030 (PLT entry 1) | ||
|
||
# CHECK: Disassembly of section .plt: | ||
# CHECK: 10010010: {{.*}} std 2, 40(1) | ||
# CHECK-NEXT: 10010014: {{.*}} addis 11, 2, 4098 | ||
# CHECK-NEXT: 10010018: {{.*}} ld 12, -32744(11) | ||
# CHECK-NEXT: 1001001c: {{.*}} ld 11, 0(12) | ||
# CHECK-NEXT: 10010020: {{.*}} mtctr 11 | ||
# CHECK-NEXT: 10010024: {{.*}} ld 2, 8(12) | ||
# CHECK-NEXT: 10010028: {{.*}} ld 11, 16(12) | ||
# CHECK-NEXT: 1001002c: {{.*}} bctr | ||
# CHECK-NEXT: 10010030: {{.*}} std 2, 40(1) | ||
# CHECK-NEXT: 10010034: {{.*}} addis 11, 2, 4098 | ||
# CHECK-NEXT: 10010038: {{.*}} ld 12, -32736(11) | ||
# CHECK-NEXT: 1001003c: {{.*}} ld 11, 0(12) | ||
# CHECK-NEXT: 10010040: {{.*}} mtctr 11 | ||
# CHECK-NEXT: 10010044: {{.*}} ld 2, 8(12) | ||
# CHECK-NEXT: 10010048: {{.*}} ld 11, 16(12) | ||
# CHECK-NEXT: 1001004c: {{.*}} bctr | ||
|
||
.type ifunc STT_GNU_IFUNC | ||
.globl ifunc | ||
ifunc: | ||
nop | ||
|
||
.global _start | ||
_start: | ||
bl bar | ||
bl ifunc |