1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 19:23:23 +01:00

This patch fixes LTO's RecordStreamer so that it records symbols in the MCExpr

part of an asm .symver directive as being used. This prevents referenced
functions from being internalized and deleted.

Without the patch to LTOModule.cpp, the test case will produce the error:

LLVM ERROR: A @@ version cannot be undefined.

llvm-svn: 205221
This commit is contained in:
Tom Roeder 2014-03-31 16:59:13 +00:00
parent db61071b5a
commit deee9e4afd
2 changed files with 17 additions and 0 deletions

View File

@ -660,6 +660,7 @@ namespace {
void EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) override {
// FIXME: should we handle aliases?
markDefined(*Symbol);
AddValueSymbols(Value);
}
bool EmitSymbolAttribute(MCSymbol *Symbol,
MCSymbolAttr Attribute) override {

16
test/LTO/symver-asm.ll Normal file
View File

@ -0,0 +1,16 @@
; RUN: llvm-as < %s >%t1
; RUN: llvm-lto -o %t2 %t1
; RUN: llvm-nm %t2 | FileCheck %s
target triple = "x86_64-unknown-linux-gnu"
module asm ".symver io_cancel_0_4,io_cancel@@LIBAIO_0.4"
; Even without -exported-symbol, io_cancel_0_4 should be noticed by LTOModule's
; RecordStreamer, so it shouldn't get eliminated. However, the object file will
; contain the aliased symver as well as the original.
define i32 @io_cancel_0_4() {
; CHECK: io_cancel@@LIBAIO_0.4
; CHECK: io_cancel_0_4
ret i32 0
}