1// REQUIRES: x86
2// Should set the value of the "_end" symbol to the end of the data segment.
3
4// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
5
6// By default, the .bss section is the latest section of the data segment.
7// RUN: ld.lld %t.o -o %t
8// RUN: llvm-readobj --sections --symbols %t | FileCheck %s --check-prefix=DEFAULT
9
10// DEFAULT: Sections [
11// DEFAULT:     Name: .bss
12// DEFAULT-NEXT:     Type:
13// DEFAULT-NEXT:     Flags [
14// DEFAULT-NEXT:       SHF_ALLOC
15// DEFAULT-NEXT:       SHF_WRITE
16// DEFAULT-NEXT:     ]
17// DEFAULT-NEXT:     Address: 0x20215B
18// DEFAULT-NEXT:     Offset:
19// DEFAULT-NEXT:     Size: 6
20// DEFAULT: ]
21// DEFAULT: Symbols [
22// DEFAULT:     Name: _end
23// DEFAULT-NEXT:     Value: 0x202161
24// DEFAULT: ]
25
26// RUN: ld.lld -r %t.o -o %t
27// RUN: llvm-readelf -s %t | FileCheck %s --check-prefix=RELOCATABLE
28// RELOCATABLE: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND _end
29
30.global _start,_end
31.text
32_start:
33    nop
34.data
35    .word 1
36.bss
37    .space 6
38