powerpc ld configure
authorAlan Modra <amodra@gmail.com>
Thu, 25 Aug 2016 06:41:40 +0000 (16:11 +0930)
committerAlan Modra <amodra@gmail.com>
Thu, 25 Aug 2016 14:11:11 +0000 (23:41 +0930)
This fixes a few problems in the powerpc ld configury.
1) Using powerpc*le-* to test for powerpcle and powerpc64le would
   incorrectly match a target triple like powerpc-apple-elf.
2) In the same vein, *64* could match 64 in the user supplied MANUF-OS
   part of the target triple.
3) tooldir vars were missing, and some target aliases would result in
   ridiculous values for those tdir_* vars given.
4) Since 2016-04-25, BE support was added automatically when asking
   for an LE target.  If that is a good idea, then so is adding LE
   support when asking for BE.

* configure.tgt (powerpc*-*-linux* et al): Rewrite, adding LE
support for BE.  First output all target endian configury
values, then opposite endian.  Handle more tooldirs.  Fix
bogus matches with strings in MANUF-OS part of target triple.

ld/ChangeLog
ld/configure.tgt

index 02375edc18d44a4a4627f9163427e7f44475682a..95a63ea135ad6cfbb52fb02fc04bcdadf9c62471 100644 (file)
@@ -1,3 +1,10 @@
+2016-08-25  Alan Modra  <amodra@gmail.com>
+
+       * configure.tgt (powerpc*-*-linux* et al): Rewrite, adding LE
+       support for BE.  First output all target endian configury
+       values, then opposite endian.  Handle more tooldirs.  Fix
+       bogus matches with strings in MANUF-OS part of target triple.
+
 2016-08-23  Alan Modra  <amodra@gmail.com>
 
        * testsuite/lib/ld-lib.exp (run_cc_link_tests): Don't fail tests
index a3db9091243145a57d909be1da6f1efe80d5568f..6f3cd4fc37cf114e042472c7bfe32557aa8417ff 100644 (file)
@@ -597,40 +597,75 @@ powerpc*-*-elf* | powerpc*-*-eabi* | powerpc*-*-sysv* \
   | powerpc*-*-linux* | powerpc*-*-netbsd* | powerpc*-*-openbsd* \
   | powerpc*-*-solaris* | powerpc*-*-kaos* | powerpc*-*-vxworks*)
                        case "${targ}" in
-                       *64*)   targ_emul=elf64ppc
-                               targ_extra_emuls="elf32ppc elf32ppclinux elf32ppcsim"
-                               targ_extra_libpath="elf32ppc elf32ppclinux"
-                               td=tdir_elf32ppc
-                               case "${targ}" in
-                               powerpc*le-*) td=tdir_elf32lppc;;
-                               esac
-                               eval ${td}=`echo "${targ_alias}" | sed -e 's/64//'`
-                               eval ${td}linux=\$${td}
-                               eval ${td}sim=\$${td}
-                               ;;
-                       *linux*) targ_emul=elf32ppclinux
-                               targ_extra_emuls="elf32ppc elf32ppcsim"
-                               targ_extra_libpath=elf32ppc
-                               targ64_extra_emuls=elf64ppc
-                               targ64_extra_libpath=elf64ppc
-                               ;;
-                       *)      targ_emul=elf32ppc
-                               targ_extra_emuls="elf32ppclinux elf32ppcsim"
-                               targ_extra_libpath=elf32ppclinux
-                               targ64_extra_emuls=elf64ppc
-                               targ64_extra_libpath=elf64ppc
-                               ;;
+                       powerpc64*)
+                           targ_emul=elf64ppc
+                           targ_extra_emuls="elf32ppc elf32ppclinux elf32ppcsim"
+                           targ_extra_libpath="elf32ppc elf32ppclinux" ;;
+                       *linux*)
+                           targ_emul=elf32ppclinux
+                           targ_extra_emuls="elf32ppc elf32ppcsim"
+                           targ_extra_libpath=elf32ppc
+                           targ64_extra_emuls=elf64ppc
+                           targ64_extra_libpath=elf64ppc ;;
+                       *)
+                           targ_emul=elf32ppc
+                           targ_extra_emuls="elf32ppclinux elf32ppcsim"
+                           targ_extra_libpath=elf32ppclinux
+                           targ64_extra_emuls=elf64ppc
+                           targ64_extra_libpath=elf64ppc ;;
                        esac
