Skip to content

Commit

Permalink
Merge pull request #1558 from hadfl/aarch64_gcc14
Browse files Browse the repository at this point in the history
  • Loading branch information
citrus-it authored Jan 1, 2025
2 parents 11952d1 + 518699b commit 24e0b58
Show file tree
Hide file tree
Showing 46 changed files with 485 additions and 250 deletions.
6 changes: 3 additions & 3 deletions build/aarch64/binutils/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ SUMMARY="GNU binary utilities ($ARCH target)"
DESC="A set of programming tools for creating and managing binary programs, "
DESC+="object files, libraries, etc."

# does not yet build with gcc 14
((GCCVER > 13)) && set_gccver 13

REPO=$GITHUB/richlowe/$PROG
BRANCH=illumos-arm64-${VER/./-}

set_arch 64
# Needed for X/Open curses/termcap
set_standard -xcurses XPG6 CFLAGS

CTF_FLAGS+=" -s"

XFORM_ARGS="
Expand Down
4 changes: 1 addition & 3 deletions build/aarch64/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
ARCH=aarch64
NATIVE_TRIPLET64=${TRIPLETS[$BUILD_ARCH]}
TRIPLET64=${TRIPLETS[$ARCH]}
CROSSGCCVER=10

min_rel 151045
CROSSGCCVER=14

PREFIX=/opt/cross/$ARCH
SYSROOT=$PREFIX/sysroot
Expand Down
12 changes: 7 additions & 5 deletions build/aarch64/gcc10/build.sh → build/aarch64/gcc14/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
# }}}
#
# Copyright 2014 OmniTI Computer Consulting, Inc. All rights reserved.
# Copyright 2022 OmniOS Community Edition (OmniOSce) Association.
# Copyright 2024 OmniOS Community Edition (OmniOSce) Association.

. ../common.sh

PKG=ooce/developer/aarch64-gcc10
PKG=ooce/developer/aarch64-gcc14
PROG=gcc
VER=10.4.0
VER=14.2.0
ILVER=il-1
SUMMARY="gcc $VER-$ILVER ($ARCH)"
DESC="The GNU Compiler Collection"
Expand Down Expand Up @@ -50,7 +50,7 @@ set_ssp none
# building and putting the 32/64 objects in the right places. We also want
# to unset all of the flags that we usually pass for a 64-bit object so that
# gcc can properly create the multilib targets.
CONFIGURE_OPTS[amd64]="$CONFIGURE_OPTS[i386]"
CONFIGURE_OPTS[amd64]="${CONFIGURE_OPTS[i386]}"
clear_archflags

# Use bash for all shells - some corruption occurs in libstdc++-v3/config.status
Expand All @@ -74,7 +74,7 @@ export LD_FOR_TARGET=$PREFIX/bin/ld
export AS_FOR_TARGET=$PREFIX/bin/$TRIPLET64-as
export CFLAGS_FOR_TARGET="-mno-outline-atomics -mtls-dialect=trad"
export CXXFLAGS_FOR_TARGET="-mno-outline-atomics -mtls-dialect=trad"
export STRIP="/usr/bin/strip -x"
export STRIP="$STRIP -x"
export STRIP_FOR_TARGET="$STRIP"

HARDLINK_TARGETS="
Expand All @@ -94,6 +94,8 @@ PKGDIFF_HELPER="
CONFIGURE_OPTS=
CONFIGURE_OPTS[amd64]+="
--prefix=$PREFIX
--with-toolexeclibdir=$PREFIX/lib
--with-gxx-include-dir=$PREFIX/include/c++/$VER
--host $NATIVE_TRIPLET64
--build $NATIVE_TRIPLET64
--target $TRIPLET64
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,9 @@ license COPYING3.LIB license=LGPLv3
set pkg.depend.bypass-generate .*libm\.so\.0$>

link path=$(PREFIX)/lib/gcc/$(TRIPLET64)/$(MAJOR) target=$(GCCVER)
link path=$(PREFIX)/$(TRIPLET64)/include/c++/$(MAJOR) target=$(GCCVER)
link path=$(PREFIX)/include/c++/$(MAJOR) target=$(GCCVER)

