Skip to content

Commit f85bcc2

Browse files
committed
[AIX] Turn -fdata-sections on by default in Clang
Summary: This patch does the following: 1. Make InitTargetOptionsFromCodeGenFlags() accepts Triple as a parameter, because some options' default value is triple dependant. 2. DataSections is turned on by default on AIX for llc. 3. Test cases change accordingly because of the default behaviour change. 4. Clang Driver passes in -fdata-sections by default on AIX. Reviewed By: MaskRay, DiggerLin Differential Revision: https://reviews.llvm.org/D88737
1 parent 89657b3 commit f85bcc2

36 files changed

+150
-84
lines changed

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4910,8 +4910,9 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
49104910
}
49114911
}
49124912

4913+
bool HasDefaultDataSections = Triple.isOSBinFormatXCOFF();
49134914
if (Args.hasFlag(options::OPT_fdata_sections, options::OPT_fno_data_sections,
4914-
UseSeparateSections)) {
4915+
UseSeparateSections || HasDefaultDataSections)) {
49154916
CmdArgs.push_back("-fdata-sections");
49164917
}
49174918

clang/test/Driver/aix-data-sections.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// Verify -fdata-sections is the default for AIX
2+
3+
// RUN: %clang -### -target powerpc-ibm-aix7.1.0.0 %s -c -o %t.o 2>&1 \
4+
// RUN: | FileCheck %s
5+
// RUN: %clang -### -target powerpc64-ibm-aix7.1.0.0 %s -c -o %t.o 2>&1 \
6+
// RUN: | FileCheck %s
7+
// CHECK: "-fdata-sections"

