This reverts commit 1ec7e86b3a779df2a0af3f37e58c8f5b3a398d7f after issue #190072 was fixed.
55 lines
1.5 KiB
Plaintext
55 lines
1.5 KiB
Plaintext
; REQUIRES: x86
|
|
|
|
; RUN: rm -rf %t && split-file %s %t && cd %t
|
|
; RUN: llvm-as main.ll -o main.o
|
|
; RUN: llvm-as puts.ll -o puts.o
|
|
; RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux-gnu printf.s -o printf.o
|
|
; RUN: llvm-ar rcs libc.a puts.o printf.o
|
|
|
|
;; Ensure that no printf->puts translation occurs during LTO because puts is in
|
|
;; bitcode, but was not brought into the link. This would fail the link by
|
|
;; extracting bitcode after LTO.
|
|
; RUN: ld.lld -o out main.o libc.a
|
|
; RUN: llvm-nm out | FileCheck %s
|
|
|
|
;; Test the same behavior with lazy objects.
|
|
; RUN: ld.lld -o out-lazy main.o --start-lib puts.o --end-lib printf.o
|
|
; RUN: llvm-nm out-lazy | FileCheck %s
|
|
|
|
;; Test that translation DOES occur when puts is extracted and brought into the link.
|
|
; RUN: ld.lld -o out-extracted main.o puts.o printf.o
|
|
; RUN: llvm-nm out-extracted | FileCheck %s --check-prefix=EXTRACTED
|
|
|
|
; CHECK-NOT: puts
|
|
; CHECK: printf
|
|
|
|
; EXTRACTED: printf
|
|
; EXTRACTED: puts
|
|
|
|
;--- puts.ll
|
|
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
|
|
target triple = "x86_64-unknown-linux-gnu"
|
|
|
|
define i32 @puts(ptr nocapture readonly %0) noinline {
|
|
call void asm sideeffect "", ""()
|
|
ret i32 0
|
|
}
|
|
|
|
;--- printf.s
|
|
.globl printf
|
|
printf:
|
|
ret
|
|
|
|
;--- main.ll
|
|
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
|
|
target triple = "x86_64-unknown-linux-gnu"
|
|
|
|
@str = constant [5 x i8] c"foo\0A\00"
|
|
|
|
define i32 @_start() {
|
|
%call = call i32 (ptr, ...) @printf(ptr @str)
|
|
ret i32 0
|
|
}
|
|
|
|
declare i32 @printf(ptr, ...)
|