1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 20:51:52 +01:00

[AMDGPU] Emit linkonce and linkonce_odr symbols

Differential Revision: http://reviews.llvm.org/D18726

llvm-svn: 265408
This commit is contained in:
Konstantin Zhuravlyov 2016-04-05 16:00:58 +00:00
parent c0d4fd9a04
commit 57ddfb8bca
2 changed files with 58 additions and 0 deletions

View File

@ -134,6 +134,8 @@ void AMDGPUAsmPrinter::EmitFunctionEntryLabel() {
static bool isModuleLinkage(const GlobalValue *GV) {
switch (GV->getLinkage()) {
case GlobalValue::LinkOnceODRLinkage:
case GlobalValue::LinkOnceAnyLinkage:
case GlobalValue::InternalLinkage:
case GlobalValue::CommonLinkage:
return true;

View File

@ -1,10 +1,14 @@
; RUN: llc < %s -mtriple=amdgcn--amdhsa -mcpu=kaveri | FileCheck --check-prefix=ASM %s
; RUN: llc < %s -mtriple=amdgcn--amdhsa -mcpu=kaveri | llvm-mc -filetype=obj -triple amdgcn--amdhsa -mcpu=kaveri | llvm-readobj -symbols -s | FileCheck %s --check-prefix=ELF
@linkonce_odr_global_program = linkonce_odr addrspace(1) global i32 0
@linkonce_global_program = linkonce addrspace(1) global i32 0
@internal_global_program = internal addrspace(1) global i32 0
@common_global_program = common addrspace(1) global i32 0
@external_global_program = addrspace(1) global i32 0
@linkonce_odr_global_agent = linkonce_odr addrspace(1) global i32 0, section ".hsadata_global_agent"
@linkonce_global_agent = linkonce addrspace(1) global i32 0, section ".hsadata_global_agent"
@internal_global_agent = internal addrspace(1) global i32 0, section ".hsadata_global_agent"
@common_global_agent = common addrspace(1) global i32 0, section ".hsadata_global_agent"
@external_global_agent = addrspace(1) global i32 0, section ".hsadata_global_agent"
@ -16,6 +20,18 @@ define void @test() {
ret void
}
; ASM: .amdgpu_hsa_module_global linkonce_odr_global
; ASM: .size linkonce_odr_global_program, 4
; ASM: .hsadata_global_program
; ASM: linkonce_odr_global_program:
; ASM: .long 0
; ASM: .amdgpu_hsa_module_global linkonce_global
; ASM: .size linkonce_global_program, 4
; ASM: .hsadata_global_program
; ASM: linkonce_global_program:
; ASM: .long 0
; ASM: .amdgpu_hsa_module_global internal_global
; ASM: .size internal_global_program, 4
; ASM: .hsadata_global_program
@ -34,6 +50,18 @@ define void @test() {
; ASM: external_global_program:
; ASM: .long 0
; ASM: .amdgpu_hsa_module_global linkonce_odr_global
; ASM: .size linkonce_odr_global_agent, 4
; ASM: .hsadata_global_agent
; ASM: linkonce_odr_global_agent:
; ASM: .long 0
; ASM: .amdgpu_hsa_module_global linkonce_global
; ASM: .size linkonce_global_agent, 4
; ASM: .hsadata_global_agent
; ASM: linkonce_global_agent:
; ASM: .long 0
; ASM: .amdgpu_hsa_module_global internal_global
; ASM: .size internal_global_agent, 4
; ASM: .hsadata_global_agent
@ -123,6 +151,34 @@ define void @test() {
; ELF: Section: .hsatext
; ELF: }
; ELF: Symbol {
; ELF: Name: linkonce_global_agent
; ELF: Size: 4
; ELF: Binding: Local
; ELF: Section: .hsadata_global_agent
; ELF: }
; ELF: Symbol {
; ELF: Name: linkonce_global_program
; ELF: Size: 4
; ELF: Binding: Local
; ELF: Section: .hsadata_global_program
; ELF: }
; ELF: Symbol {
; ELF: Name: linkonce_odr_global_agent
; ELF: Size: 4
; ELF: Binding: Local
; ELF: Section: .hsadata_global_agent
; ELF: }
; ELF: Symbol {
; ELF: Name: linkonce_odr_global_program
; ELF: Size: 4
; ELF: Binding: Local
; ELF: Section: .hsadata_global_program
; ELF: }
; ELF: Symbol {
; ELF: Name: external_global_agent
; ELF: Size: 4