[2258] 2009-06-04 Vladimir Serbinenko <[email protected]>

Vladimir Serbinenko <[email protected]>
Newsgroups gmane.comp.boot-loaders.grub.cvs
Message-ID <[email protected]>
Revision: 2258
          http://svn.sv.gnu.org/viewvc/?view=rev&root=grub&revision=2258
Author:   phcoder
Date:     2009-06-04 20:54:14 +0000 (Thu, 04 Jun 2009)
Log Message:
-----------
2009-06-04  Vladimir Serbinenko  <[email protected]>

	Use objconv when compiling with Apple's CC

	* conf/i386-pc.rmk (efiemu32.o): use OBJCONV if defined
	(efiemu64.o): likewise
	(efiemu64_c.o): omit -mcmodel=large and add -DAPPLE_CC=1
	when compiling with Apple's CC
	(efiemu64_s.o): likewise
	* configure.ac: check for objconv when compiling with Apple's CC
	* genmk.rb: use objconv for modules when compiled with Apple's CC
	

Modified Paths:
--------------
    trunk/grub2/ChangeLog
    trunk/grub2/conf/i386-pc.rmk
    trunk/grub2/configure.ac
    trunk/grub2/genmk.rb

Modified: trunk/grub2/ChangeLog
===================================================================
--- trunk/grub2/ChangeLog	2009-06-04 20:40:51 UTC (rev 2257)
+++ trunk/grub2/ChangeLog	2009-06-04 20:54:14 UTC (rev 2258)
@@ -1,5 +1,17 @@
 2009-06-04  Vladimir Serbinenko  <[email protected]>
 
+	Use objconv when compiling with Apple's CC
+
+	* conf/i386-pc.rmk (efiemu32.o): use OBJCONV if defined
+	(efiemu64.o): likewise
+	(efiemu64_c.o): omit -mcmodel=large and add -DAPPLE_CC=1
+	when compiling with Apple's CC
+	(efiemu64_s.o): likewise
+	* configure.ac: check for objconv when compiling with Apple's CC
+	* genmk.rb: use objconv for modules when compiled with Apple's CC
+	
+2009-06-04  Vladimir Serbinenko  <[email protected]>
+
 	Define segment as well as section when compiling with
 	Apple's CC
 

Modified: trunk/grub2/conf/i386-pc.rmk
===================================================================
--- trunk/grub2/conf/i386-pc.rmk	2009-06-04 20:40:51 UTC (rev 2257)
+++ trunk/grub2/conf/i386-pc.rmk	2009-06-04 20:54:14 UTC (rev 2258)
@@ -397,16 +397,44 @@
 
 ifeq ($(enable_efiemu), yes)
 
-efiemu32.o: efiemu/runtime/efiemu.c
-	$(CC) -c -m32 -DELF32 -o $@ -Wall -Werror $< -nostdlib -O2 -I$(srcdir)/efiemu/runtime -I$(srcdir)/include -Iinclude
+efiemu32.o: efiemu/runtime/efiemu.c $(TARGET_OBJ2ELF)
+	-rm -f $@
+ifeq ($(TARGET_APPLE_CC), 1)
+	-rm -f [email protected]
+	$(TARGET_CC) -c -m32 -DELF32 -DAPPLE_CC -o [email protected] -Wall -Werror $< -nostdlib -O2 -I$(srcdir)/efiemu/runtime -I$(srcdir)/include -Iinclude
+	$(OBJCONV) -felf32 -nu -nd [email protected] $@
+	-rm -f [email protected]
+else
+	$(TARGET_CC) -c -m32 -DELF32 -o $@ -Wall -Werror $< -nostdlib -O2 -I$(srcdir)/efiemu/runtime -I$(srcdir)/include -Iinclude
+	if test ! -z $(TARGET_OBJ2ELF); then ./$(TARGET_OBJ2ELF) $@ || (rm -f $@; exit 1); fi
+endif
+
 efiemu64_c.o: efiemu/runtime/efiemu.c
-	$(CC) -c -m64 -DELF64 -o $@ -Wall -Werror $< -nostdlib  -mcmodel=large -mno-red-zone -O2 -I$(srcdir)/efiemu/runtime -I$(srcdir)/include -Iinclude
+ifeq ($(TARGET_APPLE_CC), 1)
+	$(TARGET_CC) -c -m64 -DAPPLE_CC=1 -DELF64 -o $@ -Wall -Werror $< -nostdlib -mno-red-zone -O2 -I$(srcdir)/efiemu/runtime -I$(srcdir)/include -Iinclude
+else
+	$(TARGET_CC) -c -m64 -DELF64 -o $@ -Wall -Werror $< -nostdlib  -mcmodel=large -mno-red-zone -O2 -I$(srcdir)/efiemu/runtime -I$(srcdir)/include -Iinclude
+endif
 
 efiemu64_s.o: efiemu/runtime/efiemu.S
