On 10.11.2013 11:41, Andrey Borzenkov wrote: > В Sun, 10 Nov 2013 12:28:50 +0200 > Beeblebrox <zap...@berentweb.com> пишет: > >>>> Did you rerun ./autogen.sh? >> I ran gmake clean and cleaned all conig**** folders, then re-started >> from scratch. >> > > It would be more clean to start in new directory. If you build inside > source tree, use "git clean -d -x -f" to remove everything not in GIT > repo and start anew with autogen.sh. > >>>> What is the value of your target_os ? >> Build, host & target are all the same. I tried setting all 3 as >> i386-freebsd for one of my runs, but that did not work. >> Otherwise, I did not set it in the configure command, as I expect the >> build should be able to identify the target on its own. Is this >> incorrect? >> > > Try explicit --target i386-freebsd. It is always possible that > autoconfiguration fails. It shows that we can't rely on target_os for available linking formats. Probably we should try different formats until we find one that works like in attached patch > > _______________________________________________ > Grub-devel mailing list > Grub-devel@gnu.org > https://lists.gnu.org/mailman/listinfo/grub-devel >
diff --git a/configure.ac b/configure.ac index 579acb8..261c590 100644 --- a/configure.ac +++ b/configure.ac @@ -604,51 +604,15 @@ if test "x$grub_cv_cc_fno_asynchronous_unwind_tables" = xyes; then fi grub_apple_target_cc -if test x$grub_cv_apple_target_cc = xyes ; then - TARGET_APPLE_CC=1 - AC_CHECK_PROG([TARGET_OBJCONV], [objconv], [objconv], []) - if test "x$TARGET_OBJCONV" = x ; then - AC_CHECK_PROG([TARGET_OBJCONV], [objconv], [./objconv], [], [.]) - fi - if test "x$TARGET_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' - TARGET_IMG_LDFLAGS_AC='-nostdlib -static -Wl,-preload -Wl,-segalign,20' - TARGET_IMG_BASE_LDOPT="-Wl,-image_base" - TARGET_LDFLAGS_OLDMAGIC="" -else - TARGET_APPLE_CC=0 - TARGET_LDFLAGS_OLDMAGIC="-Wl,-N" -# Use linker script if present, otherwise use builtin -N script. -if test -f "${srcdir}/${grub_coredir}/conf/${target_cpu}-${platform}-${target_os}-img-ld.sc"; then - TARGET_IMG_LDSCRIPT='$(top_srcdir)'"/${grub_coredir}/conf/${target_cpu}-${platform}-${target_os}-img-ld.sc" - TARGET_IMG_LDFLAGS="-Wl,-T${TARGET_IMG_LDSCRIPT}" - TARGET_IMG_LDFLAGS_AC="-Wl,-T${srcdir}/${grub_coredir}/conf/${target_cpu}-${platform}-${target_os}-img-ld.sc" - TARGET_IMG_BASE_LDOPT="-Wl,-Ttext" -else - TARGET_IMG_LDSCRIPT= - TARGET_IMG_LDFLAGS='-Wl,-N' - TARGET_IMG_LDFLAGS_AC='-Wl,-N' - TARGET_IMG_BASE_LDOPT="-Wl,-Ttext" -fi -TARGET_IMG_CFLAGS= -fi - -AC_SUBST(TARGET_LDFLAGS_OLDMAGIC) # For platforms where ELF is not the default link format. -AC_MSG_CHECKING([for command to convert module to ELF format]) case "${target_os}" in - cygwin) TARGET_OBJ2ELF='./build-grub-pe2elf'; + cygwin) # FIXME: put proper test here NEED_REGISTER_FRAME_INFO=1 ;; *) NEED_REGISTER_FRAME_INFO=0 ;; esac -AC_MSG_RESULT([$TARGET_OBJ2ELF]) AC_ARG_ENABLE([efiemu], @@ -687,42 +651,71 @@ enable_efiemu=no fi AC_SUBST([enable_efiemu]) -case "$target_os" in - cygwin) - ;; - freebsd | kfreebsd*-gnu) - if test x"$target_cpu" = xi386; then - TARGET_LDFLAGS="$TARGET_LDFLAGS -Wl,-melf_i386_fbsd" - fi - if test x"$target_cpu" = xx86_64; then - TARGET_LDFLAGS="$TARGET_LDFLAGS -Wl,-melf_x86_64_fbsd" - fi - ;; - openbsd*) - if test x"$target_cpu" = xi386; then - TARGET_LDFLAGS="$TARGET_LDFLAGS -Wl,-melf_i386_obsd" - fi - if test x"$target_cpu" = xx86_64; then - TARGET_LDFLAGS="$TARGET_LDFLAGS -Wl,-melf_x86_64_obsd" - fi - ;; - haiku*) - if test x"$target_cpu" = xi386; then - TARGET_LDFLAGS="$TARGET_LDFLAGS -Wl,-melf_i386_haiku" - fi - if test x"$target_cpu" = xx86_64; then - TARGET_LDFLAGS="$TARGET_LDFLAGS -Wl,-melf_x86_64_haiku" - fi - ;; - *) - if test x"$target_cpu" = xi386; then - TARGET_LDFLAGS="$TARGET_LDFLAGS -Wl,-melf_i386" - fi - if test x"$target_cpu" = xx86_64; then - TARGET_LDFLAGS="$TARGET_LDFLAGS -Wl,-melf_x86_64" - fi - ;; -esac +CFLAGS="$TARGET_CFLAGS" + +if test x"$target_cpu" = xi386 || test x"$target_cpu" = xx86_64; then + AC_CACHE_CHECK([for linking format], [grub_cv_target_cc_link_format], [ + grub_cv_target_cc_link_format=unknown + for format in elf_${target_cpu} elf_${target_cpu}_fbsd elf_${target_cpu}_obsd elf_${target_cpu}_haiku ${target_cpu}pe ${target_cpu}_macho; do + if test x${target_cpu} = xx86_64 && test x$format = x${target_cpu}pe; then + continue + fi + LDFLAGS="$TARGET_LDFLAGS -Wl,-m$format -nostdlib" + AC_LINK_IFELSE([AC_LANG_PROGRAM([[void _start (void) {}; + void start (void) {}; + void __start (void) {}; + ]], [[]])], [flag=1], []) + if test x"$flag" = x1; then + grub_cv_target_cc_link_format="$format" + break; + fi + done]) + if test x"$grub_cv_target_cc_link_format" = xunknown; then + AC_MSG_ERROR([no suitable link format found]) + fi + TARGET_LDFLAGS="$TARGET_LDFLAGS -Wl,-m$grub_cv_target_cc_link_format" + if test x"$grub_cv_target_cc_link_format" = xi386-pe; then + TARGET_OBJ2ELF='./build-grub-pe2elf'; + fi +fi + +if test x$grub_cv_target_cc_link_format = xi386_macho || test x$grub_cv_target_cc_link_format = xx86_64_macho; then + TARGET_APPLE_CC=1 + AC_CHECK_PROG([TARGET_OBJCONV], [objconv], [objconv], []) + if test "x$TARGET_OBJCONV" = x ; then + AC_CHECK_PROG([TARGET_OBJCONV], [objconv], [./objconv], [], [.]) + fi + if test "x$TARGET_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' + TARGET_IMG_LDFLAGS_AC='-nostdlib -static -Wl,-preload -Wl,-segalign,20' + TARGET_IMG_BASE_LDOPT="-Wl,-image_base" + TARGET_LDFLAGS_OLDMAGIC="" +elif test x$grub_cv_target_cc_link_format = xi386pe && test x$platform = xpc; then + TARGET_APPLE_CC=0 + TARGET_LDFLAGS_OLDMAGIC="-Wl,-N" + TARGET_IMG_LDSCRIPT='$(top_srcdir)'"/${grub_coredir}/conf/i386-pc-cygwin-img-ld.sc" + TARGET_IMG_LDFLAGS="-Wl,-T${TARGET_IMG_LDSCRIPT}" + TARGET_IMG_LDFLAGS_AC="-Wl,-T${srcdir}/${grub_coredir}/conf/i386-pc-cygwin-img-ld.sc" + TARGET_IMG_BASE_LDOPT="-Wl,-Ttext" + TARGET_IMG_CFLAGS= +else + TARGET_APPLE_CC=0 + TARGET_LDFLAGS_OLDMAGIC="-Wl,-N" + TARGET_IMG_LDSCRIPT= + TARGET_IMG_LDFLAGS='-Wl,-N' + TARGET_IMG_LDFLAGS_AC='-Wl,-N' + TARGET_IMG_BASE_LDOPT="-Wl,-Ttext" + TARGET_IMG_CFLAGS= +fi + +AC_SUBST(TARGET_LDFLAGS_OLDMAGIC) + + +LDFLAGS="$TARGET_LDFLAGS" if test "$target_cpu" = x86_64; then # Use large model to support 4G memory
signature.asc
Description: OpenPGP digital signature
_______________________________________________ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel