mirror of
https://github.com/RPCS3/llvm.git
synced 2025-05-16 02:16:23 +00:00

Summary: ELF linkers generate __start_<secname> and __stop_<secname> symbols when there is a value in a section <secname> where the name is a valid C identifier. If dead stripping determines that the values declared in section <secname> are dead, and we then internalize (and delete) such a symbol, programs that reference the corresponding start and end section symbols will get undefined reference linking errors. To fix this, add the section name to the IRSymtab entry when a symbol is defined in a specific section. Then use this in the gold-plugin to mark the symbol as external and visible from outside the summary when the section name is a valid C identifier. Reviewers: pcc Subscribers: mehdi_amini, inglorion, eraman, llvm-commits Differential Revision: https://reviews.llvm.org/D35639 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309009 91177308-0d34-0410-b5e6-96231b3b80d8
34 lines
1.6 KiB
LLVM
34 lines
1.6 KiB
LLVM
; RUN: env LLVM_OVERRIDE_PRODUCER=producer opt -o %t %s
|
|
; RUN: llvm-bcanalyzer -dump -show-binary-blobs %t | FileCheck --check-prefix=BCA %s
|
|
|
|
; Same producer, does not require upgrade.
|
|
; RUN: env LLVM_OVERRIDE_PRODUCER=producer llvm-lto2 dump-symtab %t | FileCheck --check-prefix=SYMTAB %s
|
|
|
|
; Different producer, requires upgrade.
|
|
; RUN: env LLVM_OVERRIDE_PRODUCER=consumer llvm-lto2 dump-symtab %t | FileCheck --check-prefix=SYMTAB %s
|
|
|
|
; BCA: <SYMTAB_BLOCK
|
|
; Version stored at offset 0.
|
|
; BCA-NEXT: <BLOB abbrevid=4/> blob data = '\x01\x00\x00\x00\x06\x00\x00\x00\x08\x00\x00\x00D\x00\x00\x00\x01\x00\x00\x00P\x00\x00\x00\x00\x00\x00\x00P\x00\x00\x00\x02\x00\x00\x00\x80\x00\x00\x00\x00\x00\x00\x00\x0E\x00\x00\x00\x18\x00\x00\x00&\x00\x00\x00\x0B\x00\x00\x001\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03\x00\x00\x00\x00\x00\x00\x00\x03\x00\x00\x00\xFF\xFF\xFF\xFF\x00$\x00\x00\x03\x00\x00\x00\x03\x00\x00\x00\x03\x00\x00\x00\x03\x00\x00\x00\xFF\xFF\xFF\xFF\x08$\x00\x00'
|
|
; BCA-NEXT: </SYMTAB_BLOCK>
|
|
; BCA-NEXT: <STRTAB_BLOCK
|
|
; BCA-NEXT: <BLOB abbrevid=4/> blob data = 'foobarproducerx86_64-unknown-linux-gnuirsymtab.ll'
|
|
; BCA-NEXT: </STRTAB_BLOCK>
|
|
|
|
; SYMTAB: version: 1
|
|
; SYMTAB-NEXT: producer: producer
|
|
; SYMTAB-NEXT: target triple: x86_64-unknown-linux-gnu
|
|
; SYMTAB-NEXT: source filename: irsymtab.ll
|
|
; SYMTAB-NEXT: D------X foo
|
|
; SYMTAB-NEXT: DU-----X bar
|
|
|
|
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
|
|
target triple = "x86_64-unknown-linux-gnu"
|
|
source_filename = "irsymtab.ll"
|
|
|
|
define void @foo() {
|
|
ret void
|
|
}
|
|
|
|
declare void @bar()
|