2018-06-27 06:20:04 +08:00
|
|
|
// REQUIRES: x86
|
2015-12-21 18:12:06 +08:00
|
|
|
// RUN: llvm-mc -filetype=obj -triple=i686-pc-linux %s -o %t.o
|
|
|
|
// RUN: ld.lld -static %t.o -o %tout
|
2019-08-07 17:43:54 +08:00
|
|
|
// RUN: llvm-objdump -d --no-show-raw-insn %tout | FileCheck %s --check-prefix=DISASM
|
2019-05-01 13:49:01 +08:00
|
|
|
// RUN: llvm-readobj -r --symbols --sections %tout | FileCheck %s
|
2015-12-21 18:12:06 +08:00
|
|
|
|
|
|
|
// CHECK: Sections [
|
|
|
|
// CHECK: Section {
|
|
|
|
// CHECK: Index: 1
|
2019-08-03 10:26:52 +08:00
|
|
|
// CHECK-NEXT: Name: .rel.dyn
|
2015-12-21 18:12:06 +08:00
|
|
|
// CHECK-NEXT: Type: SHT_REL
|
|
|
|
// CHECK-NEXT: Flags [
|
|
|
|
// CHECK-NEXT: SHF_ALLOC
|
|
|
|
// CHECK-NEXT: ]
|
|
|
|
// CHECK-NEXT: Address: [[RELA:.*]]
|
|
|
|
// CHECK-NEXT: Offset: 0xD4
|
|
|
|
// CHECK-NEXT: Size: 16
|
2018-11-02 06:28:58 +08:00
|
|
|
// CHECK-NEXT: Link: 0
|
2018-10-11 16:25:35 +08:00
|
|
|
// CHECK-NEXT: Info: 4
|
2015-12-21 18:12:06 +08:00
|
|
|
// CHECK-NEXT: AddressAlignment: 4
|
|
|
|
// CHECK-NEXT: EntrySize: 8
|
|
|
|
// CHECK-NEXT: }
|
|
|
|
// CHECK: Relocations [
|
2019-08-03 10:26:52 +08:00
|
|
|
// CHECK-NEXT: Section ({{.*}}) .rel.dyn {
|
2019-08-20 16:43:47 +08:00
|
|
|
// CHECK-NEXT: 0x402120 R_386_IRELATIVE
|
|
|
|
// CHECK-NEXT: 0x402124 R_386_IRELATIVE
|
2015-12-21 18:12:06 +08:00
|
|
|
// CHECK-NEXT: }
|
|
|
|
// CHECK-NEXT: ]
|
|
|
|
|
|
|
|
// CHECK: Symbols [
|
|
|
|
// CHECK-NEXT: Symbol {
|
|
|
|
// CHECK-NEXT: Name:
|
|
|
|
// CHECK-NEXT: Value: 0x0
|
|
|
|
// CHECK-NEXT: Size: 0
|
|
|
|
// CHECK-NEXT: Binding: Local
|
|
|
|
// CHECK-NEXT: Type: None
|
|
|
|
// CHECK-NEXT: Other: 0
|
|
|
|
// CHECK-NEXT: Section: Undefined
|
|
|
|
// CHECK-NEXT: }
|
|
|
|
// CHECK-NEXT: Symbol {
|
|
|
|
// CHECK-NEXT: Name: __rel_iplt_end
|
Align AArch64 and i386 image base to superpage
Summary:
As for x86_64, the default image base for AArch64 and i386 should be
aligned to a superpage appropriate for the architecture.
On AArch64, this is 2 MiB, on i386 it is 4 MiB.
Reviewers: emaste, grimar, javed.absar, espindola, ruiu, peter.smith, srhines, rprichard
Reviewed By: ruiu, peter.smith
Subscribers: jfb, markj, arichardson, krytarowski, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D50297
llvm-svn: 342746
2018-09-22 00:58:13 +08:00
|
|
|
// CHECK-NEXT: Value: 0x4000E4
|
2015-12-21 18:12:06 +08:00
|
|
|
// CHECK-NEXT: Size: 0
|
|
|
|
// CHECK-NEXT: Binding: Local
|
|
|
|
// CHECK-NEXT: Type: None
|
2016-04-04 22:04:16 +08:00
|
|
|
// CHECK-NEXT: Other [
|
|
|
|
// CHECK-NEXT: STV_HIDDEN
|
|
|
|
// CHECK-NEXT: ]
|
2019-08-03 10:26:52 +08:00
|
|
|
// CHECK-NEXT: Section: .rel.dyn
|
2015-12-21 18:12:06 +08:00
|
|
|
// CHECK-NEXT: }
|
|
|
|
// CHECK-NEXT: Symbol {
|
|
|
|
// CHECK-NEXT: Name: __rel_iplt_start
|
|
|
|
// CHECK-NEXT: Value: [[RELA]]
|
|
|
|
// CHECK-NEXT: Size: 0
|
|
|
|
// CHECK-NEXT: Binding: Local
|
|
|
|
// CHECK-NEXT: Type: None
|
2016-04-04 22:04:16 +08:00
|
|
|
// CHECK-NEXT: Other [
|
|
|
|
// CHECK-NEXT: STV_HIDDEN
|
|
|
|
// CHECK-NEXT: ]
|
2019-08-03 10:26:52 +08:00
|
|
|
// CHECK-NEXT: Section: .rel.dyn
|
2015-12-21 18:12:06 +08:00
|
|
|
// CHECK-NEXT: }
|
|
|
|
// CHECK-NEXT: Symbol {
|
|
|
|
// CHECK-NEXT: Name: _start
|
2019-08-20 16:43:47 +08:00
|
|
|
// CHECK-NEXT: Value: 0x4010E6
|
2015-12-21 18:12:06 +08:00
|
|
|
// CHECK-NEXT: Size: 0
|
|
|
|
// CHECK-NEXT: Binding: Global
|
|
|
|
// CHECK-NEXT: Type: None
|
|
|
|
// CHECK-NEXT: Other: 0
|
|
|
|
// CHECK-NEXT: Section: .text
|
|
|
|
// CHECK-NEXT: }
|
|
|
|
// CHECK-NEXT: Symbol {
|
|
|
|
// CHECK-NEXT: Name: bar
|
2019-08-20 16:43:47 +08:00
|
|
|
// CHECK-NEXT: Value: 0x401110
|
2019-02-14 05:49:55 +08:00
|
|
|
// CHECK-NEXT: Size: 0
|
|
|
|
// CHECK-NEXT: Binding: Global
|
|
|
|
// CHECK-NEXT: Type: Function
|
|
|
|
// CHECK-NEXT: Other: 0
|
|
|
|
// CHECK-NEXT: Section: .plt
|
|
|
|
// CHECK-NEXT: }
|
|
|
|
// CHECK-NEXT: Symbol {
|
|
|
|
// CHECK-NEXT: Name: bar_resolver
|
2019-08-20 16:43:47 +08:00
|
|
|
// CHECK-NEXT: Value: 0x4010E5
|
2015-12-21 18:12:06 +08:00
|
|
|
// CHECK-NEXT: Size: 0
|
|
|
|
// CHECK-NEXT: Binding: Global
|
2019-02-14 05:49:55 +08:00
|
|
|
// CHECK-NEXT: Type: Function
|
2015-12-21 18:12:06 +08:00
|
|
|
// CHECK-NEXT: Other: 0
|
|
|
|
// CHECK-NEXT: Section: .text
|
|
|
|
// CHECK-NEXT: }
|
|
|
|
// CHECK-NEXT: Symbol {
|
|
|
|
// CHECK-NEXT: Name: foo
|
2019-08-20 16:43:47 +08:00
|
|
|
// CHECK-NEXT: Value: 0x401100
|
2019-02-14 05:49:55 +08:00
|
|
|
// CHECK-NEXT: Size: 0
|
|
|
|
// CHECK-NEXT: Binding: Global
|
|
|
|
// CHECK-NEXT: Type: Function
|
|
|
|
// CHECK-NEXT: Other: 0
|
|
|
|
// CHECK-NEXT: Section: .plt
|
|
|
|
// CHECK-NEXT: }
|
|
|
|
// CHECK-NEXT: Symbol {
|
|
|
|
// CHECK-NEXT: Name: foo_resolver
|
2019-08-20 16:43:47 +08:00
|
|
|
// CHECK-NEXT: Value: 0x4010E4
|
2015-12-21 18:12:06 +08:00
|
|
|
// CHECK-NEXT: Size: 0
|
|
|
|
// CHECK-NEXT: Binding: Global
|
2019-02-14 05:49:55 +08:00
|
|
|
// CHECK-NEXT: Type: Function
|
2015-12-21 18:12:06 +08:00
|
|
|
// CHECK-NEXT: Other: 0
|
|
|
|
// CHECK-NEXT: Section: .text
|
|
|
|
// CHECK-NEXT: }
|
|
|
|
// CHECK-NEXT:]
|
|
|
|
|
2016-12-08 20:58:55 +08:00
|
|
|
// DISASM: Disassembly of section .text:
|
2019-05-01 18:40:48 +08:00
|
|
|
// DISASM-EMPTY:
|
2019-02-14 05:49:55 +08:00
|
|
|
// DISASM-NEXT: foo_resolver:
|
2019-08-20 16:43:47 +08:00
|
|
|
// DISASM-NEXT: 4010e4: retl
|
2019-02-14 05:49:55 +08:00
|
|
|
// DISASM: bar_resolver:
|
2019-08-20 16:43:47 +08:00
|
|
|
// DISASM-NEXT: 4010e5: retl
|
2015-12-21 18:12:06 +08:00
|
|
|
// DISASM: _start:
|
2019-08-20 16:43:47 +08:00
|
|
|
// DISASM-NEXT: 4010e6: calll 21 <foo>
|
|
|
|
// DISASM-NEXT: calll 32 <bar>
|
2019-08-07 17:43:54 +08:00
|
|
|
// DISASM-NEXT: movl $4194516, %edx
|
|
|
|
// DISASM-NEXT: movl $4194532, %edx
|
2019-05-01 18:40:48 +08:00
|
|
|
// DISASM-EMPTY:
|
2015-12-21 18:12:06 +08:00
|
|
|
// DISASM-NEXT: Disassembly of section .plt:
|
2019-05-01 18:40:48 +08:00
|
|
|
// DISASM-EMPTY:
|
2019-02-14 05:49:55 +08:00
|
|
|
// DISASM-NEXT: foo:
|
2019-08-20 16:43:47 +08:00
|
|
|
// DISASM-NEXT: 401100: jmpl *4202784
|
2019-08-07 17:43:54 +08:00
|
|
|
// DISASM-NEXT: pushl $16
|
2019-08-20 16:43:47 +08:00
|
|
|
// DISASM-NEXT: jmp -32 <_start+0xa>
|
2019-02-14 05:49:55 +08:00
|
|
|
// DISASM: bar:
|
2019-08-20 16:43:47 +08:00
|
|
|
// DISASM-NEXT: 401110: jmpl *4202788
|
2019-08-07 17:43:54 +08:00
|
|
|
// DISASM-NEXT: pushl $24
|
2019-08-20 16:43:47 +08:00
|
|
|
// DISASM-NEXT: jmp -48 <_start+0xa>
|
2015-12-21 18:12:06 +08:00
|
|
|
|
|
|
|
.text
|
|
|
|
.type foo STT_GNU_IFUNC
|
|
|
|
.globl foo
|
|
|
|
foo:
|
2019-02-14 05:49:55 +08:00
|
|
|
.type foo_resolver STT_FUNC
|
|
|
|
.globl foo_resolver
|
|
|
|
foo_resolver:
|
2015-12-21 18:12:06 +08:00
|
|
|
ret
|
|
|
|
|
|
|
|
.type bar STT_GNU_IFUNC
|
|
|
|
.globl bar
|
|
|
|
bar:
|
2019-02-14 05:49:55 +08:00
|
|
|
.type bar_resolver STT_FUNC
|
|
|
|
.globl bar_resolver
|
|
|
|
bar_resolver:
|
2015-12-21 18:12:06 +08:00
|
|
|
ret
|
|
|
|
|
|
|
|
.globl _start
|
|
|
|
_start:
|
|
|
|
call foo
|
|
|
|
call bar
|
|
|
|
movl $__rel_iplt_start,%edx
|
|
|
|
movl $__rel_iplt_end,%edx
|