2009-06-04 Vladimir Serbinenko <phcoder@gmail.com>
Check if compiler is apple cc * Makefile.in (ASFLAGS): new variable (TARGET_ASFLAGS): likewise (TARGET_MODULE_FORMAT): likewise (TARGET_APPLE_CC): likewise (OBJCONV): likewise (TARGET_IMG_CFLAGS): likewise (TARGET_CPPFLAGS): add includedir * configure.ac: call grub_apple_cc and grub_apple_target_cc (TARGET_IMG_LDFLAGS): Add -Wl,-Ttext,. All users updated Check for linker script only if compiler isn't Apple's CC (TARGET_MODULE_FORMAT): set (TARGET_APPLE_CC): likewise (TARGET_ASFLAGS): likewise (ASFLAGS): likewise Check for objcopy only if compiler isn't Apple's CC Check for BSS symbol only if compiler isn't Apple's CC * genmk.rb: adapt nm options if we use Apple's utils * aclocal.m4 (grub_apple_cc): new test (grub_apple_target_cc): likewise
This commit is contained in:
parent
fb14123e01
commit
2b167a7218
6 changed files with 133 additions and 35 deletions
83
configure.ac
83
configure.ac
|
@ -167,6 +167,11 @@ AC_C_BIGENDIAN
|
|||
AC_CHECK_SIZEOF(void *)
|
||||
AC_CHECK_SIZEOF(long)
|
||||
|
||||
grub_apple_cc
|
||||
if test x$grub_cv_apple_cc == xyes ; then
|
||||
CFLAGS="$CFLAGS -DAPPLE_CC=1 -fnested-functions"
|
||||
ASFLAGS="$ASFLAGS -DAPPLE_CC=1"
|
||||
fi
|
||||
if test "x$host_m32" = x1; then
|
||||
# Force 32-bit mode.
|
||||
CFLAGS="$CFLAGS -m32"
|
||||
|
@ -206,31 +211,6 @@ AC_CHECK_FUNCS(posix_memalign memalign asprintf)
|
|||
# Check for target programs.
|
||||
#
|
||||
|
||||
|
||||
# Use linker script if present, otherwise use builtin -N script.
|
||||
AC_MSG_CHECKING([for option to link raw image])
|
||||
if test -f "${srcdir}/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc"; then
|
||||
TARGET_IMG_LDSCRIPT='$(top_srcdir)'"/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc"
|
||||
TARGET_IMG_LDFLAGS="-Wl,-T${TARGET_IMG_LDSCRIPT}"
|
||||
TARGET_IMG_LDFLAGS_AC="-Wl,-T${srcdir}/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc"
|
||||
else
|
||||
TARGET_IMG_LDSCRIPT=
|
||||
TARGET_IMG_LDFLAGS='-Wl,-N'
|
||||
TARGET_IMG_LDFLAGS_AC='-Wl,-N'
|
||||
fi
|
||||
AC_SUBST(TARGET_IMG_LDSCRIPT)
|
||||
AC_SUBST(TARGET_IMG_LDFLAGS)
|
||||
AC_MSG_RESULT([$TARGET_IMG_LDFLAGS_AC])
|
||||
|
||||
# For platforms where ELF is not the default link format.
|
||||
AC_MSG_CHECKING([for command to convert module to ELF format])
|
||||
case "${host_os}" in
|
||||
cygwin) TARGET_OBJ2ELF='grub-pe2elf' ;;
|
||||
*) ;;
|
||||
esac
|
||||
AC_SUBST(TARGET_OBJ2ELF)
|
||||
AC_MSG_RESULT([$TARGET_OBJ2ELF])
|
||||
|
||||
# Find tools for the target.
|
||||
if test "x$target_alias" != x && test "x$host_alias" != "x$target_alias"; then
|
||||
tmp_ac_tool_prefix="$ac_tool_prefix"
|
||||
|
@ -287,7 +267,7 @@ if test "x$TARGET_CFLAGS" = x; then
|
|||
# Force no alignment to save space on i386.
|
||||
if test "x$target_cpu" = xi386; then
|
||||
AC_CACHE_CHECK([whether -falign-loops works], [grub_cv_cc_falign_loop], [
|
||||
CFLAGS="-falign-loops=1"
|
||||
CFLAGS="$CFLAGS -falign-loops=1"
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
|
||||
[grub_cv_cc_falign_loop=yes],
|
||||
[grub_cv_cc_falign_loop=no])
|
||||
|
@ -301,16 +281,59 @@ if test "x$TARGET_CFLAGS" = x; then
|
|||
fi
|
||||
fi
|
||||
|
||||
grub_apple_target_cc
|
||||
if test x$grub_cv_apple_target_cc == xyes ; then
|
||||
TARGET_CFLAGS="$TARGET_CFLAGS -DAPPLE_CC=1 -fnested-functions"
|
||||
CFLAGS="$CFLAGS -DAPPLE_CC=1 -fnested-functions"
|
||||
TARGET_ASFLAGS="$TARGET_ASFLAGS -DAPPLE_CC=1"
|
||||
TARGET_APPLE_CC=1
|
||||
TARGET_IMG_LDSCRIPT=
|
||||
TARGET_IMG_CFLAGS="-static"
|
||||
TARGET_IMG_LDFLAGS='-nostdlib -static -Wl,-preload -Wl,-segalign,20 -Wl,-image_base,'
|
||||
TARGET_IMG_LDFLAGS_AC='-nostdlib -static -Wl,-preload -Wl,-segalign,20 -Wl,-image_base,'
|
||||
else
|
||||
TARGET_APPLE_CC=0
|
||||
# Use linker script if present, otherwise use builtin -N script.
|
||||
AC_MSG_CHECKING([for option to link raw image])
|
||||
if test -f "${srcdir}/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc"; then
|
||||
TARGET_IMG_LDSCRIPT='$(top_srcdir)'"/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc"
|
||||
TARGET_IMG_LDFLAGS="-Wl,-T${TARGET_IMG_LDSCRIPT} -Wl,-Ttext,"
|
||||
TARGET_IMG_LDFLAGS_AC="-Wl,-T${srcdir}/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc"
|
||||
else
|
||||
TARGET_IMG_LDSCRIPT=
|
||||
TARGET_IMG_LDFLAGS='-Wl,-N -Wl,-Ttext,'
|
||||
TARGET_IMG_LDFLAGS_AC='-Wl,-N -Wl,-Ttext,'
|
||||
fi
|
||||
TARGET_IMG_CFLAGS=
|
||||
fi
|
||||
|
||||
AC_SUBST(TARGET_IMG_LDSCRIPT)
|
||||
AC_SUBST(TARGET_IMG_LDFLAGS)
|
||||
AC_SUBST(TARGET_IMG_CFLAGS)
|
||||
AC_MSG_RESULT([$TARGET_IMG_LDFLAGS_AC])
|
||||
|
||||
# For platforms where ELF is not the default link format.
|
||||
AC_MSG_CHECKING([for command to convert module to ELF format])
|
||||
case "${host_os}" in
|
||||
cygwin) TARGET_OBJ2ELF='grub-pe2elf' ;;
|
||||
*) ;;
|
||||
esac
|
||||
AC_SUBST(TARGET_OBJ2ELF)
|
||||
AC_MSG_RESULT([$TARGET_OBJ2ELF])
|
||||
|
||||
|
||||
if test "x$target_m32" = x1; then
|
||||
# Force 32-bit mode.
|
||||
TARGET_CFLAGS="$TARGET_CFLAGS -m32"
|
||||
TARGET_LDFLAGS="$TARGET_LDFLAGS -m32"
|
||||
TARGET_MODULE_FORMAT="elf32"
|
||||
fi
|
||||
|
||||
if test "x$target_m64" = x1; then
|
||||
# Force 64-bit mode.
|
||||
TARGET_CFLAGS="$TARGET_CFLAGS -m64"
|
||||
TARGET_LDFLAGS="$TARGET_LDFLAGS -m64"
|
||||
TARGET_MODULE_FORMAT="elf64"
|
||||
fi
|
||||
|
||||
if test "$target_cpu"-"$platform" = x86_64-efi; then
|
||||
|
@ -361,6 +384,9 @@ if test x"$sap_possible" = xyes; then
|
|||
fi
|
||||
|
||||
AC_SUBST(TARGET_CFLAGS)
|
||||
AC_SUBST(TARGET_MODULE_FORMAT)
|
||||
AC_SUBST(TARGET_APPLE_CC)
|
||||
AC_SUBST(TARGET_ASFLAGS)
|
||||
AC_SUBST(TARGET_CPPFLAGS)
|
||||
AC_SUBST(TARGET_LDFLAGS)
|
||||
|
||||
|
@ -375,7 +401,9 @@ AC_CHECK_FUNCS(__bswapsi2 __bswapdi2)
|
|||
|
||||
# Defined in aclocal.m4.
|
||||
grub_PROG_TARGET_CC
|
||||
if test "x$TARGET_APPLE_CC" != x1 ; then
|
||||
grub_PROG_OBJCOPY_ABSOLUTE
|
||||
fi
|
||||
grub_PROG_LD_BUILD_ID_NONE
|
||||
grub_ASM_USCORE
|
||||
if test "x$target_cpu" = xi386; then
|
||||
|
@ -383,7 +411,7 @@ if test "x$target_cpu" = xi386; then
|
|||
# Check symbols provided by linker script.
|
||||
CFLAGS="$TARGET_CFLAGS -nostdlib $TARGET_IMG_LDFLAGS_AC -Wl,-Ttext,8000,--defsym,___main=0x8100"
|
||||
fi
|
||||
if test "x$platform" = xpc; then
|
||||
if test "x$platform" = xpc && test "x$TARGET_APPLE_CC" != x1 ; then
|
||||
grub_CHECK_BSS_START_SYMBOL
|
||||
grub_CHECK_END_SYMBOL
|
||||
fi
|
||||
|
@ -482,6 +510,7 @@ AC_ARG_ENABLE([efiemu],
|
|||
[AS_HELP_STRING([--enable-efiemu],
|
||||
[build and install the efiemu runtimes])])
|
||||
AC_SUBST([enable_efiemu])
|
||||
AC_SUBST(ASFLAGS)
|
||||
|
||||
# Output files.
|
||||
grub_CHECK_LINK_DIR
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue