On 16.07.2015 20:55, Andrei Borzenkov wrote: > В Wed, 15 Jul 2015 19:42:39 +0200 > Vladimir 'φ-coder/phcoder' Serbinenko <phco...@gmail.com> пишет: > >> >>> It is possible to compile using "--target=powerpc -Wl,-EB" - this works >>> on all three ppc, ppc64 and ppc64le, but this means hardcoding GNU ld >>> dependency. >>> >> Thanks for this info. >> See attached patch > > Test has to come before asm tests (so that we are sure to compile > for the right target). > > But real problem is that -Wl,-EB has to be added to TARGET_LDFLAGS only > Yes, discovered it already and updated the patch > [ 106s] configure:24950: clang -c -v -Wall -W -Wshadow > -Wpointer-arith -Wundef -Wchar-subscripts -Wcomment > -Wdeprecated-declarations -Wdisabled-optimization -Wdiv-by-zero -Wfloat-equal > -Wformat-extra-args -Wformat-security -Wformat-y2k -Wimplicit > -Wimplicit-function-declaration -Wimplicit-int -Wmain -Wmissing-braces > -Wmissing-format-attribute -Wmultichar -Wparentheses -Wreturn-type > -Wsequence-point -Wshadow -Wsign-compare -Wswitch -Wtrigraphs > -Wunknown-pragmas -Wunused -Wunused-function -Wunused-label > -Wunused-parameter -Wunused-value -Wunused-variable -Wwrite-strings > -Wnested-externs -Wstrict-prototypes -g -Wredundant-decls > -Wmissing-prototypes -Wmissing-declarations -Wcast-align -Wextra > -Wattributes -Wendif-labels -Winit-self -Wint-to-pointer-cast -Winvalid-pch > -Wmissing-field-initializers -Wnonnull -Woverflow -Wvla -Wpointer-to-int-cast > -Wstrict-aliasing -Wvariadic-macros -Wvolatile-register-var -Wpointer-sign > -Wmissing-include-dirs -Wmissing-prototypes -Wmissing-declarations -Wformat=2 > -target powerpc -Wl,-EB -m32 -msoft-float -W error -Wall -W -DGRUB_MACHINE_IEEE1275=1 -DGRUB_MACHINE=POWERPC_IEEE1275 conftest.c >&5 [ 106s] clang version 3.6.1 (tags/RELEASE_361/final 238133) > [ 106s] Target: powerpc > [ 106s] Thread model: posix > [ 106s] clang-3.6: error: -Wl,-EB: 'linker' input unused > > >>> So I'd rather try to produce patch for proper support of >>> -mbig-endian/-mlittle-endian (including passing it onto gcc linker) and >>> until then declared clang on ppc64le having limited support (i.e. >>> support for automatic detection by configure). >>> >> I agree that this is a better approach in long term. But if we can get >> some support for current tools with little work (see patch) and without >> risks of breaking other tools I see no reason not to go for it in short term >>> >> >
diff --git a/configure.ac b/configure.ac index fd8a62e..e54b9df 100644 --- a/configure.ac +++ b/configure.ac @@ -116,6 +116,7 @@ if test "x$with_platform" = x; then x86_64-*) platform=pc ;; powerpc-*) platform=ieee1275 ;; powerpc64-*) platform=ieee1275 ;; + powerpc64le-*) platform=ieee1275 ;; sparc64-*) platform=ieee1275 ;; mipsel-*) platform=loongson ;; mips-*) platform=arc ;; @@ -138,6 +139,7 @@ case "$target_cpu"-"$platform" in x86_64-none) ;; x86_64-*) target_cpu=i386 ;; powerpc64-ieee1275) target_cpu=powerpc ;; + powerpc64le-ieee1275) target_cpu=powerpc ;; esac # Check if the platform is supported, make final adjustments. @@ -560,6 +562,41 @@ AC_COMPILE_IFELSE( ]])], [grub_cv_cc_target_clang=no], [grub_cv_cc_target_clang=yes])]) +if test x$target_cpu = xpowerpc; then + AC_CACHE_CHECK([for options to get big-endian compilation], grub_cv_target_cc_big_endian, [ + grub_cv_target_cc_big_endian=no + for cand in "-target powerpc -Wl,-EB" "-target powerpc" \ + "-target powerpc-linux-gnu -Wl,-EB" "-target powerpc-linux-gnu" \ + "-mbig-endian"; do + if test x"$grub_cv_target_cc_big_endian" != xno ; then + break + fi + CFLAGS="$TARGET_CFLAGS $cand -Werror" + AC_LINK_IFELSE([AC_LANG_PROGRAM([[ +#if defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__) && (__ORDER_BIG_ENDIAN__ != __BYTE_ORDER__) +#error still little endian +#endif +asm (".globl start; start:"); +void __main (void); +void __main (void) {} +int main (void); +]], [[]])], + [grub_cv_target_cc_big_endian="$cand"], []) + done + ]) + + if test x"$grub_cv_target_cc_big_endian" = xno ; then + AC_MSG_ERROR([could not force big-endian]) + fi + + skip_linkflags="$(echo "$grub_cv_target_cc_big_endian"|sed 's@-Wl,-EB@@')" + + TARGET_CFLAGS="$TARGET_CFLAGS $skip_linkflags" + TARGET_CPPFLAGS="$TARGET_CPPFLAGS $skip_linkflags" + TARGET_CCASFLAGS="$TARGET_CCASFLAGS $skip_linkflags" + TARGET_LDFLAGS="$TARGET_LDFLAGS $grub_cv_target_cc_big_endian" +fi + AC_CACHE_CHECK([for options to compile assembly], [grub_cv_cc_target_asm_compile], [ test_program= case "x$target_cpu-$platform" in
signature.asc
Description: OpenPGP digital signature
_______________________________________________ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel