[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[2252] 2009-06-04 Vladimir Serbinenko <address@hidden>
From: |
Vladimir Serbinenko |
Subject: |
[2252] 2009-06-04 Vladimir Serbinenko <address@hidden> |
Date: |
Thu, 04 Jun 2009 19:53:52 +0000 |
Revision: 2252
http://svn.sv.gnu.org/viewvc/?view=rev&root=grub&revision=2252
Author: phcoder
Date: 2009-06-04 19:53:52 +0000 (Thu, 04 Jun 2009)
Log Message:
-----------
2009-06-04 Vladimir Serbinenko <address@hidden>
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
Modified Paths:
--------------
trunk/grub2/ChangeLog
trunk/grub2/Makefile.in
trunk/grub2/aclocal.m4
trunk/grub2/conf/i386-pc.rmk
trunk/grub2/configure.ac
trunk/grub2/genmk.rb
Modified: trunk/grub2/ChangeLog
===================================================================
--- trunk/grub2/ChangeLog 2009-06-04 19:39:51 UTC (rev 2251)
+++ trunk/grub2/ChangeLog 2009-06-04 19:53:52 UTC (rev 2252)
@@ -1,5 +1,29 @@
2009-06-04 Vladimir Serbinenko <address@hidden>
+ 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
+
+2009-06-04 Vladimir Serbinenko <address@hidden>
+
Simplify sed expressions and improve awk
* Makefile.in (install-local): simplify sed expression
Modified: trunk/grub2/Makefile.in
===================================================================
--- trunk/grub2/Makefile.in 2009-06-04 19:39:51 UTC (rev 2251)
+++ trunk/grub2/Makefile.in 2009-06-04 19:53:52 UTC (rev 2252)
@@ -64,16 +64,22 @@
CC = @CC@
CFLAGS = @CFLAGS@
+ASFLAGS = @ASFLAGS@
LDFLAGS = @LDFLAGS@
CPPFLAGS = @CPPFLAGS@ -I$(builddir) -I$(builddir)/include -I$(srcdir)/include
-Wall -W \
-DGRUB_LIBDIR=\"$(pkglibdir)\"
TARGET_CC = @TARGET_CC@
TARGET_CFLAGS = @TARGET_CFLAGS@
+TARGET_ASFLAGS = @TARGET_ASFLAGS@
+TARGET_MODULE_FORMAT = @TARGET_MODULE_FORMAT@
+TARGET_APPLE_CC = @TARGET_APPLE_CC@
+OBJCONV = @OBJCONV@
TARGET_CPPFLAGS = @TARGET_CPPFLAGS@ -I$(builddir) -I$(builddir)/include
-I$(srcdir)/include \
-Wall -W
TARGET_LDFLAGS = @TARGET_LDFLAGS@
TARGET_IMG_LDSCRIPT = @TARGET_IMG_LDSCRIPT@
TARGET_IMG_LDFLAGS = @TARGET_IMG_LDFLAGS@
+TARGET_IMG_CFLAGS = @TARGET_IMG_CFLAGS@
TARGET_OBJ2ELF = @TARGET_OBJ2ELF@
EXEEXT = @EXEEXT@
OBJCOPY = @OBJCOPY@
@@ -186,8 +192,12 @@
(\
echo "TARGET_CC=$(TARGET_CC)" ; \
echo "TARGET_CFLAGS=$(TARGET_CFLAGS)" ; \
- echo "TARGET_CPPFLAGS=$(TARGET_CPPFLAGS) -I$(pkglibdir)" ; \
+ echo "TARGET_ASFLAGS=$(TARGET_ASFLAGS)" ; \
+ echo "TARGET_CPPFLAGS=$(TARGET_CPPFLAGS) -I$(pkglibdir)
-I$(includedir)" ; \
echo "STRIP=$(STRIP)" ; \
+ echo "OBJCONV=$(OBJCONV)" ; \
+ echo "TARGET_MODULE_FORMAT=$(TARGET_MODULE_FORMAT)" ; \
+ echo "TARGET_APPLE_CC=$(TARGET_APPLE_CC)" ; \
echo "COMMON_ASFLAGS=$(COMMON_ASFLAGS)" ; \
echo "COMMON_CFLAGS=$(COMMON_CFLAGS)" ; \
echo "COMMON_LDFLAGS=$(COMMON_LDFLAGS)"\
Modified: trunk/grub2/aclocal.m4
===================================================================
--- trunk/grub2/aclocal.m4 2009-06-04 19:39:51 UTC (rev 2251)
+++ trunk/grub2/aclocal.m4 2009-06-04 19:53:52 UTC (rev 2252)
@@ -156,7 +156,37 @@
AC_MSG_RESULT([$grub_cv_i386_asm_addr32])])
+dnl check if our compiler is apple cc
+dnl because it requires numerous workarounds
+AC_DEFUN(grub_apple_cc,
+[AC_REQUIRE([AC_PROG_CC])
+AC_MSG_CHECKING([whether our compiler is apple cc])
+AC_CACHE_VAL(grub_cv_apple_cc,
+[if $CC -v 2>&1 | grep "Apple Inc." > /dev/null; then
+ grub_cv_apple_cc=yes
+else
+ grub_cv_apple_cc=no
+fi
+])
+AC_MSG_RESULT([$grub_cv_apple_cc])])
+
+dnl check if our target compiler is apple cc
+dnl because it requires numerous workarounds
+AC_DEFUN(grub_apple_target_cc,
+[AC_REQUIRE([AC_PROG_CC])
+AC_MSG_CHECKING([whether our target compiler is apple cc])
+AC_CACHE_VAL(grub_cv_apple_target_cc,
+[if $CC -v 2>&1 | grep "Apple Inc." > /dev/null; then
+ grub_cv_apple_target_cc=yes
+else
+ grub_cv_apple_target_cc=no
+fi
+])
+
+AC_MSG_RESULT([$grub_cv_apple_target_cc])])
+
+
dnl Later versions of GAS requires that addr32 and data32 prefixes
dnl appear in the same lines as the instructions they modify, while
dnl earlier versions requires that they appear in separate lines.
Modified: trunk/grub2/conf/i386-pc.rmk
===================================================================
--- trunk/grub2/conf/i386-pc.rmk 2009-06-04 19:39:51 UTC (rev 2251)
+++ trunk/grub2/conf/i386-pc.rmk 2009-06-04 19:53:52 UTC (rev 2252)
@@ -16,31 +16,31 @@
# For boot.img.
boot_img_SOURCES = boot/i386/pc/boot.S
boot_img_ASFLAGS = $(COMMON_ASFLAGS)
-boot_img_LDFLAGS = $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS) -Wl,-Ttext,7C00
+boot_img_LDFLAGS = $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS)7C00
boot_img_FORMAT = binary
# For pxeboot.img
pxeboot_img_SOURCES = boot/i386/pc/pxeboot.S
pxeboot_img_ASFLAGS = $(COMMON_ASFLAGS)
-pxeboot_img_LDFLAGS = $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS) -Wl,-Ttext,7C00
+pxeboot_img_LDFLAGS = $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS)7C00
pxeboot_img_FORMAT = binary
# For diskboot.img.
diskboot_img_SOURCES = boot/i386/pc/diskboot.S
diskboot_img_ASFLAGS = $(COMMON_ASFLAGS)
-diskboot_img_LDFLAGS = $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS) -Wl,-Ttext,8000
+diskboot_img_LDFLAGS = $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS)8000
diskboot_img_FORMAT = binary
# For lnxboot.img.
lnxboot_img_SOURCES = boot/i386/pc/lnxboot.S
lnxboot_img_ASFLAGS = $(COMMON_ASFLAGS)
-lnxboot_img_LDFLAGS = $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS) -Wl,-Ttext,6000
+lnxboot_img_LDFLAGS = $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS)6000
lnxboot_img_FORMAT = binary
# For cdboot.img.
cdboot_img_SOURCES = boot/i386/pc/cdboot.S
cdboot_img_ASFLAGS = $(COMMON_ASFLAGS)
-cdboot_img_LDFLAGS = $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS) -Wl,-Ttext,7C00
+cdboot_img_LDFLAGS = $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS)7C00
cdboot_img_FORMAT = binary
# For kernel.img.
@@ -63,9 +63,9 @@
machine/biosdisk.h machine/boot.h machine/console.h machine/init.h \
machine/memory.h machine/loader.h machine/vga.h machine/vbe.h \
machine/kernel.h machine/pxe.h i386/pit.h list.h handler.h command.h
-kernel_img_CFLAGS = $(COMMON_CFLAGS)
+kernel_img_CFLAGS = $(COMMON_CFLAGS) $(TARGET_IMG_CFLAGS)
kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
-kernel_img_LDFLAGS = $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS)
-Wl,-Ttext,$(GRUB_MEMORY_MACHINE_LINK_ADDR) $(COMMON_CFLAGS)
+kernel_img_LDFLAGS = $(COMMON_LDFLAGS)
$(TARGET_IMG_LDFLAGS)$(GRUB_MEMORY_MACHINE_LINK_ADDR) $(COMMON_CFLAGS)
kernel_img_FORMAT = binary
MOSTLYCLEANFILES += symlist.c kernel_syms.lst
Modified: trunk/grub2/configure.ac
===================================================================
--- trunk/grub2/configure.ac 2009-06-04 19:39:51 UTC (rev 2251)
+++ trunk/grub2/configure.ac 2009-06-04 19:53:52 UTC (rev 2252)
@@ -167,6 +167,11 @@
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 @@
# 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 @@
# 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 @@
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 @@
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 @@
# 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 @@
# 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 @@
[AS_HELP_STRING([--enable-efiemu],
[build and install the efiemu runtimes])])
AC_SUBST([enable_efiemu])
+AC_SUBST(ASFLAGS)
# Output files.
grub_CHECK_LINK_DIR
Modified: trunk/grub2/genmk.rb
===================================================================
--- trunk/grub2/genmk.rb 2009-06-04 19:39:51 UTC (rev 2251)
+++ trunk/grub2/genmk.rb 2009-06-04 19:53:52 UTC (rev 2252)
@@ -129,9 +129,14 @@
sh $(srcdir)/genmodsrc.sh '#{mod_name}' $< > $@ || (rm -f $@; exit 1)
ifneq ($(#{prefix}_EXPORTS),no)
+ifneq ($(TARGET_APPLE_CC),1)
#{defsym}: #{pre_obj}
$(NM) -g --defined-only -P -p $< | sed 's/^\\([^ ]*\\).*/\\1
#{mod_name}/' > $@
+else
+#{defsym}: #{pre_obj}
+ $(NM) -g -P -p $< | grep -E '^[a-zA-Z0-9_]* [TDS]' | sed 's/^\\([^
]*\\).*/\\1 #{mod_name}/' > $@
endif
+endif
#{undsym}: #{pre_obj}
echo '#{mod_name}' > $@
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [2252] 2009-06-04 Vladimir Serbinenko <address@hidden>,
Vladimir Serbinenko <=