1# REQUIRES: x86
2# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/synthetic-symbols.s -o %t
3# RUN: ld.lld -o %t.exe --eh-frame-hdr --script %s %t
4# RUN: llvm-objdump -t %t.exe | FileCheck %s
5
6# Simple symbol assignment within input section list. The '.' symbol
7# is not location counter but offset from the beginning of output
8# section .foo
9
10SECTIONS {
11  . = SIZEOF_HEADERS;
12  .foo : {
13    begin_foo = .;
14    PROVIDE(_begin_sec = .);
15    *(.foo)
16    end_foo = .;
17    PROVIDE_HIDDEN(_end_sec = .);
18    PROVIDE(_end_sec_abs = ABSOLUTE(.));
19    size_foo_1 = SIZEOF(.foo);
20    size_foo_1_abs = ABSOLUTE(SIZEOF(.foo));
21    . = ALIGN(0x1000);
22    begin_bar = .;
23    *(.bar)
24    end_bar = .;
25    size_foo_2 = SIZEOF(.foo);
26  }
27
28  size_foo_3 = SIZEOF(.foo);
29
30  .eh_frame_hdr : {
31     __eh_frame_hdr_start = .;
32     __eh_frame_hdr_start2 = ABSOLUTE(ALIGN(0x10));
33     *(.eh_frame_hdr)
34     __eh_frame_hdr_end = .;
35     __eh_frame_hdr_end2 = ABSOLUTE(ALIGN(0x10));
36  }
37
38  .eh_frame : {}
39}
40
41# CHECK:      0000000000000128         .foo    00000000 .hidden _end_sec
42# CHECK-NEXT: 0000000000000120         .foo    00000000 _begin_sec
43# CHECK-NEXT: 0000000000000128         *ABS*   00000000 _end_sec_abs
44# CHECK-NEXT: 000000000000104c         .text   00000000 _start
45# CHECK-NEXT: 0000000000000120         .foo    00000000 begin_foo
46# CHECK-NEXT: 0000000000000128         .foo    00000000 end_foo
47# CHECK-NEXT: 0000000000000008         *ABS*   00000000 size_foo_1
48# CHECK-NEXT: 0000000000000008         *ABS*   00000000 size_foo_1_abs
49# CHECK-NEXT: 0000000000001000         .foo    00000000 begin_bar
50# CHECK-NEXT: 0000000000001004         .foo    00000000 end_bar
51# CHECK-NEXT: 0000000000000ee4         *ABS*   00000000 size_foo_2
52# CHECK-NEXT: 0000000000000ee4         *ABS*   00000000 size_foo_3
53# CHECK-NEXT: 0000000000001004         .eh_frame_hdr     00000000 __eh_frame_hdr_start
54# CHECK-NEXT: 0000000000001010         *ABS*             00000000 __eh_frame_hdr_start2
55# CHECK-NEXT: 0000000000001018         .eh_frame_hdr     00000000 __eh_frame_hdr_end
56# CHECK-NEXT: 0000000000001020         *ABS*             00000000 __eh_frame_hdr_end2
57