
Add new APIs to legacy LTO C API to surface undefined symbols that parsed from assembly. This information is needed by thin LTO to figure out the symbols not to dead strip, while such information is automatically forwarded in full LTO already. Linker needs to fetch the information and adds the undefs from assembly to MustPreserveSymbols list just like treating undefs from a non-LTO object file. Resolves: https://github.com/llvm/llvm-project/issues/29340
22 lines
526 B
LLVM
22 lines
526 B
LLVM
; RUN: llvm-as %s -o %t.o
|
|
; RUN: llvm-lto %t.o --list-symbols-only | FileCheck %s
|
|
|
|
; CHECK: ___foo { function defined hidden }
|
|
; CHECK: ___bar { function defined default }
|
|
; CHECK: _foo { data defined default }
|
|
; CHECK: ___foo { asm extern }
|
|
|
|
target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-n32:64-S128-Fn32"
|
|
target triple = "arm64-apple-macosx12.0.0"
|
|
|
|
module asm ".globl _foo"
|
|
module asm "_foo = ___foo"
|
|
|
|
define hidden i32 @__foo() {
|
|
ret i32 0
|
|
}
|
|
|
|
define i32 @__bar() {
|
|
ret i32 0
|
|
}
|