1# REQUIRES: x86
2# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
3# RUN: echo "aliasto__text = __text; SECTIONS { .text 0x1000 : { __text = . ; *(.text) } }" > %t.script
4# RUN: ld.lld -pie -o %t --script %t.script %t.o
5# RUN: llvm-readobj --symbols %t | FileCheck %s
6
7## Check that alias 'aliasto__text' has the correct value.
8## (It should belong to the section .text and point to it's start).
9
10# CHECK:      Symbol {
11# CHECK:        Name: __text
12# CHECK-NEXT:   Value: 0x1000
13# CHECK-NEXT:   Size: 0
14# CHECK-NEXT:   Binding: Global
15# CHECK-NEXT:   Type: None
16# CHECK-NEXT:   Other: 0
17# CHECK-NEXT:   Section: .text
18# CHECK-NEXT: }
19
20# CHECK:      Symbol {
21# CHECK:        Name: aliasto__text
22# CHECK-NEXT:   Value: 0x1000
23# CHECK-NEXT:   Size: 0
24# CHECK-NEXT:   Binding: Global
25# CHECK-NEXT:   Type: None
26# CHECK-NEXT:   Other: 0
27# CHECK-NEXT:   Section: .text
28# CHECK-NEXT: }
29
30.text
31.globl _start
32.type _start, %function
33_start:
34.globl aliasto__text
35   call __text
36   call aliasto__text
37