File: deplibs-lto.s

package info (click to toggle)
swiftlang 6.1.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,791,604 kB
  • sloc: cpp: 9,901,740; ansic: 2,201,431; asm: 1,091,827; python: 308,252; objc: 82,166; f90: 80,126; lisp: 38,358; pascal: 25,559; sh: 20,429; ml: 5,058; perl: 4,745; makefile: 4,484; awk: 3,535; javascript: 3,018; xml: 918; fortran: 664; cs: 573; ruby: 396
file content (37 lines) | stat: -rw-r--r-- 1,163 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# REQUIRES: aarch64

# RUN: rm -rf %t && split-file %s %t && cd %t
# RUN: llvm-mc -filetype=obj -triple=aarch64 -o deplibs.o deplibs.s
# RUN: llvm-mc -filetype=obj -triple=aarch64 -o foo.o foo.s
# RUN: llvm-as -o lto.o lto.ll
# RUN: llvm-ar rc libdeplibs.a deplibs.o
# RUN: llvm-ar rc libfoo.a foo.o

## LTO emits a libcall (__aarch64_ldadd4_relax) that is resolved using a
## library (libdeplibs.a) that contains a .deplibs section pointing to a file
## (libfoo.a) not yet added to the link.
# RUN: not ld.lld lto.o -u a -L. -ldeplibs 2>&1 | FileCheck %s
# CHECK: error: input file 'foo.o' added after LTO

## Including the file before LTO prevents the issue.
# RUN: ld.lld lto.o -u a -L. -ldeplibs -lfoo

#--- foo.s
.global foo
foo:
#--- deplibs.s
.global __aarch64_ldadd4_relax
__aarch64_ldadd4_relax:
    b foo
.section ".deplibs","MS",@llvm_dependent_libraries,1
    .asciz "foo"
#--- lto.ll
target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
target triple = "aarch64"

define void @a(i32* nocapture %0) #0 {
  %2 = atomicrmw add i32* %0, i32 1 monotonic, align 4
  ret void
}

attributes #0 = { "target-features"="+outline-atomics" }