grub: force bfd linker

This commit is contained in:
Dylan Araps 2021-08-16 12:23:40 +03:00
parent ec257b4682
commit 56871a28f3
No known key found for this signature in database
GPG Key ID: 13295DAC2CF13B5C

View File

@ -15,8 +15,22 @@ done
# Strip '-march' from 'CFLAGS' as per advice from upstream.
# Fixes build fails on specific hardware.
CFLAGS=$(printf %s "$CFLAGS" | sed 's/-march=[^ ]*//g')
CFLAGS=$(printf %s "$CXXFLAGS" | sed 's/-march=[^ ]*//g')
export CFLAGS
CFLAGS=$(printf %s "$CFLAGS" | sed 's/-march=[^ ]*//g')
# Force bfd linker to fix issues with alternative linkers. Mold does not yet
# have full linker script support and I'm not certain that lld or gold have
# ever worked to build Grub.
{
mkdir -p .bin
ln -s "$KISS_ROOT/usr/bin/ld.bfd" .bin/ld
export PATH=$PWD/.bin:$PATH
# Strip '-B<path>mold' and '--ld-path=<path>mold' from CFLAGS.
case $CFLAGS in *mold*)
CFLAGS=$(printf %s "$CFLAGS" | sed 's/-B[^ ]*//g;s/--ld-path=[^ ]*//g')
esac
}
build_grub() (
cd "grub-${1##*=}"