2018-03-01 12:21:42 +08:00
|
|
|
# REQUIRES: x86
|
|
|
|
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/define.s -o %t.o
|
|
|
|
# RUN: ld.lld -o %t --script %s %t.o
|
2020-03-16 08:47:44 +08:00
|
|
|
# RUN: llvm-objdump --section-headers %t | FileCheck %s
|
2018-03-01 12:21:42 +08:00
|
|
|
|
2020-07-17 04:40:31 +08:00
|
|
|
EXTERN(extern_defined)
|
2018-03-01 12:21:42 +08:00
|
|
|
SECTIONS {
|
|
|
|
. = DEFINED(defined) ? 0x11000 : .;
|
|
|
|
.foo : { *(.foo*) }
|
|
|
|
. = DEFINED(notdefined) ? 0x12000 : 0x13000;
|
|
|
|
.bar : { *(.bar*) }
|
2020-07-17 04:40:31 +08:00
|
|
|
. = DEFINED(extern_defined) ? 0x14000 : 0x15000;
|
|
|
|
.test : { *(.test*) }
|
2018-03-01 12:21:42 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
# CHECK: 1 .foo 00000008 0000000000011000 DATA
|
|
|
|
# CHECK: 2 .bar 00000008 0000000000013000 DATA
|
2020-07-17 04:40:31 +08:00
|
|
|
# CHECK: 3 .test 00000008 0000000000015000 DATA
|
|
|
|
# CHECK: 4 .text 00000000 0000000000015008 TEXT
|