diff --git a/ChangeLog b/ChangeLog index 7a3f3f63a..696da1215 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2011-01-13 Vladimir Serbinenko + + Fix compilation on cygwin. + + * conf/Makefile.common (STRIPFLAGS_KERNEL): Add -F elf32-i386 and + -R .drectve on cygwin. + * conf/i386-pc-cygwin-img-ld.sc: Merge rdata and pdata into data. + * configure.ac: Use $(top_builddir) in TARGET_OBJ2ELF. + (COND_CYGWIN): New condition. + * grub-core/Makefile.am (%.mod): Set TARGET_OBJ2ELF. + * grub-core/genmod.sh.in: Use ${TARGET_OBJ2ELF} and + not @TARGET_OBJ2ELF@. + * util/grub-pe2elf.c (write_symbol_table): Use pe_symtab->type and not + type to determine whether aux is to be used. + 2011-01-12 Vladimir Serbinenko * util/ieee1275/ofpath.c (grub_util_devname_to_ofpath): Use the diff --git a/conf/Makefile.common b/conf/Makefile.common index 2df8465c0..32ca76d08 100644 --- a/conf/Makefile.common +++ b/conf/Makefile.common @@ -67,7 +67,11 @@ CFLAGS_KERNEL = $(CFLAGS_CPU) $(CFLAGS_PLATFORM) -ffreestanding LDFLAGS_KERNEL = $(LDFLAGS_CPU) $(LDFLAGS_PLATFORM) -nostdlib -Wl,-N -static-libgcc CPPFLAGS_KERNEL = $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM) CCASFLAGS_KERNEL = $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM) +if COND_CYGWIN +STRIPFLAGS_KERNEL = -F elf32-i386 -R .rel.dyn -R .reginfo -R .note -R .comment -R .drectve +else STRIPFLAGS_KERNEL = -R .rel.dyn -R .reginfo -R .note -R .comment +endif CFLAGS_MODULE = $(CFLAGS_CPU) $(CFLAGS_PLATFORM) -ffreestanding LDFLAGS_MODULE = $(LDFLAGS_CPU) $(LDFLAGS_PLATFORM) -nostdlib -Wl,-N,-r,-d diff --git a/conf/i386-pc-cygwin-img-ld.sc b/conf/i386-pc-cygwin-img-ld.sc index a41cac75e..3b579d344 100644 --- a/conf/i386-pc-cygwin-img-ld.sc +++ b/conf/i386-pc-cygwin-img-ld.sc @@ -13,15 +13,9 @@ SECTIONS __data_start__ = . ; *(.data) __data_end__ = . ; - } - .rdata : - { __rdata_start__ = . ; *(.rdata) __rdata_end__ = . ; - } - .pdata : - { *(.pdata) edata = . ; } diff --git a/configure.ac b/configure.ac index 055c65e67..0b9207ea2 100644 --- a/configure.ac +++ b/configure.ac @@ -454,7 +454,7 @@ fi # 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_utildir)/grub-pe2elf'; + cygwin) TARGET_OBJ2ELF='$(top_builddir)/grub-pe2elf'; # FIXME: put proper test here NEED_REGISTER_FRAME_INFO=1 ;; @@ -964,6 +964,7 @@ AM_CONDITIONAL([COND_APPLE_CC], [test x$TARGET_APPLE_CC = x1]) AM_CONDITIONAL([COND_ENABLE_EFIEMU], [test x$enable_efiemu = xyes]) AM_CONDITIONAL([COND_HAVE_ASM_USCORE], [test x$HAVE_ASM_USCORE = x1]) +AM_CONDITIONAL([COND_CYGWIN], [test x$host_os = xcygwin]) # Output files. grub_CHECK_LINK_DIR diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am index fcf3fc42d..94f7f3ffe 100644 --- a/grub-core/Makefile.am +++ b/grub-core/Makefile.am @@ -303,7 +303,7 @@ platform_DATA += moddep.lst CLEANFILES += config.log syminfo.lst moddep.lst $(MOD_FILES): %.mod : genmod.sh moddep.lst %.module$(EXEEXT) - sh $^ $@ + TARGET_OBJ2ELF=@TARGET_OBJ2ELF@ sh $^ $@ platform_DATA += $(MOD_FILES) CLEANFILES += $(MOD_FILES) diff --git a/grub-core/genmod.sh.in b/grub-core/genmod.sh.in index b97f3e1c7..023cd1062 100644 --- a/grub-core/genmod.sh.in +++ b/grub-core/genmod.sh.in @@ -52,8 +52,8 @@ fi rm -f $t1 $t2 if test x@TARGET_APPLE_CC@ != x1; then - if ! test -z "@TARGET_OBJ2ELF@"; then - ./@TARGET_OBJ2ELF@ $tmpfile || exit 1 + if ! test -z "${TARGET_OBJ2ELF}"; then + ./${TARGET_OBJ2ELF} $tmpfile || exit 1 fi if test x@platform@ != xemu; then @STRIP@ --strip-unneeded \ diff --git a/util/grub-pe2elf.c b/util/grub-pe2elf.c index f370bbfa8..cf690841f 100644 --- a/util/grub-pe2elf.c +++ b/util/grub-pe2elf.c @@ -337,7 +337,7 @@ write_symbol_table (FILE* fp, char *image, else bind = STB_LOCAL; - if ((type != STT_FUNC) && (pe_symtab->num_aux)) + if ((pe_symtab->type != GRUB_PE32_DT_FUNCTION) && (pe_symtab->num_aux)) { if (! pe_symtab->value) type = STT_SECTION;