2018-05-04 23:09:49 +08:00
|
|
|
// REQUIRES: ppc
|
|
|
|
|
|
|
|
// RUN: llvm-mc -filetype=obj -triple=powerpc64le-unknown-linux %s -o %t.o
|
|
|
|
// RUN: llvm-mc -filetype=obj -triple=powerpc64le-unknown-linux %p/Inputs/shared.s -o %t2.o
|
|
|
|
// RUN: ld.lld -shared %t2.o -o %t2.so
|
|
|
|
// RUN: ld.lld -dynamic-linker /lib64/ld64.so.1 -rpath foo -rpath bar --export-dynamic %t.o %t2.so -o %t
|
2019-05-01 13:49:01 +08:00
|
|
|
// RUN: llvm-readobj --dynamic-table -S %t | FileCheck %s
|
2018-05-04 23:09:49 +08:00
|
|
|
|
2015-10-03 00:21:30 +08:00
|
|
|
// 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.s -o %t2.o
|
2015-11-18 14:11:01 +08:00
|
|
|
// RUN: ld.lld -shared %t2.o -o %t2.so
|
|
|
|
// RUN: ld.lld -dynamic-linker /lib64/ld64.so.1 -rpath foo -rpath bar --export-dynamic %t.o %t2.so -o %t
|
2019-05-01 13:49:01 +08:00
|
|
|
// RUN: llvm-readobj --dynamic-table -S %t | FileCheck %s
|
2015-10-03 00:21:30 +08:00
|
|
|
|
|
|
|
// CHECK: Name: .rela.dyn
|
|
|
|
// CHECK-NEXT: Type: SHT_REL
|
|
|
|
// CHECK-NEXT: Flags [
|
|
|
|
// CHECK-NEXT: SHF_ALLOC
|
|
|
|
// CHECK-NEXT: ]
|
|
|
|
// CHECK-NEXT: Address: [[RELADDR:.*]]
|
|
|
|
// CHECK-NEXT: Offset:
|
|
|
|
// CHECK-NEXT: Size: [[RELSIZE:.*]]
|
|
|
|
// CHECK-NEXT: Link:
|
|
|
|
// CHECK-NEXT: Info:
|
|
|
|
// CHECK-NEXT: AddressAlignment:
|
|
|
|
// CHECK-NEXT: EntrySize: [[RELENT:.*]]
|
|
|
|
|
|
|
|
// CHECK: DynamicSection [
|
|
|
|
// CHECK-NEXT: Tag Type Name/Value
|
2019-06-20 03:31:07 +08:00
|
|
|
// CHECK-NEXT: 0x000000000000001D RUNPATH Library runpath: [foo:bar]
|
2017-07-15 00:00:34 +08:00
|
|
|
// CHECK-NEXT: 0x0000000000000001 NEEDED Shared library: [{{.*}}2.so]
|
2016-11-02 10:18:01 +08:00
|
|
|
// CHECK-NEXT: 0x0000000000000015 DEBUG 0x0
|
2015-10-03 00:21:30 +08:00
|
|
|
// CHECK-NEXT: 0x0000000000000007 RELA [[RELADDR]]
|
|
|
|
// CHECK-NEXT: 0x0000000000000008 RELASZ [[RELSIZE]] (bytes)
|
|
|
|
// CHECK-NEXT: 0x0000000000000009 RELAENT [[RELENT]] (bytes)
|
2016-11-02 10:18:01 +08:00
|
|
|
// CHECK: 0x0000000000000000 NULL 0x0
|
2015-10-03 00:21:30 +08:00
|
|
|
// CHECK-NEXT: ]
|
|
|
|
|
|
|
|
.global _start
|
|
|
|
_start:
|
2016-04-30 08:49:10 +08:00
|
|
|
.data
|
[ELF][ARM][AARCH64][MIPS][PPC] Simplify the logic to create R_*_RELATIVE for absolute relocation types in writable sections
Summary:
Our rule to create R_*_RELATIVE for absolute relocation types were
loose. D63121 made it stricter but it failed to create R_*_RELATIVE for
R_ARM_TARGET1 and R_PPC64_TOC. rLLD363236 worked around that by
reinstating the original behavior for ARM and PPC64.
This patch is an attempt to simplify the logic.
Note, in ld.bfd, R_ARM_TARGET2 --target2=abs also creates
R_ARM_RELATIVE. This seems a very uncommon scenario (moreover,
--target2=got-rel is the default), so I do not implement any logic
related to it.
Also, delete R_AARCH64_ABS32 from AArch64::getDynRel. We don't have
working ILP32 support yet. Allowing it would create an incorrect
R_AARCH64_RELATIVE.
For MIPS, the (if SymbolRel, then RelativeRel) code is to keep its
behavior unchanged.
Note, in ppc64-abs64-dyn.s, R_PPC64_TOC gets an incorrect addend because
computeAddend() doesn't compute the correct address. We seem to have the
wrong behavior for a long time. The important thing seems that a dynamic
relocation R_PPC64_TOC should not be created as the dynamic loader will
error R_PPC64_TOC is not supported.
Reviewers: atanasyan, grimar, peter.smith, ruiu, sfertile, espindola
Reviewed By: ruiu
Differential Revision: https://reviews.llvm.org/D63383
llvm-svn: 363928
2019-06-20 22:00:08 +08:00
|
|
|
.quad bar
|
|
|
|
.quad zed
|
2015-10-03 00:21:30 +08:00
|
|
|
|