Fix OP-TEE build on older toolchains (Ubuntu Jammy)

Check if linker supports --no-warn-rwx-segments flag before using it.
Older binutils versions in ubuntu:jammy don't recognize this flag.
This commit is contained in:
TuAFBogey 2026-01-15 07:43:17 +03:00 committed by Igor
parent 1a95f44062
commit bc871ca243

View File

@ -115,6 +115,13 @@ function uboot_custom_postprocess() {
local cross_compile="aarch64-linux-gnu-"
# Check if linker supports --no-warn-rwx-segments (binutils 2.39+)
# Workaround for ubuntu:jammy older toolchain
local ldflags=""
if ${cross_compile}ld --help 2>&1 | grep -q "no-warn-rwx-segments"; then
ldflags="--no-warn-rwx-segments"
fi
run_host_command_logged make -C "${optee_src_dir}" clean PLATFORM=nuvoton-MA35D1 2>/dev/null || true
display_alert "Building OP-TEE" "PLATFORM=nuvoton-MA35D1" "info"
@ -124,7 +131,7 @@ function uboot_custom_postprocess() {
PLATFORM=nuvoton-MA35D1 \
CFG_ARM64_core=y \
CFG_TEE_CORE_LOG_LEVEL=1 \
LDFLAGS="--no-warn-rwx-segments" \
LDFLAGS="${ldflags}" \
NOWERROR=1 \
-j$(nproc)