1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157
|
# REQUIRES: x86
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
# RUN: ld.lld %t -o %t1
# RUN: llvm-readobj --program-headers %t1 | FileCheck --check-prefix=ROSEGMENT %s
# RUN: ld.lld --no-rosegment --rosegment %t -o - | cmp - %t1
# RUN: ld.lld --omagic --no-omagic %t -o - | cmp - %t1
# ROSEGMENT: ProgramHeader {
# ROSEGMENT: Type: PT_LOAD
# ROSEGMENT-NEXT: Offset: 0x0
# ROSEGMENT-NEXT: VirtualAddress:
# ROSEGMENT-NEXT: PhysicalAddress:
# ROSEGMENT-NEXT: FileSize:
# ROSEGMENT-NEXT: MemSize:
# ROSEGMENT-NEXT: Flags [
# ROSEGMENT-NEXT: PF_R
# ROSEGMENT-NEXT: ]
# ROSEGMENT-NEXT: Alignment: 4096
# ROSEGMENT-NEXT: }
# ROSEGMENT-NEXT: ProgramHeader {
# ROSEGMENT-NEXT: Type: PT_LOAD
# ROSEGMENT-NEXT: Offset: 0x15C
# ROSEGMENT-NEXT: VirtualAddress:
# ROSEGMENT-NEXT: PhysicalAddress:
# ROSEGMENT-NEXT: FileSize:
# ROSEGMENT-NEXT: MemSize:
# ROSEGMENT-NEXT: Flags [
# ROSEGMENT-NEXT: PF_R
# ROSEGMENT-NEXT: PF_X
# ROSEGMENT-NEXT: ]
# ROSEGMENT-NEXT: Alignment: 4096
# ROSEGMENT-NEXT: }
# ROSEGMENT-NEXT: ProgramHeader {
# ROSEGMENT-NEXT: Type: PT_LOAD
# ROSEGMENT-NEXT: Offset: 0x15E
# ROSEGMENT-NEXT: VirtualAddress:
# ROSEGMENT-NEXT: PhysicalAddress:
# ROSEGMENT-NEXT: FileSize: 1
# ROSEGMENT-NEXT: MemSize: 1
# ROSEGMENT-NEXT: Flags [
# ROSEGMENT-NEXT: PF_R
# ROSEGMENT-NEXT: PF_W
# ROSEGMENT-NEXT: ]
# ROSEGMENT-NEXT: Alignment: 4096
# ROSEGMENT-NEXT: }
# RUN: ld.lld --no-rosegment %t -o %t2
# RUN: llvm-readobj --program-headers %t2 | FileCheck --check-prefix=NOROSEGMENT %s
# NOROSEGMENT: ProgramHeader {
# NOROSEGMENT: Type: PT_LOAD
# NOROSEGMENT-NEXT: Offset: 0x0
# NOROSEGMENT-NEXT: VirtualAddress:
# NOROSEGMENT-NEXT: PhysicalAddress:
# NOROSEGMENT-NEXT: FileSize:
# NOROSEGMENT-NEXT: MemSize:
# NOROSEGMENT-NEXT: Flags [
# NOROSEGMENT-NEXT: PF_R
# NOROSEGMENT-NEXT: PF_X
# NOROSEGMENT-NEXT: ]
# NOROSEGMENT-NEXT: Alignment: 4096
# NOROSEGMENT-NEXT: }
# NOROSEGMENT-NEXT: ProgramHeader {
# NOROSEGMENT-NEXT: Type: PT_LOAD
# NOROSEGMENT-NEXT: Offset: 0x126
# NOROSEGMENT-NEXT: VirtualAddress:
# NOROSEGMENT-NEXT: PhysicalAddress:
# NOROSEGMENT-NEXT: FileSize:
# NOROSEGMENT-NEXT: MemSize:
# NOROSEGMENT-NEXT: Flags [
# NOROSEGMENT-NEXT: PF_R
# NOROSEGMENT-NEXT: PF_W
# NOROSEGMENT-NEXT: ]
# NOROSEGMENT-NEXT: Alignment: 4096
# NOROSEGMENT-NEXT: }
# NOROSEGMENT-NEXT: ProgramHeader {
# NOROSEGMENT-NEXT: Type: PT_GNU_STACK
# RUN: ld.lld -N %t -o %t3
# RUN: llvm-readobj --program-headers %t3 | FileCheck --check-prefix=OMAGIC %s
# RUN: ld.lld --omagic %t -o %t3
# RUN: llvm-readobj --program-headers %t3 | FileCheck --check-prefix=OMAGIC %s
# OMAGIC: ProgramHeader {
# OMAGIC: Type: PT_LOAD
# OMAGIC-NEXT: Offset: 0xB0
# OMAGIC-NEXT: VirtualAddress:
# OMAGIC-NEXT: PhysicalAddress:
# OMAGIC-NEXT: FileSize:
# OMAGIC-NEXT: MemSize:
# OMAGIC-NEXT: Flags [
# OMAGIC-NEXT: PF_R
# OMAGIC-NEXT: PF_W
# OMAGIC-NEXT: PF_X
# OMAGIC-NEXT: ]
# OMAGIC-NEXT: Alignment: 4
# OMAGIC-NEXT: }
# OMAGIC-NEXT: ProgramHeader {
# OMAGIC-NEXT: Type: PT_GNU_STACK
# RUN: ld.lld -n %t -o %t4
# RUN: llvm-readobj --program-headers %t4 | FileCheck --check-prefix=NMAGIC %s
# RUN: ld.lld --nmagic %t -o %t4
# RUN: llvm-readobj --program-headers %t4 | FileCheck --check-prefix=NMAGIC %s
# NMAGIC: ProgramHeader {
# NMAGIC-NEXT: Type: PT_LOAD
# NMAGIC-NEXT: Offset: 0x120
# NMAGIC-NEXT: VirtualAddress:
# NMAGIC-NEXT: PhysicalAddress:
# NMAGIC-NEXT: FileSize: 1
# NMAGIC-NEXT: MemSize: 1
# NMAGIC-NEXT: Flags [
# NMAGIC-NEXT: PF_R
# NMAGIC-NEXT: ]
# NMAGIC-NEXT: Alignment: 1
# NMAGIC-NEXT: }
# NMAGIC-NEXT: ProgramHeader {
# NMAGIC-NEXT: Type: PT_LOAD
# NMAGIC-NEXT: Offset: 0x124
# NMAGIC-NEXT: VirtualAddress:
# NMAGIC-NEXT: PhysicalAddress:
# NMAGIC-NEXT: FileSize: 2
# NMAGIC-NEXT: MemSize: 2
# NMAGIC-NEXT: Flags [
# NMAGIC-NEXT: PF_R
# NMAGIC-NEXT: PF_X
# NMAGIC-NEXT: ]
# NMAGIC-NEXT: Alignment: 4
# NMAGIC-NEXT: }
# NMAGIC-NEXT: ProgramHeader {
# NMAGIC-NEXT: Type: PT_LOAD (0x1)
# NMAGIC-NEXT: Offset: 0x126
# NMAGIC-NEXT: VirtualAddress:
# NMAGIC-NEXT: PhysicalAddress:
# NMAGIC-NEXT: FileSize: 1
# NMAGIC-NEXT: MemSize: 1
# NMAGIC-NEXT: Flags [
# NMAGIC-NEXT: PF_R
# NMAGIC-NEXT: PF_W
# NMAGIC-NEXT: ]
# NMAGIC-NEXT: Alignment: 1
# NMAGIC-NEXT: }
.global _start
_start:
nop
.section .ro,"a"
nop
.section .rw,"aw"
nop
.section .rx,"ax"
nop
|