mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-12-04 12:15:46 +00:00
ee9a251caf
DF_1_PIE originated from Solaris (https://docs.oracle.com/cd/E36784_01/html/E36857/chapter6-42444.html ). GNU ld since https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=5fe2850dd96483f176858fd75c098313d5b20bc2 sets the flag on non-Solaris platforms. It can help distinguish PIE from ET_DYN. eu-classify from elfutils uses this to recognize PIE (https://sourceware.org/git/?p=elfutils.git;a=commit;h=3f489b5c7c78df6d52f8982f79c36e9a220e8951 ) glibc uses this flag to reject dlopen'ing a PIE (https://sourceware.org/bugzilla/show_bug.cgi?id=24323 ) Reviewed By: psmith Differential Revision: https://reviews.llvm.org/D80872
62 lines
1.8 KiB
ArmAsm
62 lines
1.8 KiB
ArmAsm
# REQUIRES: x86
|
|
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t1.o
|
|
|
|
## Default is no PIE.
|
|
# RUN: ld.lld %t1.o -o %t
|
|
# RUN: llvm-readobj --file-headers --sections -l --symbols -r %t \
|
|
# RUN: | FileCheck %s --check-prefix=NOPIE
|
|
|
|
## Check -pie.
|
|
# RUN: ld.lld -pie %t1.o -o %t
|
|
# RUN: llvm-readobj --file-headers --sections -l -d --symbols -r %t | FileCheck %s
|
|
|
|
## Test --pic-executable alias
|
|
# RUN: ld.lld --pic-executable %t1.o -o %t
|
|
# RUN: llvm-readobj --file-headers --sections -l -d --symbols -r %t | FileCheck %s
|
|
|
|
# CHECK: ElfHeader {
|
|
# CHECK-NEXT: Ident {
|
|
# CHECK-NEXT: Magic: (7F 45 4C 46)
|
|
# CHECK-NEXT: Class: 64-bit
|
|
# CHECK-NEXT: DataEncoding: LittleEndian
|
|
# CHECK-NEXT: FileVersion: 1
|
|
# CHECK-NEXT: OS/ABI: SystemV
|
|
# CHECK-NEXT: ABIVersion: 0
|
|
# CHECK-NEXT: Unused: (00 00 00 00 00 00 00)
|
|
# CHECK-NEXT: }
|
|
# CHECK-NEXT: Type: SharedObject
|
|
|
|
# CHECK: ProgramHeaders [
|
|
# CHECK-NEXT: ProgramHeader {
|
|
# CHECK-NEXT: Type: PT_PHDR
|
|
# CHECK-NEXT: Offset: 0x40
|
|
# CHECK-NEXT: VirtualAddress: 0x40
|
|
# CHECK-NEXT: PhysicalAddress: 0x40
|
|
# CHECK-NEXT: FileSize:
|
|
# CHECK-NEXT: MemSize:
|
|
# CHECK-NEXT: Flags [
|
|
# CHECK-NEXT: PF_R
|
|
# CHECK-NEXT: ]
|
|
# CHECK-NEXT: Alignment: 8
|
|
# CHECK-NEXT: }
|
|
# CHECK-NEXT: ProgramHeader {
|
|
# CHECK-NEXT: Type: PT_LOAD
|
|
# CHECK-NEXT: Offset: 0x0
|
|
# CHECK-NEXT: VirtualAddress: 0x0
|
|
# CHECK-NEXT: PhysicalAddress: 0x0
|
|
|
|
# CHECK: Type: PT_DYNAMIC
|
|
|
|
# CHECK: DynamicSection [
|
|
# CHECK: 0x000000006FFFFFFB FLAGS_1 PIE
|
|
|
|
## Check -nopie
|
|
# RUN: ld.lld -no-pie %t1.o -o %t2
|
|
# RUN: llvm-readobj --file-headers -r %t2 | FileCheck %s --check-prefix=NOPIE
|
|
# RUN: ld.lld -no-pic-executable %t1.o -o %t2
|
|
# RUN: llvm-readobj --file-headers -r %t2 | FileCheck %s --check-prefix=NOPIE
|
|
# NOPIE-NOT: Type: SharedObject
|
|
|
|
.globl _start
|
|
_start:
|