diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp --- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -685,8 +685,7 @@ OutStreamer->SwitchSection(getObjFileLowering().SectionForGlobal(&F, TM)); emitVisibility(CurrentFnSym, F.getVisibility()); - if (MAI->needsFunctionDescriptors() && - F.getLinkage() != GlobalValue::InternalLinkage) + if (MAI->needsFunctionDescriptors()) emitLinkage(&F, CurrentFnDescSym); emitLinkage(&F, CurrentFnSym); diff --git a/llvm/lib/MC/MCXCOFFStreamer.cpp b/llvm/lib/MC/MCXCOFFStreamer.cpp --- a/llvm/lib/MC/MCXCOFFStreamer.cpp +++ b/llvm/lib/MC/MCXCOFFStreamer.cpp @@ -13,6 +13,7 @@ #include "llvm/BinaryFormat/XCOFF.h" #include "llvm/MC/MCAsmBackend.h" #include "llvm/MC/MCCodeEmitter.h" +#include "llvm/MC/MCDirectives.h" #include "llvm/MC/MCObjectWriter.h" #include "llvm/MC/MCSymbolXCOFF.h" #include "llvm/MC/MCXCOFFStreamer.h" @@ -37,6 +38,9 @@ Symbol->setStorageClass(XCOFF::C_EXT); Symbol->setExternal(true); break; + case MCSA_LGlobal: + Symbol->setStorageClass(XCOFF::C_HIDEXT); + break; default: report_fatal_error("Not implemented yet."); } diff --git a/llvm/test/CodeGen/PowerPC/aix-internal.ll b/llvm/test/CodeGen/PowerPC/aix-internal.ll new file mode 100644 --- /dev/null +++ b/llvm/test/CodeGen/PowerPC/aix-internal.ll @@ -0,0 +1,26 @@ +; RUN: llc -mtriple powerpc-ibm-aix -verify-machineinstrs -mcpu=pwr4 \ +; RUN: -filetype=obj -o %t.o < %s +; RUN: llvm-readobj --syms %t.o | FileCheck %s +; RUN: not --crash llc -mtriple powerpc64-ibm-aix -verify-machineinstrs -mcpu=pwr4 \ +; RUN: -filetype=obj -o %t.o < %s 2>&1 | FileCheck --check-prefix=64-CHECK %s + +; Function Attrs: noinline nounwind optnone +define internal i32 @foo() #0 { + ret i32 1 +} + +;CHECK: Symbol { +;CHECK: Name: .foo +;CHECK-NEXT: Value (RelocatableAddress): +;CHECK-NEXT: Section: .text +;CHECK-NEXT: Type: 0x0 +;CHECK-NEXT: StorageClass: C_HIDEXT (0x6B) + +;CHECK: Symbol { +;CHECK: Name: foo +;CHECK-NEXT: Value (RelocatableAddress): +;CHECK-NEXT: Section: .data +;CHECK-NEXT: Type: 0x0 +;CHECK-NEXT: StorageClass: C_HIDEXT (0x6B) + +;64-CHECK: LLVM ERROR: 64-bit XCOFF object files are not supported yet. \ No newline at end of file