mirror of
https://git.savannah.gnu.org/git/grub.git
synced 2026-10-24 16:19:22 +00:00
Discover partial linking arguments dynamically.
clang for android doesn't work with -Wl,-r,-d without -static.
This commit is contained in:
1 parent
69743d7d1b
commit
f0cdef6ef5
5 files changed
+30
-10
No files matched your search
@@ -41,7 +41,7 @@ CCASFLAGS_KERNEL = $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM)
|
|||||||
STRIPFLAGS_KERNEL = -R .rel.dyn -R .reginfo -R .note -R .comment -R .drectve -R .note.gnu.gold-version -R .MIPS.abiflags -R .ARM.exidx
|
STRIPFLAGS_KERNEL = -R .rel.dyn -R .reginfo -R .note -R .comment -R .drectve -R .note.gnu.gold-version -R .MIPS.abiflags -R .ARM.exidx
|
||||||
|
|
||||||
CFLAGS_MODULE = $(CFLAGS_PLATFORM) -ffreestanding
|
CFLAGS_MODULE = $(CFLAGS_PLATFORM) -ffreestanding
|
||||||
LDFLAGS_MODULE = $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) -Wl,-r,-d
|
LDFLAGS_MODULE = $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) $(TARGET_INCREMENTAL_LINK)
|
||||||
CPPFLAGS_MODULE = $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM)
|
CPPFLAGS_MODULE = $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM)
|
||||||
CCASFLAGS_MODULE = $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM)
|
CCASFLAGS_MODULE = $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM)
|
||||||
|
|
||||||
|
|||||||
@@ -900,6 +900,25 @@ if test x"$target_cpu" = xsparc64 ; then
|
|||||||
TARGET_LDFLAGS="$TARGET_LDFLAGS $grub_cv_target_cc_mno_relax"
|
TARGET_LDFLAGS="$TARGET_LDFLAGS $grub_cv_target_cc_mno_relax"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
AC_CACHE_CHECK([for incremental link options], grub_cv_target_cc_incremental_link, [
|
||||||
|
grub_cv_target_cc_incremental_link=no
|
||||||
|
for cand in "-Wl,-r,-d" "-static -Wl,-r,-d"; do
|
||||||
|
#AC_LINK_IFELSE doesn't handle non-executable output correctly
|
||||||
|
echo > conftest_inclink.c
|
||||||
|
if $TARGET_CC -o /dev/null $TARGET_CFLAGS $TARGET_CPPFLAGS $TARGET_LDFLAGS -nostdlib -Werror $cand conftest_inclink.c >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
|
||||||
|
grub_cv_target_cc_incremental_link="$cand"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
])
|
||||||
|
|
||||||
|
if test x"$grub_cv_target_cc_incremental_link" = xno ; then
|
||||||
|
AC_MSG_ERROR([could not find incremental link options])
|
||||||
|
fi
|
||||||
|
|
||||||
|
TARGET_INCREMENTAL_LINK="$grub_cv_target_cc_incremental_link"
|
||||||
|
AC_SUBST(TARGET_INCREMENTAL_LINK)
|
||||||
|
|
||||||
# By default, GCC 4.4 generates .eh_frame sections containing unwind
|
# By default, GCC 4.4 generates .eh_frame sections containing unwind
|
||||||
# information in some cases where it previously did not. GRUB doesn't need
|
# information in some cases where it previously did not. GRUB doesn't need
|
||||||
# these and they just use up vital space. Restore the old compiler
|
# these and they just use up vital space. Restore the old compiler
|
||||||
|
|||||||
@@ -49,20 +49,20 @@ kernel = {
|
|||||||
|
|
||||||
nostrip = emu;
|
nostrip = emu;
|
||||||
|
|
||||||
emu_ldflags = '-Wl,-r,-d';
|
emu_ldflags = '$(TARGET_INCREMENTAL_LINK)';
|
||||||
i386_efi_ldflags = '-Wl,-r,-d';
|
i386_efi_ldflags = '$(TARGET_INCREMENTAL_LINK)';
|
||||||
i386_efi_stripflags = '--strip-unneeded -K start -R .note -R .comment -R .note.gnu.gold-version';
|
i386_efi_stripflags = '--strip-unneeded -K start -R .note -R .comment -R .note.gnu.gold-version';
|
||||||
x86_64_efi_ldflags = '-Wl,-r,-d';
|
x86_64_efi_ldflags = '$(TARGET_INCREMENTAL_LINK)';
|
||||||
x86_64_efi_stripflags = '--strip-unneeded -K start -R .note -R .comment -R .note.gnu.gold-version';
|
x86_64_efi_stripflags = '--strip-unneeded -K start -R .note -R .comment -R .note.gnu.gold-version';
|
||||||
|
|
||||||
ia64_efi_cflags = '-fno-builtin -fpic -minline-int-divide-max-throughput';
|
ia64_efi_cflags = '-fno-builtin -fpic -minline-int-divide-max-throughput';
|
||||||
ia64_efi_ldflags = '-Wl,-r,-d';
|
ia64_efi_ldflags = '$(TARGET_INCREMENTAL_LINK)';
|
||||||
ia64_efi_stripflags = '--strip-unneeded -K start -R .note -R .comment -R .note.gnu.gold-version';
|
ia64_efi_stripflags = '--strip-unneeded -K start -R .note -R .comment -R .note.gnu.gold-version';
|
||||||
|
|
||||||
arm_efi_ldflags = '-Wl,-r,-d';
|
arm_efi_ldflags = '$(TARGET_INCREMENTAL_LINK)';
|
||||||
arm_efi_stripflags = '--strip-unneeded -K start -R .note -R .comment -R .note.gnu.gold-version';
|
arm_efi_stripflags = '--strip-unneeded -K start -R .note -R .comment -R .note.gnu.gold-version';
|
||||||
|
|
||||||
arm64_efi_ldflags = '-Wl,-r,-d';
|
arm64_efi_ldflags = '$(TARGET_INCREMENTAL_LINK)';
|
||||||
arm64_efi_stripflags = '--strip-unneeded -K start -R .note -R .comment -R .note.gnu.gold-version -R .eh_frame';
|
arm64_efi_stripflags = '--strip-unneeded -K start -R .note -R .comment -R .note.gnu.gold-version -R .eh_frame';
|
||||||
|
|
||||||
i386_pc_ldflags = '$(TARGET_IMG_LDFLAGS)';
|
i386_pc_ldflags = '$(TARGET_IMG_LDFLAGS)';
|
||||||
@@ -90,7 +90,7 @@ kernel = {
|
|||||||
i386_qemu_cppflags = '-DGRUB_BOOT_MACHINE_LINK_ADDR=$(GRUB_BOOT_MACHINE_LINK_ADDR)';
|
i386_qemu_cppflags = '-DGRUB_BOOT_MACHINE_LINK_ADDR=$(GRUB_BOOT_MACHINE_LINK_ADDR)';
|
||||||
emu_cflags = '$(CFLAGS_GNULIB)';
|
emu_cflags = '$(CFLAGS_GNULIB)';
|
||||||
emu_cppflags = '$(CPPFLAGS_GNULIB)';
|
emu_cppflags = '$(CPPFLAGS_GNULIB)';
|
||||||
arm_uboot_ldflags = '-Wl,-r,-d';
|
arm_uboot_ldflags = '$(TARGET_INCREMENTAL_LINK)';
|
||||||
arm_uboot_stripflags = '--strip-unneeded -K start -R .note -R .comment -R .note.gnu.gold-version';
|
arm_uboot_stripflags = '--strip-unneeded -K start -R .note -R .comment -R .note.gnu.gold-version';
|
||||||
|
|
||||||
i386_pc_startup = kern/i386/pc/startup.S;
|
i386_pc_startup = kern/i386/pc/startup.S;
|
||||||
|
|||||||
@@ -79,9 +79,9 @@ else
|
|||||||
for dep in $deps; do echo "char moddep_$dep[] __attribute__ ((section(\"_moddeps, _moddeps\"))) = \"$dep\";" >>$t2; done
|
for dep in $deps; do echo "char moddep_$dep[] __attribute__ ((section(\"_moddeps, _moddeps\"))) = \"$dep\";" >>$t2; done
|
||||||
|
|
||||||
if test -n "$deps"; then
|
if test -n "$deps"; then
|
||||||
@TARGET_CC@ @TARGET_LDFLAGS@ -ffreestanding -nostdlib -o $tmpfile2 $t1 $t2 $tmpfile -Wl,-r,-d
|
@TARGET_CC@ @TARGET_LDFLAGS@ @TARGET_INCREMENTAL_LINK@ -ffreestanding -nostdlib -o $tmpfile2 $t1 $t2 $tmpfile
|
||||||
else
|
else
|
||||||
@TARGET_CC@ @TARGET_LDFLAGS@ -ffreestanding -nostdlib -o $tmpfile2 $t1 $tmpfile -Wl,-r,-d
|
@TARGET_CC@ @TARGET_LDFLAGS@ @TARGET_INCREMENTAL_LINK@ -ffreestanding -nostdlib -o $tmpfile2 $t1 $tmpfile
|
||||||
fi
|
fi
|
||||||
rm -f $t1 $t2 $tmpfile
|
rm -f $t1 $t2 $tmpfile
|
||||||
mv $tmpfile2 $tmpfile
|
mv $tmpfile2 $tmpfile
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ grub_target_cflags='@TARGET_CFLAGS@'
|
|||||||
grub_target_cppflags='@TARGET_CPPFLAGS@'
|
grub_target_cppflags='@TARGET_CPPFLAGS@'
|
||||||
grub_target_ccasflags='@TARGET_CCASFLAGS@'
|
grub_target_ccasflags='@TARGET_CCASFLAGS@'
|
||||||
grub_target_ldflags='@TARGET_LDFLAGS@'
|
grub_target_ldflags='@TARGET_LDFLAGS@'
|
||||||
|
grub_target_incremental_ldflags='@TARGET_INCREMENTAL_LINK@'
|
||||||
grub_cflags='@CFLAGS@'
|
grub_cflags='@CFLAGS@'
|
||||||
grub_cppflags='@CPPFLAGS@'
|
grub_cppflags='@CPPFLAGS@'
|
||||||
grub_ccasflags='@CCASFLAGS@'
|
grub_ccasflags='@CCASFLAGS@'
|
||||||
|
|||||||
Reference in new issue
Block a user