xref: /llvm-project/lld/test/ELF/lto/linker-script-symbols-assign.ll (revision f01fdd17b4d202727023da23bdd120eb0bd94f9f)
1; REQUIRES: x86
2; RUN: llvm-as %s -o %t.o
3
4; RUN: rm -f ptr
5; RUN: echo "foo = 1;" > %t.script
6; RUN: ld.lld %t.o -o %t2 --script %t.script -save-temps
7;; Combined module is not empty, but it will be empty after optimization.
8;; Ensure lld still emits empty combined obj in this case.
9; RUN: llvm-nm %t2.lto.o | count 0
10
11; RUN: llvm-readobj --symbols %t2 | FileCheck %s --check-prefix=VAL
12; VAL:       Symbol {
13; VAL:        Name: foo
14; VAL-NEXT:   Value: 0x1
15; VAL-NEXT:   Size:
16; VAL-NEXT:   Binding: Global
17; VAL-NEXT:   Type: None
18; VAL-NEXT:   Other:
19; VAL-NEXT:   Section: Absolute
20; VAL-NEXT: }
21
22; RUN: echo "zed = 1;" > %t2.script
23; RUN: ld.lld %t.o -o %t3 --script %t2.script
24; RUN: llvm-readobj --symbols %t3 | FileCheck %s --check-prefix=ABS
25; ABS:      Symbol {
26; ABS:        Name: zed
27; ABS-NEXT:   Value: 0x1
28; ABS-NEXT:   Size: 0
29; ABS-NEXT:   Binding: Global
30; ABS-NEXT:   Type: None
31; ABS-NEXT:   Other: 0
32; ABS-NEXT:   Section: Absolute
33; ABS-NEXT: }
34
35target triple = "x86_64-unknown-linux-gnu"
36target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
37
38@foo = global i32 0
39@bar = global i32 0
40