diff options
| author | esmeyi <esme.yi@ibm.com> | 2022-08-11 01:13:05 -0400 |
|---|---|---|
| committer | esmeyi <esme.yi@ibm.com> | 2022-08-11 01:13:05 -0400 |
| commit | 7a70e6e224cdbbd02cf6a7a7d8ff69950faaa35f (patch) | |
| tree | 0fac381829b9204d188e4e2564c9a2bc1e33db49 | |
| parent | 4e0a2bd6279998261393c9b7446dbb285188c149 (diff) | |
| download | llvm-7a70e6e224cdbbd02cf6a7a7d8ff69950faaa35f.zip llvm-7a70e6e224cdbbd02cf6a7a7d8ff69950faaa35f.tar.gz llvm-7a70e6e224cdbbd02cf6a7a7d8ff69950faaa35f.tar.bz2 | |
[XCOFF] ignore the cold attribute.
Summary: AIX XCOFF doesn't support the cold feature.
While it shouldn't be a function error when XCOFF catching the cold attribute.
As with the behavior of other formats, we just ignore the attribute for now.
Reviewed By: DiggerLin
Differential Revision: https://reviews.llvm.org/D131473
| -rw-r--r-- | llvm/lib/MC/MCXCOFFStreamer.cpp | 4 | ||||
| -rw-r--r-- | llvm/test/CodeGen/PowerPC/aix-xcoff-cold.ll | 15 |
2 files changed, 19 insertions, 0 deletions
diff --git a/llvm/lib/MC/MCXCOFFStreamer.cpp b/llvm/lib/MC/MCXCOFFStreamer.cpp index a4a4227..7b4f649 100644 --- a/llvm/lib/MC/MCXCOFFStreamer.cpp +++ b/llvm/lib/MC/MCXCOFFStreamer.cpp @@ -37,6 +37,10 @@ bool MCXCOFFStreamer::emitSymbolAttribute(MCSymbol *Sym, getAssembler().registerSymbol(*Symbol); switch (Attribute) { + // XCOFF doesn't support the cold feature. + case MCSA_Cold: + return false; + case MCSA_Global: case MCSA_Extern: Symbol->setStorageClass(XCOFF::C_EXT); diff --git a/llvm/test/CodeGen/PowerPC/aix-xcoff-cold.ll b/llvm/test/CodeGen/PowerPC/aix-xcoff-cold.ll new file mode 100644 index 0000000..531be9d --- /dev/null +++ b/llvm/test/CodeGen/PowerPC/aix-xcoff-cold.ll @@ -0,0 +1,15 @@ +; RUN: llc -mtriple powerpc64-ibm-aix-xcoff -filetype=obj -o %t.o < %s +; RUN: llvm-objdump --syms %t.o | FileCheck %s + +; CHECK: SYMBOL TABLE: +; CHECK-NEXT: 0000000000000000 df *DEBUG* 0000000000000000 <stdin> +; CHECK-NEXT: 0000000000000000 l .text 000000000000001e .text +; CHECK-NEXT: 0000000000000000 g F .text (csect: .text) 0000000000000000 .cold_fun +; CHECK-NEXT: 0000000000000020 g O .data 0000000000000018 cold_fun + +define dso_local void @cold_fun() #1 { +entry: + ret void +} + +attributes #1 = { cold } |