clang/tools/clang-fuzzer/handle-llvm/handle_llvm.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,8 @@ static std::string OptLLVM(const std::string &IR, CodeGenOpt::Level OLvl) {
102102
ErrorAndExit("Could not parse IR");
103103

104104
Triple ModuleTriple(M->getTargetTriple());
105-
const TargetOptions Options = codegen::InitTargetOptionsFromCodeGenFlags();
105+
const TargetOptions Options =
106+
codegen::InitTargetOptionsFromCodeGenFlags(ModuleTriple);
106107
std::string E;
107108
const Target *TheTarget =
108109
TargetRegistry::lookupTarget(codegen::getMArch(), ModuleTriple, E);
@@ -165,7 +166,10 @@ static void CreateAndRunJITFunc(const std::string &IR, CodeGenOpt::Level OLvl) {
165166
builder.setEngineKind(EngineKind::JIT);
166167
builder.setMCJITMemoryManager(std::make_unique<SectionMemoryManager>());
167168
builder.setOptLevel(OLvl);
168-
builder.setTargetOptions(codegen::InitTargetOptionsFromCodeGenFlags());
169+
170+
Triple ModuleTriple(M->getTargetTriple());
171+
builder.setTargetOptions(
172+
codegen::InitTargetOptionsFromCodeGenFlags(ModuleTriple));
169173

170174
std::unique_ptr<ExecutionEngine> EE(builder.create());
171175
if (!EE)

lld/Common/TargetOptionsCommandFlags.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
static llvm::codegen::RegisterCodeGenFlags CGF;
1515

1616
llvm::TargetOptions lld::initTargetOptionsFromCodeGenFlags() {
17-
return llvm::codegen::InitTargetOptionsFromCodeGenFlags();
17+
return llvm::codegen::InitTargetOptionsFromCodeGenFlags(llvm::Triple());
1818
}
1919

2020
llvm::Optional<llvm::Reloc::Model> lld::getRelocModelFromCMModel() {

llvm/include/llvm/ADT/Triple.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -771,6 +771,11 @@ class Triple {
771771
return isAndroid() || isOSOpenBSD() || isWindowsCygwinEnvironment();
772772
}
773773

774+
/// Tests whether the target uses -data-sections as default.
775+
bool hasDefaultDataSections() const {
776+
return isOSBinFormatXCOFF() || isWasm();
777+
}
778+
774779
/// @}
775780
/// @name Mutators
776781
/// @{

llvm/include/llvm/CodeGen/CommandFlags.h

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
#include "llvm/ADT/FloatingPointMode.h"
1616
#include "llvm/ADT/StringExtras.h"
17+
#include "llvm/ADT/Triple.h"
1718
#include "llvm/IR/Instructions.h"
1819
#include "llvm/IR/Intrinsics.h"
1920
#include "llvm/MC/MCTargetOptionsCommandFlags.h"
@@ -134,9 +135,13 @@ struct RegisterCodeGenFlags {
134135

135136
llvm::BasicBlockSection getBBSectionsMode(llvm::TargetOptions &Options);
136137

137-
// Common utility function tightly tied to the options listed here. Initializes
138-
// a TargetOptions object with CodeGen flags and returns it.
139-
TargetOptions InitTargetOptionsFromCodeGenFlags();
138+
/// Common utility function tightly tied to the options listed here. Initializes
139+
/// a TargetOptions object with CodeGen flags and returns it.
140+
/// \p TheTriple is used to determine the default value for options if
141+
/// options are not explicitly specified. If those triple dependant options
142+
/// value do not have effect for your component, a default Triple() could be
143+
/// passed in.
144+
TargetOptions InitTargetOptionsFromCodeGenFlags(const llvm::Triple &TheTriple);
140145

141146
std::string getCPUStr();
142147

llvm/lib/CodeGen/CommandFlags.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,8 @@ codegen::getBBSectionsMode(llvm::TargetOptions &Options) {
461461

462462
// Common utility function tightly tied to the options listed here. Initializes
463463
// a TargetOptions object with CodeGen flags and returns it.
464-
TargetOptions codegen::InitTargetOptionsFromCodeGenFlags() {
464+
TargetOptions
465+
codegen::InitTargetOptionsFromCodeGenFlags(const Triple &TheTriple) {
465466
TargetOptions Options;
466467
Options.AllowFPOpFusion = getFuseFPOps();
467468
Options.UnsafeFPMath = getEnableUnsafeFPMath();
@@ -485,7 +486,8 @@ TargetOptions codegen::InitTargetOptionsFromCodeGenFlags() {
485486
Options.StackSymbolOrdering = getStackSymbolOrdering();
486487
Options.UseInitArray = !getUseCtors();
487488
Options.RelaxELFRelocations = getRelaxELFRelocations();
488-
Options.DataSections = getDataSections();
489+
Options.DataSections =
490+
getExplicitDataSections().getValueOr(TheTriple.hasDefaultDataSections());
489491
Options.FunctionSections = getFunctionSections();
490492
Options.IgnoreXCOFFVisibility = getIgnoreXCOFFVisibility();
491493
Options.BBSections = getBBSectionsMode(Options);

llvm/test/CodeGen/PowerPC/aix-alias.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
; is implemnted.
33

44
; RUN: llc -verify-machineinstrs -mtriple powerpc-ibm-aix-xcoff -mcpu=pwr4 \
5-
; RUN: -mattr=-altivec < %s | \
5+
; RUN: -mattr=-altivec -data-sections=false < %s | \
66
; RUN: FileCheck --check-prefix=ASM %s
77
; RUN: llc -verify-machineinstrs -mtriple powerpc64-ibm-aix-xcoff -mcpu=pwr4 \
8-
; RUN: -mattr=-altivec < %s | \
8+
; RUN: -mattr=-altivec -data-sections=false < %s | \
99
; RUN: FileCheck --check-prefix=ASM %s
1010

1111
@var = global i32 42

llvm/test/CodeGen/PowerPC/aix-bytestring.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
; RUN: llc -verify-machineinstrs -mcpu=pwr7 -mtriple powerpc-ibm-aix-xcoff < %s | FileCheck %s
2-
; RUN: llc -verify-machineinstrs -mcpu=pwr7 -mtriple powerpc64-ibm-aix-xcoff < %s | FileCheck %s
1+
; RUN: llc -verify-machineinstrs -mcpu=pwr7 -mtriple powerpc-ibm-aix-xcoff -data-sections=false < %s | FileCheck %s
2+
; RUN: llc -verify-machineinstrs -mcpu=pwr7 -mtriple powerpc64-ibm-aix-xcoff -data-sections=false < %s | FileCheck %s
33

44
@str = constant [256 x i8] c"\01\02\03\04\05\06\07\08\09\0A\0B\0C\0D\0E\0F\10\11\12\13\14\15\16\17\18\19\1A\1B\1C\1D\1E\1F !\22#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\7F\80\81\82\83\84\85\86\87\88\89\8A\8B\8C\8D\8E\8F\90\91\92\93\94\95\96\97\98\99\9A\9B\9C\9D\9E\9F\A0\A1\A2\A3\A4\A5\A6\A7\A8\A9\AA\AB\AC\AD\AE\AF\B0\B1\B2\B3\B4\B5\B6\B7\B8\B9\BA\BB\BC\BD\BE\BF\C0\C1\C2\C3\C4\C5\C6\C7\C8\C9\CA\CB\CC\CD\CE\CF\D0\D1\D2\D3\D4\D5\D6\D7\D8\D9\DA\DB\DC\DD\DE\DF\E0\E1\E2\E3\E4\E5\E6\E7\E8\E9\EA\EB\EC\ED\EE\EF\F0\F1\F2\F3\F4\F5\F6\F7\F8\F9\FA\FB\FC\FD\FE\FF\00", align 1
55

llvm/test/CodeGen/PowerPC/aix-extern-weak.ll

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
; RUN: llc -verify-machineinstrs -mtriple powerpc-ibm-aix-xcoff -mcpu=pwr4 \
2-
; RUN: -mattr=-altivec < %s | FileCheck --check-prefixes=COMMON,BIT32 %s
2+
; RUN: -mattr=-altivec -data-sections=false < %s | FileCheck --check-prefixes=COMMON,BIT32 %s
33

44
; RUN: llc -verify-machineinstrs -mtriple powerpc64-ibm-aix-xcoff -mcpu=pwr4 \
5-
; RUN: -mattr=-altivec < %s | FileCheck --check-prefixes=COMMON,BIT64 %s
5+
; RUN: -mattr=-altivec -data-sections=false < %s | FileCheck --check-prefixes=COMMON,BIT64 %s
66

77
; RUN: llc -verify-machineinstrs -mtriple powerpc-ibm-aix-xcoff -mcpu=pwr4 \
8-
; RUN: -mattr=-altivec -filetype=obj -o %t.o < %s
8+
; RUN: -mattr=-altivec -data-sections=false -filetype=obj -o %t.o < %s
99
; RUN: llvm-readobj --symbols %t.o | FileCheck --check-prefix=CHECKSYM %s
1010

1111
; RUN: not --crash llc -verify-machineinstrs -mcpu=pwr4 -mtriple powerpc64-ibm-aix-xcoff \
12-
; RUN: -mattr=-altivec -filetype=obj -o %t.o 2>&1 < %s | FileCheck --check-prefix=XCOFF64 %s
12+
; RUN: -mattr=-altivec -data-sections=false -filetype=obj -o %t.o 2>&1 < %s | \
13+
; RUN: FileCheck --check-prefix=XCOFF64 %s
1314
; XCOFF64: LLVM ERROR: 64-bit XCOFF object files are not supported yet.
1415

1516

llvm/test/CodeGen/PowerPC/aix-extern.ll

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
; RUN: llc -verify-machineinstrs -mtriple powerpc-ibm-aix-xcoff -mcpu=pwr4 \
2-
; RUN: -mattr=-altivec < %s | FileCheck --check-prefixes=COMMON,BIT32 %s
2+
; RUN: -mattr=-altivec -data-sections=false < %s | FileCheck --check-prefixes=COMMON,BIT32 %s
33

44
; RUN: llc -verify-machineinstrs -mtriple powerpc64-ibm-aix-xcoff -mcpu=pwr4 \
5-
; RUN: -mattr=-altivec < %s | FileCheck --check-prefixes=COMMON,BIT64 %s
5+
; RUN: -mattr=-altivec -data-sections=false < %s | FileCheck --check-prefixes=COMMON,BIT64 %s
66

77
; RUN: llc -verify-machineinstrs -mtriple powerpc-ibm-aix-xcoff -mcpu=pwr4 \
8-
; RUN: -mattr=-altivec -filetype=obj -o %t.o < %s
8+
; RUN: -mattr=-altivec -data-sections=false -filetype=obj -o %t.o < %s
99
; RUN: llvm-readobj --symbols %t.o | FileCheck --check-prefix=CHECKSYM %s
1010

1111
; RUN: not --crash llc -verify-machineinstrs -mcpu=pwr4 -mtriple powerpc64-ibm-aix-xcoff \
12-
; RUN: -mattr=-altivec -filetype=obj -o %t.o 2>&1 < %s | FileCheck --check-prefix=XCOFF64 %s
12+
; RUN: -mattr=-altivec -data-sections=false -filetype=obj -o %t.o 2>&1 < %s | FileCheck --check-prefix=XCOFF64 %s
1313
; XCOFF64: LLVM ERROR: 64-bit XCOFF object files are not supported yet.
1414

1515
@bar_p = global i32 (...)* @bar_ref, align 4

llvm/test/CodeGen/PowerPC/aix-ignore-xcoff-visibility.ll

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
; RUN: llc -verify-machineinstrs -mtriple powerpc-ibm-aix-xcoff -mcpu=pwr4 \
2-
; RUN: -mattr=-altivec < %s | \
2+
; RUN: -mattr=-altivec -data-sections=false < %s | \
33
; RUN: FileCheck --check-prefix=VISIBILITY-ASM %s
44
; RUN: llc -verify-machineinstrs -mtriple powerpc-ibm-aix-xcoff -mcpu=pwr4 \
5-
; RUN: -mattr=-altivec -ignore-xcoff-visibility < %s | \
5+
; RUN: -mattr=-altivec -data-sections=false -ignore-xcoff-visibility < %s | \
66
; RUN: FileCheck --check-prefix=IGNOREVISIBILITY-ASM %s
77
; RUN: llc -verify-machineinstrs -mtriple powerpc64-ibm-aix-xcoff -mcpu=pwr4 \
8-
; RUN: -mattr=-altivec < %s | \
8+
; RUN: -mattr=-altivec -data-sections=false < %s | \
99
; RUN: FileCheck --check-prefix=VISIBILITY-ASM %s
1010
; RUN: llc -verify-machineinstrs -mtriple powerpc64-ibm-aix-xcoff -mcpu=pwr4 \
11-
; RUN: -mattr=-altivec -ignore-xcoff-visibility < %s | \
11+
; RUN: -mattr=-altivec -data-sections=false -ignore-xcoff-visibility < %s | \
1212
; RUN: FileCheck --check-prefix=IGNOREVISIBILITY-ASM %s
1313

1414
@foo_p = global void ()* @zoo_extern_h, align 4

llvm/test/CodeGen/PowerPC/aix-overflow-toc.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
# UNSUPPORTED: expensive_checks, debug
22

33
# RUN: %python %s > %t.ll
4-
# RUN: llc -mtriple powerpc-ibm-aix-xcoff -code-model=small -mcpu=pwr4 -mattr=-altivec -O0 < %t.ll | \
4+
# RUN: llc -mtriple powerpc-ibm-aix-xcoff -code-model=small -data-sections=false -mcpu=pwr4 -mattr=-altivec -O0 < %t.ll | \
55
# RUN: FileCheck --check-prefix=ASM32 %s
66

7-
# RUN: llc -mtriple powerpc64-ibm-aix-xcoff -code-model=small -mcpu=pwr4 -mattr=-altivec -O0 < %t.ll | \
7+
# RUN: llc -mtriple powerpc64-ibm-aix-xcoff -code-model=small -data-sections=false -mcpu=pwr4 -mattr=-altivec -O0 < %t.ll | \
88
# RUN: FileCheck --check-prefix=ASM64 %s
99

10-
# RUN: llc -mtriple powerpc-ibm-aix-xcoff -code-model=small -mcpu=pwr4 -mattr=-altivec -O0 \
10+
# RUN: llc -mtriple powerpc-ibm-aix-xcoff -code-model=small -data-sections=false -mcpu=pwr4 -mattr=-altivec -O0 \
1111
# RUN: -filetype=obj -o %t.o < %t.ll
1212
# RUN: llvm-objdump -D -r --symbol-description %t.o | FileCheck --check-prefix=DIS32 %s
1313

14-
# RUN: not --crash llc -mtriple powerpc64-ibm-aix-xcoff \
14+
# RUN: not --crash llc -mtriple powerpc64-ibm-aix-xcoff -data-sections=false \
1515
# RUN: -mcpu=pwr4 -mattr=-altivec -filetype=obj -o %t.o 2>&1 < %t.ll | \
1616
# RUN: FileCheck --check-prefix=XCOFF64 %s
1717
# XCOFF64: LLVM ERROR: 64-bit XCOFF object files are not supported yet.

llvm/test/CodeGen/PowerPC/aix-readonly-with-relocation.ll

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
; RUN: llc -verify-machineinstrs -mcpu=pwr4 -mtriple powerpc-ibm-aix-xcoff --relocation-model=pic < %s | FileCheck %s
2-
; RUN: llc -verify-machineinstrs -mcpu=pwr4 -mtriple powerpc64-ibm-aix-xcoff --relocation-model=pic < %s | FileCheck --check-prefix=CHECK64 %s
1+
; RUN: llc -verify-machineinstrs -mcpu=pwr4 -mtriple powerpc-ibm-aix-xcoff \
2+
; RUN: --relocation-model=pic -data-sections=false < %s | FileCheck %s
3+
; RUN: llc -verify-machineinstrs -mcpu=pwr4 -mtriple powerpc64-ibm-aix-xcoff \
4+
; RUN: --relocation-model=pic -data-sections=false < %s | FileCheck --check-prefix=CHECK64 %s
35

46
@a = common global i32 0
57
@b = constant i32* @a

llvm/test/CodeGen/PowerPC/aix-reference-func-addr-const.ll

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
; RUN: llc -verify-machineinstrs -mcpu=pwr4 -mtriple powerpc-ibm-aix-xcoff < %s | FileCheck %s
2-
; RUN: llc -verify-machineinstrs -mcpu=pwr4 -mtriple powerpc64-ibm-aix-xcoff < %s | FileCheck --check-prefix=CHECK64 %s
1+
; RUN: llc -verify-machineinstrs -mcpu=pwr4 -mtriple powerpc-ibm-aix-xcoff \
2+
; RUN: -data-sections=false < %s | FileCheck %s
3+
; RUN: llc -verify-machineinstrs -mcpu=pwr4 -mtriple powerpc64-ibm-aix-xcoff \
4+
; RUN: -data-sections=false < %s | FileCheck --check-prefix=CHECK64 %s
35

46
@foo_ptr = global void (...)* @foo
57
declare void @foo(...)

llvm/test/CodeGen/PowerPC/aix-return55.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
; RUN: llc -mcpu=pwr4 -mtriple=powerpc-ibm-aix-xcoff -verify-machineinstrs < %s | FileCheck %s
2-
; RUN: llc -mcpu=pwr4 -mtriple=powerpc-ibm-aix-xcoff -verify-machineinstrs -filetype=obj -o %t.o < %s
1+
; RUN: llc -mcpu=pwr4 -mtriple=powerpc-ibm-aix-xcoff -verify-machineinstrs -data-sections=false < %s | FileCheck %s
2+
; RUN: llc -mcpu=pwr4 -mtriple=powerpc-ibm-aix-xcoff -verify-machineinstrs -data-sections=false -filetype=obj -o %t.o < %s
33
; RUN: llvm-objdump -D %t.o | FileCheck --check-prefix=CHECKOBJ %s
44
; RUN: llvm-readobj -sections %t.o | FileCheck --check-prefix=CHECKSECT %s
55

llvm/test/CodeGen/PowerPC/aix-weak.ll

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
; RUN: llc -verify-machineinstrs -mtriple powerpc-ibm-aix-xcoff -mcpu=pwr4 \
2-
; RUN: -mattr=-altivec < %s | FileCheck --check-prefixes=COMMON,BIT32 %s
2+
; RUN: -mattr=-altivec -data-sections=false < %s | FileCheck --check-prefixes=COMMON,BIT32 %s
33

44
; RUN: llc -verify-machineinstrs -mtriple powerpc64-ibm-aix-xcoff -mcpu=pwr4 \
5-
; RUN: -mattr=-altivec < %s | FileCheck --check-prefixes=COMMON,BIT64 %s
5+
; RUN: -mattr=-altivec -data-sections=false < %s | FileCheck --check-prefixes=COMMON,BIT64 %s
66

77
; RUN: llc -verify-machineinstrs -mtriple powerpc-ibm-aix-xcoff -mcpu=pwr4 \
8-
; RUN: -mattr=-altivec -filetype=obj -o %t.o < %s
8+
; RUN: -mattr=-altivec -data-sections=false -filetype=obj -o %t.o < %s
99
; RUN: llvm-readobj --symbols %t.o | FileCheck --check-prefix=CHECKSYM %s
1010

1111
; RUN: not --crash llc -verify-machineinstrs -mcpu=pwr4 -mtriple powerpc64-ibm-aix-xcoff \
12-
; RUN: -mattr=-altivec -filetype=obj -o %t.o 2>&1 < %s | FileCheck --check-prefix=XCOFF64 %s
12+
; RUN: -mattr=-altivec -data-sections=false -filetype=obj -o %t.o 2>&1 < %s | \
13+
; RUN: FileCheck --check-prefix=XCOFF64 %s
1314
; XCOFF64: LLVM ERROR: 64-bit XCOFF object files are not supported yet.
1415

1516
@foo_weak_p = global void (...)* bitcast (void ()* @foo_ref_weak to void (...)*), align 4

llvm/test/CodeGen/PowerPC/aix-xcoff-data-sections.ll

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,24 @@
66
; RUN: llvm-objdump -D --symbol-description %t.o | FileCheck --check-prefix=CHECKOBJ %s
77
; RUN: llvm-readobj -syms %t.o | FileCheck --check-prefix=CHECKSYM %s
88

9+
;; Test to see if the default is correct for -data-sections on AIX.
10+
; RUN: llc -verify-machineinstrs -mcpu=pwr4 -mtriple powerpc-ibm-aix-xcoff < %s | \
11+
; RUN: FileCheck --check-prefixes=CHECK,CHECK32 %s
12+
; RUN: llc -verify-machineinstrs -mcpu=pwr4 -mtriple powerpc64-ibm-aix-xcoff < %s | \
13+
; RUN: FileCheck --check-prefixes=CHECK,CHECK64 %s
14+
; RUN: llc -verify-machineinstrs -mcpu=pwr4 -mtriple powerpc-ibm-aix-xcoff -filetype=obj -o %t.o < %s
15+
; RUN: llvm-objdump -D --symbol-description %t.o | FileCheck --check-prefix=CHECKOBJ %s
16+
; RUN: llvm-readobj -syms %t.o | FileCheck --check-prefix=CHECKSYM %s
17+
18+
;; Test to see if the default is correct for -data-sections on AIX.
19+
; RUN: llc -verify-machineinstrs -mcpu=pwr4 -mtriple powerpc-ibm-aix-xcoff < %s | \
20+
; RUN: FileCheck --check-prefixes=CHECK,CHECK32 %s
21+
; RUN: llc -verify-machineinstrs -mcpu=pwr4 -mtriple powerpc64-ibm-aix-xcoff < %s | \
22+
; RUN: FileCheck --check-prefixes=CHECK,CHECK64 %s
23+
; RUN: llc -verify-machineinstrs -mcpu=pwr4 -mtriple powerpc-ibm-aix-xcoff -filetype=obj -o %t.o < %s
24+
; RUN: llvm-objdump -D --symbol-description %t.o | FileCheck --check-prefix=CHECKOBJ %s
25+
; RUN: llvm-readobj -syms %t.o | FileCheck --check-prefix=CHECKSYM %s
26+
927
@ivar = local_unnamed_addr global i32 35, align 4
1028
@const_ivar = constant i32 35, align 4
1129

llvm/test/CodeGen/PowerPC/aix-xcoff-data.ll

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
; This file tests the codegen of initialized and common variables in AIX
22
; assembly and XCOFF object files.
33

4-
; RUN: llc -mtriple powerpc-ibm-aix-xcoff < %s | FileCheck --check-prefixes=CHECK,CHECK32 %s
5-
; RUN: llc -mtriple powerpc64-ibm-aix-xcoff < %s | FileCheck --check-prefixes=CHECK,CHECK64 %s
4+
; RUN: llc -mtriple powerpc-ibm-aix-xcoff -data-sections=false < %s | FileCheck --check-prefixes=CHECK,CHECK32 %s
5+
; RUN: llc -mtriple powerpc64-ibm-aix-xcoff -data-sections=false < %s | FileCheck --check-prefixes=CHECK,CHECK64 %s
66

7-
; RUN: llc -mtriple powerpc-ibm-aix-xcoff -filetype=obj -o %t.o < %s
7+
; RUN: llc -mtriple powerpc-ibm-aix-xcoff -data-sections=false -filetype=obj -o %t.o < %s
88
; RUN: llvm-readobj --section-headers --file-header %t.o | \
99
; RUN: FileCheck --check-prefix=OBJ %s
1010
; RUN: llvm-readobj --syms %t.o | FileCheck --check-prefix=SYMS %s
1111

12-
; RUN: not --crash llc -mtriple powerpc64-ibm-aix-xcoff -filetype=obj < %s 2>&1 | \
12+
; RUN: not --crash llc -mtriple powerpc64-ibm-aix-xcoff -data-sections=false -filetype=obj < %s 2>&1 | \
1313
; RUN: FileCheck --check-prefix=XCOFF64 %s
1414
; XCOFF64: LLVM ERROR: 64-bit XCOFF object files are not supported yet.
1515

llvm/test/CodeGen/PowerPC/aix-xcoff-lower-comm.ll

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1-
; RUN: llc -verify-machineinstrs -mcpu=pwr4 -mtriple powerpc-ibm-aix-xcoff < %s | FileCheck --check-prefixes=CHECK,ASM32 %s
2-
; RUN: llc -verify-machineinstrs -mcpu=pwr4 -mtriple powerpc64-ibm-aix-xcoff < %s | FileCheck --check-prefixes=CHECK,ASM64 %s
1+
; RUN: llc -verify-machineinstrs -mcpu=pwr4 -mtriple powerpc-ibm-aix-xcoff -data-sections=false < %s | \
2+
; RUN: FileCheck --check-prefixes=CHECK,ASM32 %s
3+
; RUN: llc -verify-machineinstrs -mcpu=pwr4 -mtriple powerpc64-ibm-aix-xcoff -data-sections=false < %s | \
4+
; RUN: FileCheck --check-prefixes=CHECK,ASM64 %s
35

4-
; RUN: llc -verify-machineinstrs -mcpu=pwr4 -mtriple powerpc-ibm-aix-xcoff -filetype=obj -o %t.o < %s
6+
; RUN: llc -verify-machineinstrs -mcpu=pwr4 -mtriple powerpc-ibm-aix-xcoff -data-sections=false -filetype=obj -o %t.o < %s
57
; RUN: llvm-readobj -r --expand-relocs -t %t.o | FileCheck --check-prefixes=RELOC,SYM %s
68

7-
; RUN: not --crash llc -verify-machineinstrs -mcpu=pwr4 -mtriple powerpc64-ibm-aix-xcoff -filetype=obj < %s 2>&1 | \
8-
; RUN: FileCheck --check-prefix=XCOFF64 %s
9+
; RUN: not --crash llc -verify-machineinstrs -mcpu=pwr4 -mtriple powerpc64-ibm-aix-xcoff \
10+
; RUN: -data-sections=false -filetype=obj < %s 2>&1 | \
11+
; RUN: FileCheck --check-prefix=XCOFF64 %s
912
; XCOFF64: LLVM ERROR: 64-bit XCOFF object files are not supported yet.
1013

1114
@common = common global i32 0, align 4

llvm/test/CodeGen/PowerPC/aix-xcoff-mergeable-const.ll

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
; This file tests the codegen of mergeable const in AIX assembly.
22
; This file also tests mergeable const in XCOFF object file generation.
3-
; RUN: llc -verify-machineinstrs -mcpu=pwr4 -mtriple powerpc-ibm-aix-xcoff < %s | FileCheck --check-prefixes=CHECK,CHECK32 %s
4-
; RUN: llc -verify-machineinstrs -mcpu=pwr4 -mtriple powerpc64-ibm-aix-xcoff < %s | FileCheck --check-prefixes=CHECK,CHECK64 %s
5-
; RUN: llc -verify-machineinstrs -mcpu=pwr4 -mtriple powerpc-ibm-aix-xcoff -filetype=obj -o %t.o < %s
3+
; RUN: llc -verify-machineinstrs -mcpu=pwr4 -mtriple powerpc-ibm-aix-xcoff -data-sections=false < %s | \
4+
; RUN: FileCheck --check-prefixes=CHECK,CHECK32 %s
5+
; RUN: llc -verify-machineinstrs -mcpu=pwr4 -mtriple powerpc64-ibm-aix-xcoff -data-sections=false < %s | \
6+
; RUN: FileCheck --check-prefixes=CHECK,CHECK64 %s
7+
; RUN: llc -verify-machineinstrs -mcpu=pwr4 -mtriple powerpc-ibm-aix-xcoff -data-sections=false -filetype=obj -o %t.o < %s
68
; RUN: llvm-objdump -D %t.o | FileCheck --check-prefix=CHECKOBJ %s
79
; RUN: llvm-readobj -syms %t.o | FileCheck --check-prefix=CHECKSYM %s
810

llvm/test/CodeGen/PowerPC/aix-xcoff-mergeable-str.ll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
; tests for XCOFF object files.
55

66
; RUN: llc -verify-machineinstrs -mcpu=pwr4 \
7-
; RUN: -mtriple powerpc-ibm-aix-xcoff < %s | FileCheck %s
7+
; RUN: -mtriple powerpc-ibm-aix-xcoff -data-sections=false < %s | FileCheck %s
88
; RUN: llc -verify-machineinstrs -mcpu=pwr4 \
9-
; RUN: -mtriple powerpc64-ibm-aix-xcoff < %s | FileCheck %s
9+
; RUN: -mtriple powerpc64-ibm-aix-xcoff -data-sections=false < %s | FileCheck %s
1010

11-
; RUN: llc -verify-machineinstrs -mcpu=pwr4 -mtriple powerpc-ibm-aix-xcoff -filetype=obj -o %t.o < %s
11+
; RUN: llc -verify-machineinstrs -mcpu=pwr4 -mtriple powerpc-ibm-aix-xcoff -data-sections=false -filetype=obj -o %t.o < %s
1212
; RUN: llvm-objdump -D %t.o | FileCheck --check-prefix=CHECKOBJ %s
1313

1414
@magic16 = private unnamed_addr constant [4 x i16] [i16 264, i16 272, i16 213, i16 0], align 2

0 commit comments

Comments
 (0)