2009-06-04 Vladimir Serbinenko <phcoder@gmail.com>
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
This commit is contained in:
parent
d119a20ce5
commit
cf00df3167
4 changed files with 63 additions and 6 deletions
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,15 @@
|
||||||
|
2009-06-04 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
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 <phcoder@gmail.com>
|
2009-06-04 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
Define segment as well as section when compiling with
|
Define segment as well as section when compiling with
|
||||||
|
|
|
@ -397,16 +397,44 @@ hdparm_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
ifeq ($(enable_efiemu), yes)
|
ifeq ($(enable_efiemu), yes)
|
||||||
|
|
||||||
efiemu32.o: efiemu/runtime/efiemu.c
|
efiemu32.o: efiemu/runtime/efiemu.c $(TARGET_OBJ2ELF)
|
||||||
$(CC) -c -m32 -DELF32 -o $@ -Wall -Werror $< -nostdlib -O2 -I$(srcdir)/efiemu/runtime -I$(srcdir)/include -Iinclude
|
-rm -f $@
|
||||||
|
ifeq ($(TARGET_APPLE_CC), 1)
|
||||||
|
-rm -f $@.bin
|
||||||
|
$(TARGET_CC) -c -m32 -DELF32 -DAPPLE_CC -o $@.bin -Wall -Werror $< -nostdlib -O2 -I$(srcdir)/efiemu/runtime -I$(srcdir)/include -Iinclude
|
||||||
|
$(OBJCONV) -felf32 -nu -nd $@.bin $@
|
||||||
|
-rm -f $@.bin
|
||||||
|
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
|
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
|
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
|
efiemu64.o: efiemu64_c.o efiemu64_s.o $(TARGET_OBJ2ELF)
|
||||||
ld -melf_x86_64 -o $@ -r $^ -nostdlib
|
-rm -f $@
|
||||||
|
ifeq ($(TARGET_APPLE_CC), 1)
|
||||||
|
-rm -f $@.bin
|
||||||
|
$(TARGET_CC) -m64 -o $@.bin -Wl,-r $^ -nostdlib
|
||||||
|
$(OBJCONV) -felf64 -nu -nd $@.bin $@
|
||||||
|
-rm -f $@.bin
|
||||||
|
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
|
CLEANFILES += efiemu32.o efiemu64.o efiemu64_c.o efiemu64_s.o
|
||||||
pkglib_DATA += efiemu32.o efiemu64.o
|
pkglib_DATA += efiemu32.o efiemu64.o
|
||||||
|
|
|
@ -287,6 +287,13 @@ if test x$grub_cv_apple_target_cc == xyes ; then
|
||||||
CFLAGS="$CFLAGS -DAPPLE_CC=1 -fnested-functions"
|
CFLAGS="$CFLAGS -DAPPLE_CC=1 -fnested-functions"
|
||||||
TARGET_ASFLAGS="$TARGET_ASFLAGS -DAPPLE_CC=1"
|
TARGET_ASFLAGS="$TARGET_ASFLAGS -DAPPLE_CC=1"
|
||||||
TARGET_APPLE_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_LDSCRIPT=
|
||||||
TARGET_IMG_CFLAGS="-static"
|
TARGET_IMG_CFLAGS="-static"
|
||||||
TARGET_IMG_LDFLAGS='-nostdlib -static -Wl,-preload -Wl,-segalign,20 -Wl,-image_base,'
|
TARGET_IMG_LDFLAGS='-nostdlib -static -Wl,-preload -Wl,-segalign,20 -Wl,-image_base,'
|
||||||
|
@ -390,6 +397,7 @@ fi
|
||||||
|
|
||||||
AC_SUBST(TARGET_CFLAGS)
|
AC_SUBST(TARGET_CFLAGS)
|
||||||
AC_SUBST(TARGET_MODULE_FORMAT)
|
AC_SUBST(TARGET_MODULE_FORMAT)
|
||||||
|
AC_SUBST(OBJCONV)
|
||||||
AC_SUBST(TARGET_APPLE_CC)
|
AC_SUBST(TARGET_APPLE_CC)
|
||||||
AC_SUBST(TARGET_ASFLAGS)
|
AC_SUBST(TARGET_ASFLAGS)
|
||||||
AC_SUBST(TARGET_CPPFLAGS)
|
AC_SUBST(TARGET_CPPFLAGS)
|
||||||
|
|
9
genmk.rb
9
genmk.rb
|
@ -112,11 +112,20 @@ endif
|
||||||
MOSTLYCLEANFILES += #{deps_str}
|
MOSTLYCLEANFILES += #{deps_str}
|
||||||
UNDSYMFILES += #{undsym}
|
UNDSYMFILES += #{undsym}
|
||||||
|
|
||||||
|
ifneq ($(TARGET_APPLE_CC),1)
|
||||||
#{@name}: #{pre_obj} #{mod_obj} $(TARGET_OBJ2ELF)
|
#{@name}: #{pre_obj} #{mod_obj} $(TARGET_OBJ2ELF)
|
||||||
-rm -f $@
|
-rm -f $@
|
||||||
$(TARGET_CC) $(#{prefix}_LDFLAGS) $(TARGET_LDFLAGS) -Wl,-r,-d -o $@ #{pre_obj} #{mod_obj}
|
$(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
|
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 $@
|
$(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 $@.bin
|
||||||
|
$(TARGET_CC) $(#{prefix}_LDFLAGS) $(TARGET_LDFLAGS) -Wl,-r,-d -o $@.bin #{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 $@.bin $@
|
||||||
|
-rm -f $@.bin
|
||||||
|
endif
|
||||||
|
|
||||||
#{pre_obj}: $(#{prefix}_DEPENDENCIES) #{objs_str}
|
#{pre_obj}: $(#{prefix}_DEPENDENCIES) #{objs_str}
|
||||||
-rm -f $@
|
-rm -f $@
|
||||||
|
|
Loading…
Reference in a new issue