Skip to content

Commit

Permalink
Merge pull request #1498 from hadfl/llvm_18
Browse files Browse the repository at this point in the history
clang 18 should be able to cross compile for aarch64
  • Loading branch information
oetiker authored Aug 2, 2024
2 parents 0463746 + 4f34479 commit eeaa8ab
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 2 deletions.
1 change: 1 addition & 0 deletions build/aarch64/gcc10/local.mog
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@ 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)

24 changes: 23 additions & 1 deletion build/clang/build-18.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,29 @@ XFORM_ARGS="
-DVERSION=$MAJVER
"

post_install() {
for a in "${!TRIPLETS[@]}"; do
cfgfile="$DESTDIR$PREFIX/bin/${TRIPLETS[$a]}.cfg"
if cross_arch $a; then
# TODO: globbing only works reliably as long as we just have
# one cross compiler version per arch.
crossgccver=`pkg_ver $a/gcc*`
crossgccver=${crossgccver%%.*}
cxxinc="$CROSSTOOLS/$a/${TRIPLETS[$a]}/include/c++/$crossgccver"
$CAT << EOF >| $cfgfile
--gcc-install-dir=$CROSSTOOLS/$a/lib/gcc/${TRIPLETS[$a]}/$crossgccver
-stdlib++-isystem$cxxinc
-stdlib++-isystem$cxxinc/${TRIPLETS[$a]}
-stdlib++-isystem$cxxinc/backward
EOF
else
$CAT << EOF >| $cfgfile
--gcc-install-dir=$GCCPATH/lib/gcc/${TRIPLETS[$BUILD_ARCH]}/$DEFAULT_GCC_VER
EOF
fi
done
}

CONFIGURE_OPTS[amd64]=
CONFIGURE_OPTS[amd64_WS]="
-DCMAKE_BUILD_TYPE=Release
Expand All @@ -70,7 +93,6 @@ CONFIGURE_OPTS[amd64_WS]="
-DCMAKE_CXX_COMPILER=\"$CXX\"
-DCMAKE_C_LINK_FLAGS=\"${LDFLAGS[amd64]}\"
-DCMAKE_CXX_LINK_FLAGS=\"${LDFLAGS[amd64]}\"
-DGCC_INSTALL_PREFIX=\"$GCCPATH\"
-DCLANG_VENDOR=\"$DISTRO/$RELVER\"
-DCLANG_DEFAULT_RTLIB=libgcc
-DCLANG_DEFAULT_CXX_STDLIB=libstdc++
Expand Down
5 changes: 4 additions & 1 deletion build/clang/local.mog
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# http://www.illumos.org/license/CDDL.
#

# Copyright 2023 OmniOS Community Edition (OmniOSce) Association.
# Copyright 2024 OmniOS Community Edition (OmniOSce) Association.

# Skip dependency resolution for python components
<transform file path=$(PREFIX)/share/$(PROG)/.*\.py$ \
Expand All @@ -31,5 +31,8 @@ link path=$(OPREFIX)/bin/$(PROG)++-$(VERSION) target=../$(PKGROOT)/bin/$(PROG)++
<transform path=.*/s?bin/[^/]+-$(VERSION)$ -> delete mediator .>
<transform path=.*/s?bin/[^/]+-$(VERSION)$ -> delete mediator-version .>

# drop config symlinks
<transform link path=$(OPREFIX)/bin/.+\.cfg$ -> drop>

license LICENSE.TXT license=Apache2

17 changes: 17 additions & 0 deletions build/llvm/patches-18/aarch64-eh_frame-ro.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Ensure .eh_frame is consistently read-only for aarch64

diff -wpruN --no-dereference '--exclude=*.orig' a~/lib/MC/MCObjectFileInfo.cpp a/lib/MC/MCObjectFileInfo.cpp
--- a~/lib/MC/MCObjectFileInfo.cpp 1970-01-01 00:00:00
+++ a/lib/MC/MCObjectFileInfo.cpp 1970-01-01 00:00:00
@@ -381,8 +381,10 @@ void MCObjectFileInfo::initELFMCObjectFi
// Solaris requires different flags for .eh_frame to seemingly every other
// platform.
unsigned EHSectionFlags = ELF::SHF_ALLOC;
- if (T.isOSSolaris() && T.getArch() != Triple::x86_64)
+ if (T.isOSSolaris() && T.getArch() != Triple::x86_64 &&
+ T.getArch() != Triple::aarch64) {
EHSectionFlags |= ELF::SHF_WRITE;
+ }

// ELF
BSSSection = Ctx->getELFSection(".bss", ELF::SHT_NOBITS,
1 change: 1 addition & 0 deletions build/llvm/patches-18/series
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
aarch64-eh_frame-ro.patch

0 comments on commit eeaa8ab

Please sign in to comment.