1// REQUIRES: x86 2// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o %t 3// RUN: llvm-readobj --symbols %t | FileCheck %s 4 5// Verify that the symbol _start is in a section with an index >= SHN_LORESERVE. 6// CHECK: Name: _start 7// CHECK-NEXT: Value: 0x0 8// CHECK-NEXT: Size: 0 9// CHECK-NEXT: Binding: Global 10// CHECK-NEXT: Type: None 11// CHECK-NEXT: Other: 0 12// CHECK-NEXT: Section: dm (0xFF00) 13 14// RUN: ld.lld %t -o %t2 15// RUN: llvm-readobj --symbols %t2 | FileCheck --check-prefix=LINKED %s 16 17// Test also with a linker script. 18// RUN: echo "SECTIONS { . = SIZEOF_HEADERS; .text : { *(.text) } }" > %t.script 19// RUN: ld.lld -T %t.script %t -o %t2 20// RUN: llvm-readobj --symbols %t2 | FileCheck --check-prefix=LINKED %s 21 22// Test that _start is in the correct section. 23// LINKED: Name: _start 24// LINKED-NEXT: Value: 0x0 25// LINKED-NEXT: Size: 0 26// LINKED-NEXT: Binding: Global 27// LINKED-NEXT: Type: None 28// LINKED-NEXT: Other: 0 29// LINKED-NEXT: Section: dm 30 31.macro gen_sections4 x 32 .section a\x 33 .section b\x 34 .section c\x 35 .section d\x 36.endm 37 38.macro gen_sections8 x 39 gen_sections4 a\x 40 gen_sections4 b\x 41.endm 42 43.macro gen_sections16 x 44 gen_sections8 a\x 45 gen_sections8 b\x 46.endm 47 48.macro gen_sections32 x 49 gen_sections16 a\x 50 gen_sections16 b\x 51.endm 52 53.macro gen_sections64 x 54 gen_sections32 a\x 55 gen_sections32 b\x 56.endm 57 58.macro gen_sections128 x 59 gen_sections64 a\x 60 gen_sections64 b\x 61.endm 62 63.macro gen_sections256 x 64 gen_sections128 a\x 65 gen_sections128 b\x 66.endm 67 68.macro gen_sections512 x 69 gen_sections256 a\x 70 gen_sections256 b\x 71.endm 72 73.macro gen_sections1024 x 74 gen_sections512 a\x 75 gen_sections512 b\x 76.endm 77 78.macro gen_sections2048 x 79 gen_sections1024 a\x 80 gen_sections1024 b\x 81.endm 82 83.macro gen_sections4096 x 84 gen_sections2048 a\x 85 gen_sections2048 b\x 86.endm 87 88.macro gen_sections8192 x 89 gen_sections4096 a\x 90 gen_sections4096 b\x 91.endm 92 93.macro gen_sections16384 x 94 gen_sections8192 a\x 95 gen_sections8192 b\x 96.endm 97 98.macro gen_sections32768 x 99 gen_sections16384 a\x 100 gen_sections16384 b\x 101.endm 102 103 .bss 104 .section bar 105 106gen_sections32768 a 107gen_sections16384 b 108gen_sections8192 c 109gen_sections4096 d 110gen_sections2048 e 111gen_sections1024 f 112gen_sections512 g 113gen_sections128 h 114gen_sections64 i 115gen_sections32 j 116gen_sections16 k 117gen_sections8 l 118gen_sections4 m 119 120.global _start 121_start: 122