# links for gcc as it looks under <TRIPLET> when cross-compiling
link path=$(PREFIX)/$(TRIPLET64)/lib target=../lib
link path=$(PREFIX)/$(TRIPLET64)/include target=../include

41 changes: 16 additions & 25 deletions build/aarch64/sysroot/files/aarch64.env
Original file line number Diff line number Diff line change
Expand Up @@ -81,46 +81,37 @@ export CODEMGR_WS="`git rev-parse --show-toplevel`"
#

# OmniOS, etc.
if [[ -d /opt/gcc-7 ]]; then
export sparc_GNUC_ROOT=/opt/gcc-7
export i386_GNUC_ROOT=/opt/gcc-7
if [[ -d /opt/gcc-10 ]]; then
export i386_GNUC_ROOT=/opt/gcc-10
# OpenIndiana etc.
elif [[ -d /usr/gcc/7 ]]; then
export sparc_GNUC_ROOT=/usr/gcc/7
export i386_GNUC_ROOT=/usr/gcc/7
elif [[ -d /usr/gcc/10 ]]; then
export i386_GNUC_ROOT=/usr/gcc/10
else
print -u2 "I can't work out where your native GCC 7 is!"
print -u2 "I can't work out where your native GCC 10 is!"
exit 2
fi

# OmniOS, etc.
if [[ -d /opt/gcc-10 ]]; then
export sparc_GNUC_10_ROOT=/opt/gcc-10
export i386_GNUC_10_ROOT=/opt/gcc-10
if [[ -d /opt/gcc-14 ]]; then
export i386_GNUC_14_ROOT=/opt/gcc-14
# OpenIndiana etc.
elif [[ -d /usr/gcc/10 ]]; then
export sparc_GNUC_10_ROOT=/usr/gcc/10
export i386_GNUC_10_ROOT=/usr/gcc/10
elif [[ -d /usr/gcc/14 ]]; then
export i386_GNUC_10_ROOT=/usr/gcc/14
else
print -u2 "I can't work out where your native GCC 10 is!"
print -u2 "I can't work out where your native GCC 14 is!"
exit 2
fi

export CROSS_TRIPLET=aarch64-unknown-solaris2.11

export sparc_PRIMARY_CC=gcc7,$sparc_GNUC_ROOT/bin/gcc,gnu
export sparc_PRIMARY_CCC=gcc7,$sparc_GNUC_ROOT/bin/g++,gnu
export sparc_SHADOW_CCS=gcc10,$sparc_GNUC_10_ROOT/bin/gcc,gnu
export sparc_SHADOW_CCCS=gcc10,$sparc_GNUC_10_ROOT/bin/g++,gnu

export i386_PRIMARY_CC=gcc7,$i386_GNUC_ROOT/bin/gcc,gnu
export i386_PRIMARY_CCC=gcc7,$i386_GNUC_ROOT/bin/g++,gnu
export i386_SHADOW_CCS=gcc10,$i386_GNUC_10_ROOT/bin/gcc,gnu
export i386_SHADOW_CCCS=gcc10,$i386_GNUC_10_ROOT/bin/g++,gnu
export i386_PRIMARY_CC=gcc10,$i386_GNUC_ROOT/bin/gcc,gnu
export i386_PRIMARY_CCC=gcc10,$i386_GNUC_ROOT/bin/g++,gnu
export i386_SHADOW_CCS=gcc14,$i386_GNUC_14_ROOT/bin/gcc,gnu
export i386_SHADOW_CCCS=gcc14,$i386_GNUC_14_ROOT/bin/g++,gnu

export aarch64_GNUC_ROOT=$PREFIX
export aarch64_PRIMARY_CC=gcc10,$aarch64_GNUC_ROOT/bin/gcc,gnu
export aarch64_PRIMARY_CCC=gcc10,$aarch64_GNUC_ROOT/bin/g++,gnu
export aarch64_PRIMARY_CC=gcc14,$aarch64_GNUC_ROOT/bin/gcc,gnu
export aarch64_PRIMARY_CCC=gcc14,$aarch64_GNUC_ROOT/bin/g++,gnu