+                       td=tdir_elf32ppc
+                       td64=tdir_elf64ppc
+                       s=s/ppc/lppc/g
                        case "${targ}" in
-                       powerpc*le-*)
-                               # PR 19985: Include big endian emulations.
-                               for z in targ_extra_emuls targ_extra_libpath targ64_extra_emuls targ64_extra_libpath
-                               do
-                                 eval ${z}=\"\$${z} `eval echo \\$${z} | sed -e 's/ppc/lppc/g'`\"
-                               done
-                               targ_extra_emuls="$targ_extra_emuls $targ_emul"
-                               eval targ_emul=\"`eval echo \\$targ_emul | sed -e 's/ppc/lppc/g'`\"
-                       esac ;;
+                       powerpcle-* | powerpc64le-*)
+                           for z in td td64 targ_emul targ_extra_emuls \
+                                        targ_extra_libpath targ64_extra_emuls \
+                                        targ64_extra_libpath
+                           do
+                               eval ${z}=\"\`echo \$${z} \| sed -e $s\`\"
+                           done
+                           s=s/lppc/ppc/g ;;
+                       esac
+                       # Why oh why did we set tooldir based on target_alias
+                       # rather than on target?
+                       eval tdir_${targ_emul}="${targ_alias}"
+                       cpu=`echo "${targ_alias}" | sed -e 's/-.*//'`
+                       rest=`echo "${targ_alias}" | sed -e 's/^[^-]*//'`
+                       le=le
+                       case "${cpu}" in
+                       *little) le=little
+                       esac
+                       ta32=`echo "${cpu}" | sed -e s/64//`"${rest}"
+                       ta64=`echo "${cpu}" | sed -e 's/64//;s/$/64/;s/'${le}'64$/64'${le}'/;s/be64$/64be/'`"${rest}"
+                       eval test -n \"\$${td}\" || eval ${td}="${ta32}"
+                       eval test -n \"\$${td}linux\" || eval ${td}linux="${ta32}"
+                       eval test -n \"\$${td}sim\" || eval ${td}sim="${ta32}"
+                       eval test -n \"\$${td64}\" || eval ${td64}="${ta64}"
+                       # Now provide the other endian
+                       for z in targ_extra_emuls targ_extra_libpath
+                       do
+                           eval ${z}=\"\$${z} \`echo ${targ_emul} \$${z} \| sed -e $s\`\"
+                       done
+                       for z in targ64_extra_emuls targ64_extra_libpath
+                       do
+                           eval ${z}=\"\$${z} \`echo \$${z} \| sed -e $s\`\"
+                       done
+                       td=`echo "${td}" | sed -e $s`
+                       td64=`echo "${td64}" | sed -e $s`
+                       case "${targ}" in
+                       powerpcle-* | powerpc64le-*)
+                           cpu=`echo "${cpu}" | sed -e s/${le}\$//` ;;
+                       *)
+                           cpu=`echo "${cpu}" | sed -e s/be\$//`${le} ;;
+                       esac
+                       ta32=`echo "${cpu}" | sed -e s/64//`"${rest}"
+                       ta64=`echo "${cpu}" | sed -e 's/64//;s/$/64/;s/'${le}'64$/64'${le}/`"${rest}"
+                       eval test -n \"\$${td}\" || eval ${td}="${ta32}"
+                       eval test -n \"\$${td}linux\" || eval ${td}linux="${ta32}"
+                       eval test -n \"\$${td}sim\" || eval ${td}sim="${ta32}"
+                       eval test -n \"\$${td64}\" || eval ${td64}="${ta64}"
+                       ;;
 powerpc-*-nto*)         targ_emul=elf32ppcnto ;;
 powerpcle-*-nto*)       targ_emul=elf32lppcnto ;;
 powerpc-*-rtems*)      targ_emul=elf32ppc ;;
This page took 0.029538 seconds and 4 git commands to generate.