This is the everything diff: it includes the clang diff that I sent to
tech@, plus the major version bumps for libLLVM libc++ libc++abi.
- distrib/sets/lists: put the new versions in the base sets.
- gnu/llvm/tools/clang: -msvr4-struct-return
- gnu/usr.bin/clang/libLLVM, lib/libcxx, lib/libcxxabi: new versions
Index: distrib/sets/lists/base/md.amd64
===================================================================
RCS file: /cvs/src/distrib/sets/lists/base/md.amd64,v
retrieving revision 1.875
diff -u -p -r1.875 md.amd64
--- distrib/sets/lists/base/md.amd64 30 Dec 2019 02:20:33 -0000 1.875
+++ distrib/sets/lists/base/md.amd64 12 Feb 2020 20:52:32 -0000
@@ -81,9 +81,9 @@
./usr/lib/gcc-lib/amd64-unknown-openbsd6.6/4.2.1/collect2
./usr/lib/gcc-lib/amd64-unknown-openbsd6.6/4.2.1/libgcc.a
./usr/lib/gcc-lib/amd64-unknown-openbsd6.6/4.2.1/specs
-./usr/lib/libLLVM.so.1.0
-./usr/lib/libc++.so.3.0
-./usr/lib/libc++abi.so.1.0
+./usr/lib/libLLVM.so.2.0
+./usr/lib/libc++.so.4.0
+./usr/lib/libc++abi.so.2.0
./usr/lib/libcompiler_rt.a
./usr/lib/libstdc++.so.57.0
./usr/libdata/perl5/amd64-openbsd
Index: distrib/sets/lists/base/md.arm64
===================================================================
RCS file: /cvs/src/distrib/sets/lists/base/md.arm64,v
retrieving revision 1.22
diff -u -p -r1.22 md.arm64
--- distrib/sets/lists/base/md.arm64 30 Dec 2019 02:20:34 -0000 1.22
+++ distrib/sets/lists/base/md.arm64 12 Feb 2020 20:52:32 -0000
@@ -37,9 +37,9 @@
./usr/lib/crtbeginS.o
./usr/lib/crtend.o
./usr/lib/crtendS.o
-./usr/lib/libLLVM.so.1.0
-./usr/lib/libc++.so.3.0
-./usr/lib/libc++abi.so.1.0
+./usr/lib/libLLVM.so.2.0
+./usr/lib/libc++.so.4.0
+./usr/lib/libc++abi.so.2.0
./usr/lib/libcompiler_rt.a
./usr/libdata/perl5/aarch64-openbsd
./usr/libdata/perl5/aarch64-openbsd/.packlist
Index: distrib/sets/lists/base/md.armv7
===================================================================
RCS file: /cvs/src/distrib/sets/lists/base/md.armv7,v
retrieving revision 1.284
diff -u -p -r1.284 md.armv7
--- distrib/sets/lists/base/md.armv7 30 Dec 2019 02:20:34 -0000 1.284
+++ distrib/sets/lists/base/md.armv7 12 Feb 2020 20:52:32 -0000
@@ -37,9 +37,9 @@
./usr/lib/crtbeginS.o
./usr/lib/crtend.o
./usr/lib/crtendS.o
-./usr/lib/libLLVM.so.1.0
-./usr/lib/libc++.so.3.0
-./usr/lib/libc++abi.so.1.0
+./usr/lib/libLLVM.so.2.0
+./usr/lib/libc++.so.4.0
+./usr/lib/libc++abi.so.2.0
./usr/lib/libcompiler_rt.a
./usr/libdata/perl5/arm-openbsd
./usr/libdata/perl5/arm-openbsd/.packlist
Index: distrib/sets/lists/base/md.i386
===================================================================
RCS file: /cvs/src/distrib/sets/lists/base/md.i386,v
retrieving revision 1.1254
diff -u -p -r1.1254 md.i386
--- distrib/sets/lists/base/md.i386 30 Dec 2019 02:20:34 -0000 1.1254
+++ distrib/sets/lists/base/md.i386 12 Feb 2020 20:52:32 -0000
@@ -78,9 +78,9 @@
./usr/lib/crtbeginS.o
./usr/lib/crtend.o
./usr/lib/crtendS.o
-./usr/lib/libLLVM.so.1.0
-./usr/lib/libc++.so.3.0
-./usr/lib/libc++abi.so.1.0
+./usr/lib/libLLVM.so.2.0
+./usr/lib/libc++.so.4.0
+./usr/lib/libc++abi.so.2.0
./usr/lib/libcompiler_rt.a
./usr/libdata/perl5/i386-openbsd
./usr/libdata/perl5/i386-openbsd/.packlist
Index: distrib/sets/lists/base/md.loongson
===================================================================
RCS file: /cvs/src/distrib/sets/lists/base/md.loongson,v
retrieving revision 1.456
diff -u -p -r1.456 md.loongson
--- distrib/sets/lists/base/md.loongson 30 Dec 2019 02:20:34 -0000 1.456
+++ distrib/sets/lists/base/md.loongson 12 Feb 2020 20:52:32 -0000
@@ -48,9 +48,9 @@
./usr/lib/gcc-lib/mips64el-unknown-openbsd6.6/4.2.1/collect2
./usr/lib/gcc-lib/mips64el-unknown-openbsd6.6/4.2.1/libgcc.a
./usr/lib/gcc-lib/mips64el-unknown-openbsd6.6/4.2.1/specs
-./usr/lib/libLLVM.so.1.0
-./usr/lib/libc++.so.3.0
-./usr/lib/libc++abi.so.1.0
+./usr/lib/libLLVM.so.2.0
+./usr/lib/libc++.so.4.0
+./usr/lib/libc++abi.so.2.0
./usr/lib/libcompiler_rt.a
./usr/lib/libstdc++.so.57.0
./usr/libdata/perl5/mips64el-openbsd
Index: distrib/sets/lists/base/md.macppc
===================================================================
RCS file: /cvs/src/distrib/sets/lists/base/md.macppc,v
retrieving revision 1.1023
diff -u -p -r1.1023 md.macppc
--- distrib/sets/lists/base/md.macppc 30 Dec 2019 02:20:34 -0000 1.1023
+++ distrib/sets/lists/base/md.macppc 12 Feb 2020 20:52:32 -0000
@@ -78,9 +78,9 @@
./usr/lib/gcc-lib/powerpc-unknown-openbsd6.6/4.2.1/collect2
./usr/lib/gcc-lib/powerpc-unknown-openbsd6.6/4.2.1/libgcc.a
./usr/lib/gcc-lib/powerpc-unknown-openbsd6.6/4.2.1/specs
-./usr/lib/libLLVM.so.1.0
-./usr/lib/libc++.so.3.0
-./usr/lib/libc++abi.so.1.0
+./usr/lib/libLLVM.so.2.0
+./usr/lib/libc++.so.4.0
+./usr/lib/libc++abi.so.2.0
./usr/lib/libcompiler_rt.a
./usr/lib/libstdc++.so.57.0
./usr/libdata/perl5/powerpc-openbsd
Index: distrib/sets/lists/base/md.octeon
===================================================================
RCS file: /cvs/src/distrib/sets/lists/base/md.octeon,v
retrieving revision 1.307
diff -u -p -r1.307 md.octeon
--- distrib/sets/lists/base/md.octeon 30 Dec 2019 02:20:34 -0000 1.307
+++ distrib/sets/lists/base/md.octeon 12 Feb 2020 20:52:32 -0000
@@ -46,9 +46,9 @@
./usr/lib/gcc-lib/mips64-unknown-openbsd6.6/4.2.1/collect2
./usr/lib/gcc-lib/mips64-unknown-openbsd6.6/4.2.1/libgcc.a
./usr/lib/gcc-lib/mips64-unknown-openbsd6.6/4.2.1/specs
-./usr/lib/libLLVM.so.1.0
-./usr/lib/libc++.so.3.0
-./usr/lib/libc++abi.so.1.0
+./usr/lib/libLLVM.so.2.0
+./usr/lib/libc++.so.4.0
+./usr/lib/libc++abi.so.2.0
./usr/lib/libcompiler_rt.a
./usr/lib/libstdc++.so.57.0
./usr/libdata/perl5/mips64-openbsd
Index: distrib/sets/lists/base/md.sgi
===================================================================
RCS file: /cvs/src/distrib/sets/lists/base/md.sgi,v
retrieving revision 1.836
diff -u -p -r1.836 md.sgi
--- distrib/sets/lists/base/md.sgi 30 Dec 2019 02:20:34 -0000 1.836
+++ distrib/sets/lists/base/md.sgi 12 Feb 2020 20:52:32 -0000
@@ -77,9 +77,9 @@
./usr/lib/gcc-lib/mips64-unknown-openbsd6.6/4.2.1/collect2
./usr/lib/gcc-lib/mips64-unknown-openbsd6.6/4.2.1/libgcc.a
./usr/lib/gcc-lib/mips64-unknown-openbsd6.6/4.2.1/specs
-./usr/lib/libLLVM.so.1.0
-./usr/lib/libc++.so.3.0
-./usr/lib/libc++abi.so.1.0
+./usr/lib/libLLVM.so.2.0
+./usr/lib/libc++.so.4.0
+./usr/lib/libc++abi.so.2.0
./usr/lib/libcompiler_rt.a
./usr/lib/libstdc++.so.57.0
./usr/libdata/perl5/mips64-openbsd
Index: distrib/sets/lists/base/md.sparc64
===================================================================
RCS file: /cvs/src/distrib/sets/lists/base/md.sparc64,v
retrieving revision 1.1020
diff -u -p -r1.1020 md.sparc64
--- distrib/sets/lists/base/md.sparc64 30 Dec 2019 02:20:34 -0000 1.1020
+++ distrib/sets/lists/base/md.sparc64 12 Feb 2020 20:52:32 -0000
@@ -79,9 +79,9 @@
./usr/lib/gcc-lib/sparc64-unknown-openbsd6.6/4.2.1/collect2
./usr/lib/gcc-lib/sparc64-unknown-openbsd6.6/4.2.1/libgcc.a
./usr/lib/gcc-lib/sparc64-unknown-openbsd6.6/4.2.1/specs
-./usr/lib/libLLVM.so.1.0
-./usr/lib/libc++.so.3.0
-./usr/lib/libc++abi.so.1.0
+./usr/lib/libLLVM.so.2.0
+./usr/lib/libc++.so.4.0
+./usr/lib/libc++abi.so.2.0
./usr/lib/libcompiler_rt.a
./usr/lib/libstdc++.so.57.0
./usr/libdata/perl5/sparc64-openbsd
Index: gnu/llvm/tools/clang/include/clang/Driver/Options.td
===================================================================
RCS file: /cvs/src/gnu/llvm/tools/clang/include/clang/Driver/Options.td,v
retrieving revision 1.11
diff -u -p -r1.11 Options.td
--- gnu/llvm/tools/clang/include/clang/Driver/Options.td 23 Jun 2019
22:05:15 -0000 1.11
+++ gnu/llvm/tools/clang/include/clang/Driver/Options.td 12 Feb 2020
20:52:35 -0000
@@ -2238,6 +2238,12 @@ def mlongcall: Flag<["-"], "mlongcall">,
Group<m_ppc_Features_Group>;
def mno_longcall : Flag<["-"], "mno-longcall">,
Group<m_ppc_Features_Group>;
+def maix_struct_return : Flag<["-"], "maix-struct-return">,
+ Group<m_Group>, Flags<[CC1Option]>,
+ HelpText<"Return all structs in memory (PPC32 only)">;
+def msvr4_struct_return : Flag<["-"], "msvr4-struct-return">,
+ Group<m_Group>, Flags<[CC1Option]>,
+ HelpText<"Return small structs in registers (PPC32 only)">;
def mvx : Flag<["-"], "mvx">, Group<m_Group>;
def mno_vx : Flag<["-"], "mno-vx">, Group<m_Group>;
Index: gnu/llvm/tools/clang/lib/CodeGen/TargetInfo.cpp
===================================================================
RCS file: /cvs/src/gnu/llvm/tools/clang/lib/CodeGen/TargetInfo.cpp,v
retrieving revision 1.1.1.7
diff -u -p -r1.1.1.7 TargetInfo.cpp
--- gnu/llvm/tools/clang/lib/CodeGen/TargetInfo.cpp 23 Jun 2019 21:37:39
-0000 1.1.1.7
+++ gnu/llvm/tools/clang/lib/CodeGen/TargetInfo.cpp 12 Feb 2020 20:52:35
-0000
@@ -4092,12 +4092,24 @@ namespace {
/// PPC32_SVR4_ABIInfo - The 32-bit PowerPC ELF (SVR4) ABI information.
class PPC32_SVR4_ABIInfo : public DefaultABIInfo {
bool IsSoftFloatABI;
+ bool IsRetSmallStructInRegABI;
CharUnits getParamTypeAlignment(QualType Ty) const;
public:
- PPC32_SVR4_ABIInfo(CodeGen::CodeGenTypes &CGT, bool SoftFloatABI)
- : DefaultABIInfo(CGT), IsSoftFloatABI(SoftFloatABI) {}
+ PPC32_SVR4_ABIInfo(CodeGen::CodeGenTypes &CGT, bool SoftFloatABI,
+ bool RetSmallStructInRegABI)
+ : DefaultABIInfo(CGT), IsSoftFloatABI(SoftFloatABI),
+ IsRetSmallStructInRegABI(RetSmallStructInRegABI) {}
+
+ ABIArgInfo classifyReturnType(QualType RetTy) const;
+
+ void computeInfo(CGFunctionInfo &FI) const override {
+ if (!getCXXABI().classifyReturnType(FI))
+ FI.getReturnInfo() = classifyReturnType(FI.getReturnType());
+ for (auto &I : FI.arguments())
+ I.info = classifyArgumentType(I.type);
+ }
Address EmitVAArg(CodeGenFunction &CGF, Address VAListAddr,
QualType Ty) const override;
@@ -4105,8 +4117,13 @@ public:
class PPC32TargetCodeGenInfo : public TargetCodeGenInfo {
public:
- PPC32TargetCodeGenInfo(CodeGenTypes &CGT, bool SoftFloatABI)
- : TargetCodeGenInfo(new PPC32_SVR4_ABIInfo(CGT, SoftFloatABI)) {}
+ PPC32TargetCodeGenInfo(CodeGenTypes &CGT, bool SoftFloatABI,
+ bool RetSmallStructInRegABI)
+ : TargetCodeGenInfo(new PPC32_SVR4_ABIInfo(CGT, SoftFloatABI,
+ RetSmallStructInRegABI)) {}
+
+ static bool isStructReturnInRegABI(const llvm::Triple &Triple,
+ const CodeGenOptions &Opts);
int getDwarfEHStackPointer(CodeGen::CodeGenModule &M) const override {
// This is recovered from gcc output.
@@ -4142,6 +4159,34 @@ CharUnits PPC32_SVR4_ABIInfo::getParamTy
return CharUnits::fromQuantity(4);
}
+ABIArgInfo PPC32_SVR4_ABIInfo::classifyReturnType(QualType RetTy) const {
+ uint64_t Size;
+
+ // -msvr4-struct-return puts small aggregates in GPR3 and GPR4.
+ if (isAggregateTypeForABI(RetTy) && IsRetSmallStructInRegABI &&
+ (Size = getContext().getTypeSize(RetTy)) <= 64) {
+ // System V ABI (1995), page 3-22, specified:
+ // > A structure or union whose size is less than or equal to 8 bytes
+ // > shall be returned in r3 and r4, as if it were first stored in the
+ // > 8-byte aligned memory area and then the low addressed word were
+ // > loaded into r3 and the high-addressed word into r4. Bits beyond
+ // > the last member of the structure or union are not defined.
+ //
+ // GCC for big-endian PPC32 inserts the pad before the first member,
+ // not "beyond the last member" of the struct. To stay compatible
+ // with GCC, we coerce the struct to an integer of the same size.
+ // LLVM will extend it and return i32 in r3, or i64 in r3:r4.
+ if (Size == 0)
+ return ABIArgInfo::getIgnore();
+ else {
+ llvm::Type *CoerceTy = llvm::Type::getIntNTy(getVMContext(), Size);
+ return ABIArgInfo::getDirect(CoerceTy);
+ }
+ }
+
+ return DefaultABIInfo::classifyReturnType(RetTy);
+}
+
// TODO: this implementation is now likely redundant with
// DefaultABIInfo::EmitVAArg.
Address PPC32_SVR4_ABIInfo::EmitVAArg(CodeGenFunction &CGF, Address VAList,
@@ -4299,6 +4344,25 @@ Address PPC32_SVR4_ABIInfo::EmitVAArg(Co
return Result;
}
+bool PPC32TargetCodeGenInfo::isStructReturnInRegABI(
+ const llvm::Triple &Triple, const CodeGenOptions &Opts) {
+ assert(Triple.getArch() == llvm::Triple::ppc);
+
+ switch (Opts.getStructReturnConvention()) {
+ case CodeGenOptions::SRCK_Default:
+ break;
+ case CodeGenOptions::SRCK_OnStack: // -maix-struct-return
+ return false;
+ case CodeGenOptions::SRCK_InRegs: // -msvr4-struct-return
+ return true;
+ }
+
+ if (Triple.isOSBinFormatELF() && !Triple.isOSLinux())
+ return true;
+
+ return false;
+}
+
bool
PPC32TargetCodeGenInfo::initDwarfEHRegSizeTable(CodeGen::CodeGenFunction &CGF,
llvm::Value *Address) const {
@@ -9330,9 +9394,13 @@ const TargetCodeGenInfo &CodeGenModule::
return SetCGInfo(new ARMTargetCodeGenInfo(Types, Kind));
}
- case llvm::Triple::ppc:
+ case llvm::Triple::ppc: {
+ bool RetSmallStructInRegABI =
+ PPC32TargetCodeGenInfo::isStructReturnInRegABI(Triple, CodeGenOpts);
return SetCGInfo(
- new PPC32TargetCodeGenInfo(Types, CodeGenOpts.FloatABI == "soft"));
+ new PPC32TargetCodeGenInfo(Types, CodeGenOpts.FloatABI == "soft",
+ RetSmallStructInRegABI));
+ }
case llvm::Triple::ppc64:
if (Triple.isOSBinFormatELF()) {
PPC64_SVR4_ABIInfo::ABIKind Kind = PPC64_SVR4_ABIInfo::ELFv1;
Index: gnu/llvm/tools/clang/lib/Driver/ToolChains/Clang.cpp
===================================================================
RCS file: /cvs/src/gnu/llvm/tools/clang/lib/Driver/ToolChains/Clang.cpp,v
retrieving revision 1.20
diff -u -p -r1.20 Clang.cpp
--- gnu/llvm/tools/clang/lib/Driver/ToolChains/Clang.cpp 25 Oct 2019
00:40:56 -0000 1.20
+++ gnu/llvm/tools/clang/lib/Driver/ToolChains/Clang.cpp 12 Feb 2020
20:52:35 -0000
@@ -3870,6 +3870,19 @@ void Clang::ConstructJob(Compilation &C,
CmdArgs.push_back(A->getValue());
}
+ if (Arg *A = Args.getLastArg(options::OPT_maix_struct_return,
+ options::OPT_msvr4_struct_return)) {
+ if (TC.getArch() != llvm::Triple::ppc) {
+ D.Diag(diag::err_drv_unsupported_opt_for_target)
+ << A->getSpelling() << RawTriple.str();
+ } else if (A->getOption().matches(options::OPT_maix_struct_return)) {
+ CmdArgs.push_back("-maix-struct-return");
+ } else {
+ assert(A->getOption().matches(options::OPT_msvr4_struct_return));
+ CmdArgs.push_back("-msvr4-struct-return");
+ }
+ }
+
if (Arg *A = Args.getLastArg(options::OPT_fpcc_struct_return,
options::OPT_freg_struct_return)) {
if (TC.getArch() != llvm::Triple::x86) {
Index: gnu/llvm/tools/clang/lib/Frontend/CompilerInvocation.cpp
===================================================================
RCS file: /cvs/src/gnu/llvm/tools/clang/lib/Frontend/CompilerInvocation.cpp,v
retrieving revision 1.4
diff -u -p -r1.4 CompilerInvocation.cpp
--- gnu/llvm/tools/clang/lib/Frontend/CompilerInvocation.cpp 23 Jun 2019
22:05:15 -0000 1.4
+++ gnu/llvm/tools/clang/lib/Frontend/CompilerInvocation.cpp 12 Feb 2020
20:52:35 -0000
@@ -1199,11 +1199,18 @@ static bool ParseCodeGenArgs(CodeGenOpti
Diags.Report(diag::err_drv_invalid_value) << A->getAsString(Args) << Val;
}
- if (Arg *A = Args.getLastArg(OPT_fpcc_struct_return,
OPT_freg_struct_return)) {
- if (A->getOption().matches(OPT_fpcc_struct_return)) {
+ // X86_32 has -fppc-struct-return and -freg-struct-return.
+ // PPC32 has -maix-struct-return and -msvr4-struct-return.
+ if (Arg *A =
+ Args.getLastArg(OPT_fpcc_struct_return, OPT_freg_struct_return,
+ OPT_maix_struct_return, OPT_msvr4_struct_return)) {
+ const Option &O = A->getOption();
+ if (O.matches(OPT_fpcc_struct_return) ||
+ O.matches(OPT_maix_struct_return)) {
Opts.setStructReturnConvention(CodeGenOptions::SRCK_OnStack);
} else {
- assert(A->getOption().matches(OPT_freg_struct_return));
+ assert(O.matches(OPT_freg_struct_return) ||
+ O.matches(OPT_msvr4_struct_return));
Opts.setStructReturnConvention(CodeGenOptions::SRCK_InRegs);
}
}
Index: gnu/usr.bin/clang/libLLVM/shlib_version
===================================================================
RCS file: /cvs/src/gnu/usr.bin/clang/libLLVM/shlib_version,v
retrieving revision 1.2
diff -u -p -r1.2 shlib_version
--- gnu/usr.bin/clang/libLLVM/shlib_version 23 Jun 2019 22:07:38 -0000
1.2
+++ gnu/usr.bin/clang/libLLVM/shlib_version 12 Feb 2020 20:52:41 -0000
@@ -1,2 +1,2 @@
-major=1
+major=2
minor=0
Index: lib/libcxx/shlib_version
===================================================================
RCS file: /cvs/src/lib/libcxx/shlib_version,v
retrieving revision 1.6
diff -u -p -r1.6 shlib_version
--- lib/libcxx/shlib_version 17 Jun 2019 22:28:47 -0000 1.6
+++ lib/libcxx/shlib_version 12 Feb 2020 20:52:46 -0000
@@ -1,2 +1,2 @@
-major=3
+major=4
minor=0
Index: lib/libcxxabi/shlib_version
===================================================================
RCS file: /cvs/src/lib/libcxxabi/shlib_version,v
retrieving revision 1.4
diff -u -p -r1.4 shlib_version
--- lib/libcxxabi/shlib_version 17 Jun 2019 22:28:51 -0000 1.4
+++ lib/libcxxabi/shlib_version 12 Feb 2020 20:52:46 -0000
@@ -1,3 +1,3 @@
# Don't forget to give libc++ the same type of bump!
-major=1
+major=2
minor=0