-	$(CC) -c -m64 -DELF64 -o $@ -Wall -Werror $< -nostdlib  -mcmodel=large -mno-red-zone -O2 -I$(srcdir)/efiemu/runtime -I$(srcdir)/include -Iinclude
+	-rm -f $@
+ifeq ($(TARGET_APPLE_CC), 1)
+	$(TARGET_CC) -c -m64 -DAPPLE_CC=1 -DELF64 -o $@ -Wall -Werror $< -nostdlib -mno-red-zone -O2 -I$(srcdir)/efiemu/runtime -I$(srcdir)/include -Iinclude
+else
+	$(TARGET_CC) -c -m64 -DELF64 -o $@ -Wall -Werror $< -nostdlib  -mcmodel=large -mno-red-zone -O2 -I$(srcdir)/efiemu/runtime -I$(srcdir)/include -Iinclude
+endif
 
-efiemu64.o: efiemu64_c.o efiemu64_s.o
-	ld -melf_x86_64 -o $@ -r $^ -nostdlib
+efiemu64.o: efiemu64_c.o efiemu64_s.o  $(TARGET_OBJ2ELF)
+	-rm -f $@
+ifeq ($(TARGET_APPLE_CC), 1)
+	-rm -f [email protected]
+	$(TARGET_CC) -m64 -o [email protected] -Wl,-r $^ -nostdlib
+	$(OBJCONV) -felf64 -nu -nd [email protected] $@
+	-rm -f [email protected]
+else
+	$(TARGET_CC) -m64 -o $@ -Wl,-r $^ -nostdlib
+	if test ! -z $(TARGET_OBJ2ELF); then ./$(TARGET_OBJ2ELF) $@ || (rm -f $@; exit 1); fi
+endif
 
 CLEANFILES += efiemu32.o efiemu64.o efiemu64_c.o efiemu64_s.o
 pkglib_DATA += efiemu32.o efiemu64.o

Modified: trunk/grub2/configure.ac
===================================================================
--- trunk/grub2/configure.ac	2009-06-04 20:40:51 UTC (rev 2257)
+++ trunk/grub2/configure.ac	2009-06-04 20:54:14 UTC (rev 2258)
@@ -287,6 +287,13 @@
   CFLAGS="$CFLAGS -DAPPLE_CC=1 -fnested-functions"
   TARGET_ASFLAGS="$TARGET_ASFLAGS -DAPPLE_CC=1"
   TARGET_APPLE_CC=1
+  AC_CHECK_PROG([OBJCONV], [objconv], [objconv], [])
+  if test "x$OBJCONV" = x ; then
+     AC_CHECK_PROG([OBJCONV], [objconv], [./objconv], [], [.])
+  fi
+  if test "x$OBJCONV" = x ; then
+    AC_MSG_ERROR([objconv not found which is required when building with apple compiler])
+  fi
   TARGET_IMG_LDSCRIPT=
   TARGET_IMG_CFLAGS="-static"
   TARGET_IMG_LDFLAGS='-nostdlib -static -Wl,-preload -Wl,-segalign,20 -Wl,-image_base,'
@@ -390,6 +397,7 @@
 
 AC_SUBST(TARGET_CFLAGS)
 AC_SUBST(TARGET_MODULE_FORMAT)
+AC_SUBST(OBJCONV)
 AC_SUBST(TARGET_APPLE_CC)
 AC_SUBST(TARGET_ASFLAGS)
 AC_SUBST(TARGET_CPPFLAGS)

Modified: trunk/grub2/genmk.rb
===================================================================
--- trunk/grub2/genmk.rb	2009-06-04 20:40:51 UTC (rev 2257)
+++ trunk/grub2/genmk.rb	2009-06-04 20:54:14 UTC (rev 2258)
@@ -112,11 +112,20 @@
 MOSTLYCLEANFILES += #{deps_str}
 UNDSYMFILES += #{undsym}
 
+ifneq ($(TARGET_APPLE_CC),1)
 #{@name}: #{pre_obj} #{mod_obj} $(TARGET_OBJ2ELF)
 	-rm -f $@
 	$(TARGET_CC) $(#{prefix}_LDFLAGS) $(TARGET_LDFLAGS) -Wl,-r,-d -o $@ #{pre_obj} #{mod_obj}
 	if test ! -z $(TARGET_OBJ2ELF); then ./$(TARGET_OBJ2ELF) $@ || (rm -f $@; exit 1); fi
 	$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -K _grub_mod_init -K _grub_mod_fini -R .note -R .comment $@
+else
+#{@name}: #{pre_obj} #{mod_obj} $(TARGET_OBJ2ELF)
+	-rm -f $@
+	-rm -f [email protected]
+	$(TARGET_CC) $(#{prefix}_LDFLAGS) $(TARGET_LDFLAGS) -Wl,-r,-d -o [email protected] #{pre_obj} #{mod_obj}
+	$(OBJCONV) -f$(TARGET_MODULE_FORMAT) -nr:_grub_mod_init:grub_mod_init -nr:_grub_mod_fini:grub_mod_fini -wd1106 -nu -nd [email protected] $@
+	-rm -f [email protected]
+endif
 
 #{pre_obj}: $(#{prefix}_DEPENDENCIES) #{objs_str}
 	-rm -f $@
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.