absolute-expr.test 2.04 KB
# REQUIRES: x86
# RUN: echo ".global foo; foo = 0x123" | llvm-mc -filetype=obj -triple=x86_64-pc-linux - -o %t.o
# RUN: ld.lld -o %t.so --script %s %t.o -shared
# RUN: llvm-readobj --symbols %t.so | FileCheck %s

SECTIONS {
  .text : {
    bar1 = ALIGNOF(.text);
    bar2 = CONSTANT (MAXPAGESIZE);
    bar3 = SIZEOF (.text);
    bar4 = SIZEOF_HEADERS;
    bar5 = 0x42;
    bar6 = foo + 1;
    *(.text)
  }
}

# CHECK:      Symbol {
# CHECK:        Name: foo
# CHECK-NEXT:   Value: 0x123
# CHECK-NEXT:   Size: 0
# CHECK-NEXT:   Binding: Global
# CHECK-NEXT:   Type: None
# CHECK-NEXT:   Other: 0
# CHECK-NEXT:   Section: Absolute (0xFFF1)
# CHECK-NEXT: }
# CHECK-NEXT: Symbol {
# CHECK-NEXT:   Name: bar1
# CHECK-NEXT:   Value: 0x4
# CHECK-NEXT:   Size: 0
# CHECK-NEXT:   Binding: Global
# CHECK-NEXT:   Type: None
# CHECK-NEXT:   Other: 0
# CHECK-NEXT:   Section: Absolute
# CHECK-NEXT: }
# CHECK-NEXT: Symbol {
# CHECK-NEXT:   Name: bar2
# CHECK-NEXT:   Value: 0x1000
# CHECK-NEXT:   Size: 0
# CHECK-NEXT:   Binding: Global
# CHECK-NEXT:   Type: None
# CHECK-NEXT:   Other: 0
# CHECK-NEXT:   Section: Absolute
# CHECK-NEXT: }
# CHECK-NEXT: Symbol {
# CHECK-NEXT:   Name: bar3
# CHECK-NEXT:   Value: 0x0
# CHECK-NEXT:   Size: 0
# CHECK-NEXT:   Binding: Global
# CHECK-NEXT:   Type: None
# CHECK-NEXT:   Other: 0
# CHECK-NEXT:   Section: Absolute
# CHECK-NEXT: }
# CHECK-NEXT: Symbol {
# CHECK-NEXT:   Name: bar4
# CHECK-NEXT:   Value: 0x190
# CHECK-NEXT:   Size: 0
# CHECK-NEXT:   Binding: Global
# CHECK-NEXT:   Type: None
# CHECK-NEXT:   Other: 0
# CHECK-NEXT:   Section: Absolute
# CHECK-NEXT: }
# CHECK-NEXT: Symbol {
# CHECK-NEXT:   Name: bar5
# CHECK-NEXT:   Value: 0x42
# CHECK-NEXT:   Size: 0
# CHECK-NEXT:   Binding: Global
# CHECK-NEXT:   Type: None
# CHECK-NEXT:   Other: 0
# CHECK-NEXT:   Section: Absolute
# CHECK-NEXT: }
# CHECK-NEXT: Symbol {
# CHECK-NEXT:   Name: bar6
# CHECK-NEXT:   Value: 0x124
# CHECK-NEXT:   Size: 0
# CHECK-NEXT:   Binding: Global (0x1)
# CHECK-NEXT:   Type: None (0x0)
# CHECK-NEXT:   Other: 0
# CHECK-NEXT:   Section: Absolute (0xFFF1)
# CHECK-NEXT: }