export AW_aarch64_AS_DIR=$PREFIX/bin
export AW_aarch64_AS64_DIR=$PREFIX/bin
Expand Down
1 change: 1 addition & 0 deletions build/apr/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ CONFIGURE_OPTS[amd64]+="
CONFIGURE_OPTS[aarch64]+="
--with-installbuilddir=$PREFIX/share/apr/aarch64/build-1
ac_cv_file__dev_zero=yes
ac_cv_strerror_r_rc_int=yes
apr_cv_process_shared_works=yes
apr_cv_mutex_robust_shared=yes
apr_cv_tcp_nodelay_with_cork=yes
Expand Down
2 changes: 1 addition & 1 deletion build/bdb/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ pre_configure() {

init
download_source $PROG db $VER
patch_source
EXTRACTED_SRC=db-$VER patch_source
prep_build
build
make_package
Expand Down
21 changes: 21 additions & 0 deletions build/bdb/patches/aarch64.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
diff -wpruN --no-dereference '--exclude=*.orig' a~/dist/configure a/dist/configure
--- a~/dist/configure 1970-01-01 00:00:00
+++ a/dist/configure 1970-01-01 00:00:00
@@ -22485,6 +22485,7 @@ if test "$db_cv_atomic" = no; then
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */

+#include <stdlib.h>
#include <sys/atomic.h>
int
main ()
@@ -24192,6 +24193,9 @@ $as_echo_n "checking for 64-bit integral
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */

+#include <stdio.h>
+#include <strings.h>
+
int
main ()
{
1 change: 1 addition & 0 deletions build/bdb/patches/series
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
aarch64.patch
3 changes: 0 additions & 3 deletions build/clang/build-18.sh
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,6 @@ post_install() {
$CAT << EOF >| $cfgfile
--gcc-install-dir=$CROSSTOOLS/$a/lib/gcc/${TRIPLETS[$a]}/$crossgccver
-fuse-ld=$CROSSTOOLS/$a/bin/ld
-stdlib++-isystem$cxxinc
-stdlib++-isystem$cxxinc/${TRIPLETS[$a]}
-stdlib++-isystem$cxxinc/backward
EOF
else
$CAT << EOF >| $cfgfile
Expand Down
3 changes: 0 additions & 3 deletions build/clang/build-19.sh
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,6 @@ post_install() {
$CAT << EOF >| $cfgfile
--gcc-install-dir=$CROSSTOOLS/$a/lib/gcc/${TRIPLETS[$a]}/$crossgccver
-fuse-ld=$CROSSTOOLS/$a/bin/ld
-stdlib++-isystem$cxxinc
-stdlib++-isystem$cxxinc/${TRIPLETS[$a]}
-stdlib++-isystem$cxxinc/backward
EOF
else
$CAT << EOF >| $cfgfile
Expand Down
14 changes: 14 additions & 0 deletions build/clang/patches-18/aarch64-target-support.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
diff -wpruN --no-dereference '--exclude=*.orig' a~/lib/Basic/Targets.cpp a/lib/Basic/Targets.cpp
--- a~/lib/Basic/Targets.cpp 1970-01-01 00:00:00
+++ a/lib/Basic/Targets.cpp 1970-01-01 00:00:00
@@ -160,6 +160,10 @@ std::unique_ptr<TargetInfo> AllocateTarg
return std::make_unique<OHOSTargetInfo<AArch64leTargetInfo>>(Triple,
Opts);
}
+
+ case llvm::Triple::Solaris:
+ return std::make_unique<SolarisTargetInfo<AArch64leTargetInfo>>(Triple,
+ Opts);
case llvm::Triple::NetBSD:
return std::make_unique<NetBSDTargetInfo<AArch64leTargetInfo>>(Triple,
Opts);
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ diff -wpruN --no-dereference '--exclude=*.orig' a~/lib/Basic/Targets/OSTargets.h
+ // Compatibility with GCC to satisfy <sys/feature_tests.h> requirements.
if (Opts.CPlusPlus) {
- Builder.defineMacro("__C99FEATURES__");
+ Builder.defineMacro("__STDC_VERSION__", "199901L");
+ Builder.defineMacro("__STDC_VERSION__", "201112L");
+ Builder.defineMacro("_XOPEN_SOURCE", "600");
Builder.defineMacro("_FILE_OFFSET_BITS", "64");
- }
Expand Down
1 change: 1 addition & 0 deletions build/clang/patches-18/series
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ default-preprocessor-definition.patch
add-rpath-for-libstdcxx.patch
no-sanitizer-runtime-lib-linking.patch
add-__illumos__-preprocessor-definition.patch
aarch64-target-support.patch
14 changes: 14 additions & 0 deletions build/clang/patches-19/aarch64-target-support.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
diff -wpruN --no-dereference '--exclude=*.orig' a~/lib/Basic/Targets.cpp a/lib/Basic/Targets.cpp
--- a~/lib/Basic/Targets.cpp 1970-01-01 00:00:00
+++ a/lib/Basic/Targets.cpp 1970-01-01 00:00:00
@@ -160,6 +160,10 @@ std::unique_ptr<TargetInfo> AllocateTarg
return std::make_unique<OHOSTargetInfo<AArch64leTargetInfo>>(Triple,
Opts);
}
+
+ case llvm::Triple::Solaris:
+ return std::make_unique<SolarisTargetInfo<AArch64leTargetInfo>>(Triple,
+ Opts);
case llvm::Triple::NetBSD:
return std::make_unique<NetBSDTargetInfo<AArch64leTargetInfo>>(Triple,
Opts);
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
diff -wpruN --no-dereference '--exclude=*.orig' a~/lib/Basic/Targets/OSTargets.h a/lib/Basic/Targets/OSTargets.h
--- a~/lib/Basic/Targets/OSTargets.h 1970-01-01 00:00:00
+++ a/lib/Basic/Targets/OSTargets.h 1970-01-01 00:00:00
@@ -590,6 +590,7 @@ protected:
@@ -594,6 +594,7 @@ protected:
void getOSDefines(const LangOptions &Opts, const llvm::Triple &Triple,
MacroBuilder &Builder) const override {
DefineStd(Builder, "sun", Opts);
Expand Down
8 changes: 4 additions & 4 deletions build/clang/patches-19/add-rpath-for-libstdcxx.patch
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
diff -wpruN --no-dereference '--exclude=*.orig' a~/lib/Driver/ToolChain.cpp a/lib/Driver/ToolChain.cpp
--- a~/lib/Driver/ToolChain.cpp 1970-01-01 00:00:00
+++ a/lib/Driver/ToolChain.cpp 1970-01-01 00:00:00
@@ -1233,9 +1233,7 @@ void ToolChain::AddClangCXXStdlibIsystem
@@ -1280,9 +1280,7 @@ void ToolChain::AddClangCXXStdlibIsystem
}

bool ToolChain::ShouldLinkCXXStdlib(const llvm::opt::ArgList &Args) const {
Expand All @@ -15,7 +15,7 @@ diff -wpruN --no-dereference '--exclude=*.orig' a~/lib/Driver/ToolChain.cpp a/li
diff -wpruN --no-dereference '--exclude=*.orig' a~/lib/Driver/ToolChains/Solaris.cpp a/lib/Driver/ToolChains/Solaris.cpp
--- a~/lib/Driver/ToolChains/Solaris.cpp 1970-01-01 00:00:00
+++ a/lib/Driver/ToolChains/Solaris.cpp 1970-01-01 00:00:00
@@ -207,6 +207,9 @@ void solaris::Linker::ConstructJob(Compi
@@ -206,6 +206,9 @@ void solaris::Linker::ConstructJob(Compi
bool NeedsSanitizerDeps = addSanitizerRuntimes(ToolChain, Args, CmdArgs);
AddLinkerInputs(ToolChain, Inputs, Args, CmdArgs, JA);

Expand All @@ -25,8 +25,8 @@ diff -wpruN --no-dereference '--exclude=*.orig' a~/lib/Driver/ToolChains/Solaris
if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs,
options::OPT_r)) {
// Use the static OpenMP runtime with -static-openmp
@@ -215,8 +218,6 @@ void solaris::Linker::ConstructJob(Compi
addOpenMPRuntime(CmdArgs, ToolChain, Args, StaticOpenMP);
@@ -214,8 +217,6 @@ void solaris::Linker::ConstructJob(Compi
addOpenMPRuntime(C, CmdArgs, ToolChain, Args, StaticOpenMP);

if (D.CCCIsCXX()) {
- if (ToolChain.ShouldLinkCXXStdlib(Args))
Expand Down
4 changes: 2 additions & 2 deletions build/clang/patches-19/default-preprocessor-definition.patch
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Sync SunOS default defines with a working reality.
diff -wpruN --no-dereference '--exclude=*.orig' a~/lib/Basic/Targets/OSTargets.h a/lib/Basic/Targets/OSTargets.h
--- a~/lib/Basic/Targets/OSTargets.h 1970-01-01 00:00:00
+++ a/lib/Basic/Targets/OSTargets.h 1970-01-01 00:00:00
@@ -593,22 +593,15 @@ protected:
@@ -597,22 +597,15 @@ protected:
DefineStd(Builder, "unix", Opts);
Builder.defineMacro("__svr4__");
Builder.defineMacro("__SVR4");
Expand All @@ -20,7 +20,7 @@ diff -wpruN --no-dereference '--exclude=*.orig' a~/lib/Basic/Targets/OSTargets.h
+ // Compatibility with GCC to satisfy <sys/feature_tests.h> requirements.
if (Opts.CPlusPlus) {
- Builder.defineMacro("__C99FEATURES__");
+ Builder.defineMacro("__STDC_VERSION__", "199901L");
+ Builder.defineMacro("__STDC_VERSION__", "201112L");
+ Builder.defineMacro("_XOPEN_SOURCE", "600");
Builder.defineMacro("_FILE_OFFSET_BITS", "64");
- }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
diff -wpruN --no-dereference '--exclude=*.orig' a~/lib/Driver/ToolChains/CommonArgs.cpp a/lib/Driver/ToolChains/CommonArgs.cpp
--- a~/lib/Driver/ToolChains/CommonArgs.cpp 1970-01-01 00:00:00
+++ a/lib/Driver/ToolChains/CommonArgs.cpp 1970-01-01 00:00:00
@@ -1366,6 +1366,9 @@ void tools::addAsNeededOption(const Tool
@@ -1360,6 +1360,9 @@ void tools::addAsNeededOption(const Tool
void tools::linkSanitizerRuntimeDeps(const ToolChain &TC,
const llvm::opt::ArgList &Args,
ArgStringList &CmdArgs) {
Expand Down
2 changes: 1 addition & 1 deletion build/clang/patches-19/no-ssp-linking.patch
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
diff -wpruN --no-dereference '--exclude=*.orig' a~/lib/Driver/ToolChains/Solaris.cpp a/lib/Driver/ToolChains/Solaris.cpp
--- a~/lib/Driver/ToolChains/Solaris.cpp 1970-01-01 00:00:00
+++ a/lib/Driver/ToolChains/Solaris.cpp 1970-01-01 00:00:00
@@ -229,13 +229,6 @@ void solaris::Linker::ConstructJob(Compi
@@ -228,13 +228,6 @@ void solaris::Linker::ConstructJob(Compi
addFortranRuntimeLibs(getToolChain(), Args, CmdArgs);
CmdArgs.push_back("-lm");
}
Expand Down
1 change: 1 addition & 0 deletions build/clang/patches-19/series
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ default-preprocessor-definition.patch
add-rpath-for-libstdcxx.patch
no-sanitizer-runtime-lib-linking.patch
add-__illumos__-preprocessor-definition.patch
aarch64-target-support.patch
Loading

0 comments on commit 24e0b58

Please sign in to comment.