File: thinlto-object-suffix-replace.ll

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (51 lines) | stat: -rw-r--r-- 2,241 bytes parent folder | download | duplicates (15)
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
; REQUIRES: x86
;; Test to make sure the thinlto-object-suffix-replace option is handled
;; correctly.
; RUN: rm -rf %t && mkdir %t && cd %t

;; Generate bitcode file with summary, as well as a minimized bitcode without
; the debug metadata for the thin link.
; RUN: opt --thinlto-bc %s -thin-link-bitcode-file=1.thinlink.bc -o 1.o

;; First perform the thin link on the normal bitcode file, and save the
;; resulting index.
; RUN: ld.lld --plugin-opt=thinlto-index-only -shared 1.o -o 3
; RUN: cp 1.o.thinlto.bc 1.o.thinlto.bc.orig

;; Next perform the thin link on the minimized bitcode file, and compare dump
;; of the resulting index to the above dump to ensure they are identical.
; RUN: rm -f 1.o.thinlto.bc
;; Make sure it isn't inadvertently using the regular bitcode file.
; RUN: rm -f 1.o
; RUN: ld.lld --plugin-opt=thinlto-index-only --plugin-opt=thinlto-object-suffix-replace=".thinlink.bc;.o" \
; RUN:   -shared 1.thinlink.bc -o 3
; RUN: cmp 1.o.thinlto.bc.orig 1.o.thinlto.bc
;; Also check that this works without the --plugin-opt= prefix.
; RUN: ld.lld --thinlto-index-only --thinlto-object-suffix-replace=".thinlink.bc;.o" \
; RUN:   -shared 1.thinlink.bc -o 3
; RUN: cmp 1.o.thinlto.bc.orig 1.o.thinlto.bc

;; Ensure lld generates error if object suffix replace option does not have 'old;new' format
; RUN: rm -f 1.o.thinlto.bc
; RUN: not ld.lld --plugin-opt=thinlto-index-only --plugin-opt=thinlto-object-suffix-replace="abc:def" -shared 1.thinlink.bc \
; RUN:   -o 3 2>&1 | FileCheck %s --check-prefix=ERR1
; ERR1: --plugin-opt=thinlto-object-suffix-replace= expects 'old;new' format, but got abc:def

;; If filename does not end with old suffix, no suffix change should occur,
;; so ".thinlto.bc" will simply be appended to the input file name.
; RUN: rm -f 1.thinlink.bc.thinlto.bc
; RUN: ld.lld --plugin-opt=thinlto-index-only --plugin-opt=thinlto-object-suffix-replace=".abc;.o" -shared 1.thinlink.bc -o /dev/null
; RUN: ls 1.thinlink.bc.thinlto.bc

target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

define void @f() {
entry:
  ret void
}

!llvm.dbg.cu = !{}

!1 = !{i32 2, !"Debug Info Version", i32 3}
!llvm.module.flags = !{!1}