git: 3dd789ff4ac3 - main - devel/freebsd-sysroot: Add -mno-relax to the riscv64 wrapper scripts

From: Tobias Kortkamp <tobik_at_FreeBSD.org>
Date: Sat, 13 Nov 2021 09:42:40 UTC
The branch main has been updated by tobik:

URL: https://cgit.FreeBSD.org/ports/commit/?id=3dd789ff4ac3db21c9fde387acd5ba832989380a

commit 3dd789ff4ac3db21c9fde387acd5ba832989380a
Author:     Tobias Kortkamp <tobik@FreeBSD.org>
AuthorDate: 2021-11-09 13:21:20 +0000
Commit:     Tobias Kortkamp <tobik@FreeBSD.org>
CommitDate: 2021-11-13 09:08:42 +0000

    devel/freebsd-sysroot: Add -mno-relax to the riscv64 wrapper scripts
    
    $ FREEBSD_SYSROOT_CC=clang13 /usr/local/freebsd-sysroot/riscv64/bin/cc test.c
    ld: error: test.c:(.text+0x0): relocation R_RISCV_ALIGN requires unimplemented linker relaxation; recompile with -mno-relax
    
    On riscv64 base clang defaults to -mno-relax (per D25210). This
    patch has not been applied to ports LLVM. In the wrapper scripts
    pass -mno-relax explicitly to make it work as expected when
    FREEBSD_SYSROOT_CC is set to ports clang.
---
 devel/freebsd-sysroot/Makefile             | 2 +-
 devel/freebsd-sysroot/files/riscv64-c++.in | 4 ++++
 devel/freebsd-sysroot/files/riscv64-cc.in  | 4 ++++
 3 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/devel/freebsd-sysroot/Makefile b/devel/freebsd-sysroot/Makefile
index 151257f4b7fd..cae92c98e281 100644
--- a/devel/freebsd-sysroot/Makefile
+++ b/devel/freebsd-sysroot/Makefile
@@ -1,5 +1,5 @@
 PORTNAME=	freebsd-sysroot
-DISTVERSION=	a2021-09-14
+DISTVERSION=	a2021-11-09
 CATEGORIES=	devel
 MASTER_SITES=	LOCAL/tobik:${FLAVOR} \
 		${_SYSROOT_DIST:@f@https://download.freebsd.org/ftp/$f?dummy=/:${FLAVOR}@}
diff --git a/devel/freebsd-sysroot/files/riscv64-c++.in b/devel/freebsd-sysroot/files/riscv64-c++.in
new file mode 100644
index 000000000000..6148593cb1b0
--- /dev/null
+++ b/devel/freebsd-sysroot/files/riscv64-c++.in
@@ -0,0 +1,4 @@
+#!/bin/sh
+: ${FREEBSD_SYSROOT_CXX:="%%FREEBSD_SYSROOT_CXX%%"}
+: ${FREEBSD_SYSROOT:="%%FREEBSD_SYSROOT%%"}
+exec "${FREEBSD_SYSROOT_CXX}" --sysroot="${FREEBSD_SYSROOT}" --target=%%FREEBSD_SYSROOT_LLVM_TRIPLE%% --stdlib=libc++ -mno-relax "$@"
diff --git a/devel/freebsd-sysroot/files/riscv64-cc.in b/devel/freebsd-sysroot/files/riscv64-cc.in
new file mode 100644
index 000000000000..8777c34d30f3
--- /dev/null
+++ b/devel/freebsd-sysroot/files/riscv64-cc.in
@@ -0,0 +1,4 @@
+#!/bin/sh
+: ${FREEBSD_SYSROOT_CC:="%%FREEBSD_SYSROOT_CC%%"}
+: ${FREEBSD_SYSROOT:="%%FREEBSD_SYSROOT%%"}
+exec "${FREEBSD_SYSROOT_CC}" --sysroot="${FREEBSD_SYSROOT}" --target=%%FREEBSD_SYSROOT_LLVM_TRIPLE%% -mno-relax "$@"