73 lines
2.3 KiB
Bash
73 lines
2.3 KiB
Bash
#!/bin/sh
|
|
# Copyright (c) 2015-2021 Solo5 Contributors
|
|
# Copyright (c) 2024 Romain Calascibetta
|
|
#
|
|
# This file is part of Gilbraltar, a bare-metal OS for RaspBerry Pi 5.
|
|
#
|
|
# Permission to use, copy, modify, and/or distribute this software
|
|
# for any purpose with or without fee is hereby granted, provided
|
|
# that the above copyright notice and this permission notice appear
|
|
# in all copies.
|
|
#
|
|
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
|
|
# WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
|
|
# WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
|
|
# AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
|
|
# CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
|
# OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
|
|
# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
|
# CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
# @@CONFIG_TARGET_TRIPLE@@-ld: Gilbraltar wrapper for 'ld'.
|
|
# Generated by configure.sh at build time.
|
|
#
|
|
# Passes through to @@CONFIG_TARGET_LD@ for actual work. Defines all flags
|
|
# required for correct operation when linking code intended for inclusion in a
|
|
# Gilbraltar operating system.
|
|
#
|
|
# Provides a '-z gilbraltar-abi=ABI' option to select the RPi4 bindings to use
|
|
# if linking. No default for ABI is provided, as it is expected that a caller
|
|
# directly using 'ld' knows what they are doing.
|
|
|
|
L="$(dirname $0)/../../lib/@@CONFIG_TARGET_TRIPLE@@"
|
|
[ ! -d "${L}" ] && echo "$0: Could not determine library path" 1>&2 && exit 1
|
|
# ld accepts -z gilbraltar-abi=ABI, but does not provide a default ABI
|
|
# this is intentional
|
|
B=
|
|
Z=
|
|
for arg do
|
|
shift
|
|
if [ -n "${Z}" ]; then
|
|
# handle -z linker-arg
|
|
Z=
|
|
case "$arg" in
|
|
gilbraltar-abi=*)
|
|
B="${arg##*=}"
|
|
continue
|
|
;;
|
|
*)
|
|
set -- "$@" "-z" "$arg"
|
|
continue
|
|
;;
|
|
esac
|
|
fi
|
|
|
|
case "$arg" in
|
|
-z)
|
|
if [ -z "${Z}" ]; then
|
|
Z=1
|
|
continue
|
|
fi
|
|
;;
|
|
esac
|
|
set -- "$@" "$arg"
|
|
done
|
|
[ -n "${B}" ] && B="-T $gilbraltar.ld -lgilbraltar"
|
|
[ -n "${__V}" ] && set -x
|
|
exec @@CONFIG_TARGET_LD@@ \
|
|
@@CONFIG_TARGET_LD_LDFLAGS@@ \
|
|
-nostdlib \
|
|
-L ${L} \
|
|
-static \
|
|
${B} \
|
|
"$@"
|