Blame SOURCES/binutils-ppc64le-4.patch

881b8e
2014-03-12  Aldy Hernandez  <aldyh@redhat.com>
881b8e
881b8e
    Import from upstream binutils-2_24-branch:
881b8e
    
881b8e
        bfd/
881b8e
            * config.bfd: Add powerpc64le-linux.
881b8e
        gas/
881b8e
            * configure.in: Allow little-endian linux.
881b8e
            * configure: Regenerate.
881b8e
        gold/
881b8e
            * configure.tgt: Add powerpcle and powerpc64le.
881b8e
        ld/
881b8e
            * Makefile.am (ALL_EMULATION_SOURCES): Add eelf32lppclinux.c.
881b8e
            (eelf32lppclinux.c): New rule.
881b8e
            * Makefile.in: Regenerate.
881b8e
            * configure.tgt: Merge powerpc-linux and other powerpc-elf targets
881b8e
            with corresponding little-endian targets.
881b8e
            * emulparams/elf32lppc.sh: Update comment.
881b8e
            * emulparams/elf32lppclinux.sh: New.
881b8e
    
881b8e
    Also, copy over the corresponding test changes:
881b8e
    
881b8e
           testsuite/ld-powerpc/export-class.exp
881b8e
           testsuite/ld-powerpc/powerpc-64-export-class.xd
881b8e
881b8e
diff --git a/bfd/config.bfd b/bfd/config.bfd
881b8e
index ab9c705..d99e876 100644
881b8e
--- a/bfd/config.bfd
881b8e
+++ b/bfd/config.bfd
881b8e
@@ -1242,7 +1242,8 @@ case "${targ}" in
881b8e
     targ_selvecs="bfd_elf64_powerpcle_vec bfd_elf32_powerpc_vec bfd_elf32_powerpcle_vec rs6000coff_vec rs6000coff64_vec aix5coff64_vec"
881b8e
     want64=true
881b8e
     ;;
881b8e
-  powerpc64le-*-elf* | powerpcle-*-elf64*)
881b8e
+  powerpc64le-*-elf* | powerpcle-*-elf64* | powerpc64le-*-linux* | \
881b8e
+  powerpc64le-*-*bsd*)
881b8e
     targ_defvec=bfd_elf64_powerpcle_vec
881b8e
     targ_selvecs="bfd_elf64_powerpc_vec bfd_elf32_powerpcle_vec bfd_elf32_powerpc_vec rs6000coff_vec rs6000coff64_vec aix5coff64_vec"
881b8e
     want64=true
881b8e
diff --git a/gas/configure b/gas/configure
881b8e
index 05686dc..6413725 100755
881b8e
--- a/gas/configure
881b8e
+++ b/gas/configure
881b8e
@@ -12011,12 +12011,6 @@ $as_echo "$as_me: WARNING: GAS support for ${generic_target} is preliminary and
881b8e
 $as_echo "#define AIX_WEAK_SUPPORT 1" >>confdefs.h
881b8e
 
881b8e
 	;;
881b8e
-      ppc-*-linux-*)
881b8e
-	case "$endian" in
881b8e
-	  big)  ;;
881b8e
-	  *)    as_fn_error "GNU/Linux must be configured big endian" "$LINENO" 5 ;;
881b8e
-	esac
881b8e
-	;;
881b8e
       ppc-*-solaris*)
881b8e
 	if test ${this_target} = $target; then
881b8e
 
881b8e
diff --git a/gas/configure.in b/gas/configure.in
881b8e
index 88cbff8..37f6d5f 100644
881b8e
--- a/gas/configure.in
881b8e
+++ b/gas/configure.in
881b8e
@@ -176,12 +176,6 @@ changequote([,])dnl
881b8e
 	AC_DEFINE(AIX_WEAK_SUPPORT, 1,
881b8e
 		  [Define if using AIX 5.2 value for C_WEAKEXT.])
881b8e
 	;;
881b8e
-      ppc-*-linux-*)
881b8e
-	case "$endian" in
881b8e
-	  big)  ;;
881b8e
-	  *)    AC_MSG_ERROR(GNU/Linux must be configured big endian) ;;
881b8e
-	esac
881b8e
-	;;
881b8e
       ppc-*-solaris*)
881b8e
 	if test ${this_target} = $target; then
881b8e
 	  AC_DEFINE(TARGET_SOLARIS_COMMENT, 1,
881b8e
diff --git a/gold/configure.tgt b/gold/configure.tgt
881b8e
index 504de2f..d61647e 100644
881b8e
--- a/gold/configure.tgt
881b8e
+++ b/gold/configure.tgt
881b8e
@@ -104,6 +104,14 @@ powerpc-*)
881b8e
   targ_big_endian=true
881b8e
   targ_extra_big_endian=false
881b8e
   ;;
881b8e
+powerpcle-*)
881b8e
+  targ_obj=powerpc
881b8e
+  targ_machine=EM_PPC
881b8e
+  targ_size=32
881b8e
+  targ_extra_size=64
881b8e
+  targ_big_endian=false
881b8e
+  targ_extra_big_endian=true
881b8e
+  ;;
881b8e
 powerpc64-*)
881b8e
   targ_obj=powerpc
881b8e
   targ_machine=EM_PPC64
881b8e
@@ -112,6 +120,14 @@ powerpc64-*)
881b8e
   targ_big_endian=true
881b8e
   targ_extra_big_endian=false
881b8e
   ;;
881b8e
+powerpc64le-*)
881b8e
+  targ_obj=powerpc
881b8e
+  targ_machine=EM_PPC64
881b8e
+  targ_size=64
881b8e
+  targ_extra_size=32
881b8e
+  targ_big_endian=false
881b8e
+  targ_extra_big_endian=true
881b8e
+  ;;
881b8e
 armeb*-*-*|armbe*-*-*)
881b8e
  targ_obj=arm
881b8e
  targ_extra_obj=arm-reloc-property
881b8e
diff --git a/ld/Makefile.am b/ld/Makefile.am
881b8e
index 10340e8..1bbcf70 100644
881b8e
--- a/ld/Makefile.am
881b8e
+++ b/ld/Makefile.am
881b8e
@@ -248,6 +248,7 @@ ALL_EMULATION_SOURCES = \
881b8e
 	eelf32lm32fd.c \
881b8e
 	eelf32lmip.c \
881b8e
 	eelf32lppc.c \
881b8e
+	eelf32lppclinux.c \
881b8e
 	eelf32lppcnto.c \
881b8e
 	eelf32lppcsim.c \
881b8e
 	eelf32lsmip.c \
881b8e
@@ -1107,6 +1108,12 @@ eelf32lppc.c: $(srcdir)/emulparams/elf32lppc.sh \
881b8e
   ldemul-list.h \
881b8e
   $(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
881b8e
 	${GENSCRIPTS} elf32lppc "$(tdir_elf32lppc)"
881b8e
+eelf32lppclinux.c: $(srcdir)/emulparams/elf32lppclinux.sh \
881b8e
+  $(srcdir)/emulparams/elf32lppc.sh $(srcdir)/emulparams/elf32ppc.sh \
881b8e
+  $(srcdir)/emulparams/elf32ppccommon.sh $(srcdir)/emultempl/ppc32elf.em \
881b8e
+  ldemul-list.h \
881b8e
+  $(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
881b8e
+	${GENSCRIPTS} elf32lppclinux "$(tdir_elf32lppclinux)"
881b8e
 eelf32lppcnto.c: $(srcdir)/emulparams/elf32lppcnto.sh \
881b8e
   $(srcdir)/emulparams/elf32ppc.sh $(srcdir)/emulparams/elf32ppccommon.sh \
881b8e
   $(srcdir)/emultempl/ppc32elf.em $(ELF_DEPS) \
881b8e
diff --git a/ld/Makefile.in b/ld/Makefile.in
881b8e
index 52fb9d6..449845d 100644
881b8e
--- a/ld/Makefile.in
881b8e
+++ b/ld/Makefile.in
881b8e
@@ -555,6 +555,7 @@ ALL_EMULATION_SOURCES = \
881b8e
 	eelf32lm32fd.c \
881b8e
 	eelf32lmip.c \
881b8e
 	eelf32lppc.c \
881b8e
+	eelf32lppclinux.c \
881b8e
 	eelf32lppcnto.c \
881b8e
 	eelf32lppcsim.c \
881b8e
 	eelf32lsmip.c \
881b8e
@@ -1188,6 +1189,7 @@ distclean-compile:
881b8e
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32lm32fd.Po@am__quote@
881b8e
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32lmip.Po@am__quote@
881b8e
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32lppc.Po@am__quote@
881b8e
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32lppclinux.Po@am__quote@
881b8e
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32lppcnto.Po@am__quote@
881b8e
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32lppcsim.Po@am__quote@
881b8e
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32lr5900.Po@am__quote@
881b8e
@@ -2591,6 +2593,12 @@ eelf32lppc.c: $(srcdir)/emulparams/elf32lppc.sh \
881b8e
   ldemul-list.h \
881b8e
   $(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
881b8e
 	${GENSCRIPTS} elf32lppc "$(tdir_elf32lppc)"
881b8e
+eelf32lppclinux.c: $(srcdir)/emulparams/elf32lppclinux.sh \
881b8e
+  $(srcdir)/emulparams/elf32lppc.sh $(srcdir)/emulparams/elf32ppc.sh \
881b8e
+  $(srcdir)/emulparams/elf32ppccommon.sh $(srcdir)/emultempl/ppc32elf.em \
881b8e
+  ldemul-list.h \
881b8e
+  $(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
881b8e
+	${GENSCRIPTS} elf32lppclinux "$(tdir_elf32lppclinux)"
881b8e
 eelf32lppcnto.c: $(srcdir)/emulparams/elf32lppcnto.sh \
881b8e
   $(srcdir)/emulparams/elf32ppc.sh $(srcdir)/emulparams/elf32ppccommon.sh \
881b8e
   $(srcdir)/emultempl/ppc32elf.em $(ELF_DEPS) \
881b8e
diff --git a/ld/configure.tgt b/ld/configure.tgt
881b8e
index bc92a20..dbc50a3 100644
881b8e
--- a/ld/configure.tgt
881b8e
+++ b/ld/configure.tgt
881b8e
@@ -541,56 +541,44 @@ powerpc64-*-freebsd*)
881b8e
 			tdir_elf32ppc=`echo "${targ_alias}" | sed -e 's/64//'`
881b8e
 			tdir_elf32ppc_fbsd=$tdir_elf32ppc
881b8e
 			;;
881b8e
-powerpc*-*-linux*)	case "${targ}" in
881b8e
+powerpc-*-vxworks*)
881b8e
+			targ_emul=elf32ppcvxworks
881b8e
+			targ_extra_emuls="elf32ppc elf32ppclinux elf32ppcsim" ;;
881b8e
+powerpc*-*-elf* | powerpc*-*-eabi* | powerpc*-*-sysv* \
881b8e
+  | powerpc*-*-linux* | powerpc*-*-netbsd* | powerpc*-*-openbsd* \
881b8e
+  | powerpc*-*-solaris* | powerpc*-*-kaos* | powerpc*-*-vxworks*)
881b8e
+			case "${targ}" in
881b8e
 			*64*)	targ_emul=elf64ppc
881b8e
-				targ_extra_emuls="elf32ppclinux elf32ppc elf32ppcsim"
881b8e
-				targ_extra_libpath="elf32ppclinux elf32ppc"
881b8e
-				tdir_elf32ppc=`echo "${targ_alias}" | sed -e 's/64//'`
881b8e
-				tdir_elf32ppclinux=$tdir_elf32ppc
881b8e
-				tdir_elf32ppcsim=$tdir_elf32ppc
881b8e
+				targ_extra_emuls="elf32ppc elf32ppclinux elf32ppcsim"
881b8e
+				targ_extra_libpath="elf32ppc elf32ppclinux"
881b8e
+				td=tdir_elf32ppc
881b8e
+				case "${targ}" in
881b8e
+				powerpc*le-*) td=tdir_elf32lppc;;
881b8e
+				esac
881b8e
+				eval ${td}=`echo "${targ_alias}" | sed -e 's/64//'`
881b8e
+				eval ${td}linux=\$${td}
881b8e
+				eval ${td}sim=\$${td}
881b8e
 				;;
881b8e
-			*)	targ_emul=elf32ppclinux
881b8e
+			*linux*) targ_emul=elf32ppclinux
881b8e
 				targ_extra_emuls="elf32ppc elf32ppcsim"
881b8e
 				targ_extra_libpath=elf32ppc
881b8e
 				targ64_extra_emuls=elf64ppc
881b8e
 				targ64_extra_libpath=elf64ppc
881b8e
 				;;
881b8e
-			esac ;;
881b8e
-powerpc*le-*-elf* | powerpc*le-*-eabi* | powerpc*le-*-solaris* \
881b8e
-  | powerpc*le-*-sysv* | powerpc*le-*-vxworks*)
881b8e
-			case "${targ}" in
881b8e
-			*64*)	targ_emul=elf64lppc
881b8e
-				targ_extra_emuls="elf32lppc elf32lppcsim"
881b8e
-				targ_extra_libpath=elf32lppc
881b8e
-				tdir_elf32lppc=`echo "${targ_alias}" | sed -e 's/64//'`
881b8e
-				tdir_elf32lppcsim=$tdir_elf32lppc
881b8e
-				;;
881b8e
-			*)	targ_emul=elf32lppc
881b8e
-				targ_extra_emuls=elf32lppcsim
881b8e
-				targ64_extra_emuls=elf64lppc
881b8e
-				targ64_extra_libpath=elf64lppc
881b8e
-				;;
881b8e
-			esac ;;
881b8e
-powerpc*-*-elf* | powerpc*-*-eabi* | powerpc*-*-sysv* \
881b8e
-  | powerpc*-*-netbsd* | powerpc-*-openbsd* | powerpc*-*-kaos*)
881b8e
-			case "${targ}" in
881b8e
-			*64*)	targ_emul=elf64ppc
881b8e
-				targ_extra_emuls="elf32ppc elf32ppclinux elf32ppcsim"
881b8e
-				targ_extra_libpath="elf32ppc elf32ppclinux"
881b8e
-				tdir_elf32ppc=`echo "${targ_alias}" | sed -e 's/64//'`
881b8e
-				tdir_elf32ppclinux=$tdir_elf32ppc
881b8e
-				tdir_elf32ppcsim=$tdir_elf32ppc
881b8e
-				;;
881b8e
 			*)	targ_emul=elf32ppc
881b8e
 				targ_extra_emuls="elf32ppclinux elf32ppcsim"
881b8e
 				targ_extra_libpath=elf32ppclinux
881b8e
 				targ64_extra_emuls=elf64ppc
881b8e
 				targ64_extra_libpath=elf64ppc
881b8e
 				;;
881b8e
+			esac
881b8e
+			case "${targ}" in
881b8e
+			powerpc*le-*)
881b8e
+				for z in targ_emul targ_extra_emuls targ_extra_libpath targ64_extra_emuls targ64_extra_libpath
881b8e
+				do
881b8e
+				  eval ${z}=\"`eval echo \\$${z} | sed -e 's/ppc/lppc/g'`\"
881b8e
+				done
881b8e
 			esac ;;
881b8e
-powerpc-*-vxworks*)
881b8e
-			targ_emul=elf32ppcvxworks
881b8e
-			targ_extra_emuls="elf32ppc elf32ppclinux elf32ppcsim" ;;
881b8e
 powerpc-*-nto*)         targ_emul=elf32ppcnto ;;
881b8e
 powerpcle-*-nto*)       targ_emul=elf32lppcnto ;;
881b8e
 powerpc-*-rtems*)	targ_emul=elf32ppc ;;
881b8e
diff --git a/ld/emulparams/elf32lppc.sh b/ld/emulparams/elf32lppc.sh
881b8e
index 18cce48..8d4e3a0 100644
881b8e
--- a/ld/emulparams/elf32lppc.sh
881b8e
+++ b/ld/emulparams/elf32lppc.sh
881b8e
@@ -1,5 +1,5 @@
881b8e
 # If you change this file, please also look at files which source this one:
881b8e
-# elf32lppcsim.sh
881b8e
+# elf32lppcsim.sh elf32lppclinux.sh
881b8e
 
881b8e
 . ${srcdir}/emulparams/elf32ppc.sh
881b8e
 OUTPUT_FORMAT="elf32-powerpcle"
881b8e
diff --git a/ld/emulparams/elf32lppclinux.sh b/ld/emulparams/elf32lppclinux.sh
881b8e
new file mode 100644
881b8e
index 0000000..9a56372
881b8e
--- /dev/null
881b8e
+++ b/ld/emulparams/elf32lppclinux.sh
881b8e
@@ -0,0 +1,8 @@
881b8e
+. ${srcdir}/emulparams/elf32lppc.sh
881b8e
+TEXT_START_ADDR=0x10000000
881b8e
+unset EXECUTABLE_SYMBOLS
881b8e
+unset OTHER_END_SYMBOLS
881b8e
+test -z "${RELOCATING}" || OTHER_SECTIONS="/DISCARD/	: { *(.fixup) }"
881b8e
+OTHER_RELRO_SECTIONS="
881b8e
+  .got1         ${RELOCATING-0} : { *(.got1) }
881b8e
+  .got2         ${RELOCATING-0} : { *(.got2) }"
881b8e
diff --git a/ld/testsuite/ld-powerpc/export-class.exp b/ld/testsuite/ld-powerpc/export-class.exp
881b8e
index 5b721fc..6171d13 100644
881b8e
--- a/ld/testsuite/ld-powerpc/export-class.exp
881b8e
+++ b/ld/testsuite/ld-powerpc/export-class.exp
881b8e
@@ -30,22 +30,11 @@ if { ![istarget powerpc*-*-linux*] } {
881b8e
     return
881b8e
 }
881b8e
 
881b8e
-proc supports_ppc64 { } {
881b8e
-    global ld
881b8e
+proc powerpc_export_class_test { abi endian emul } {
881b8e
 
881b8e
-    catch "exec $ld --help | grep emulations" tmp
881b8e
-    if [string match "*elf64ppc*" $tmp] then {
881b8e
-	return 1
881b8e
-    } else {
881b8e
-	return 0
881b8e
-    }
881b8e
-}
881b8e
-
881b8e
-proc powerpc_export_class_test { abi emul } {
881b8e
-
881b8e
-    set testname "PowerPC $abi symbol export class test"
881b8e
+    set testname "PowerPC $abi $endian symbol export class test"
881b8e
 
881b8e
-    set AFLAGS "-a$abi -be"
881b8e
+    set AFLAGS "-a$abi -$endian"
881b8e
     set LDFLAGS "-m$emul"
881b8e
 
881b8e
     # Build an auxiliary shared object with conflicting versioned symbol
881b8e
@@ -96,11 +85,13 @@ proc powerpc_export_class_test { abi emul } {
881b8e
     ]
881b8e
 }
881b8e
 
881b8e
-if { [supports_ppc64] } {
881b8e
-    set abis { 32 elf32ppclinux 64 elf64ppc }
881b8e
-} else {
881b8e
-    set abis { 32 elf32ppclinux }
881b8e
-}
881b8e
-foreach { abi emul } $abis {
881b8e
-    powerpc_export_class_test $abi $emul
881b8e
+set abis { 32 be elf32ppclinux 32 le elf32lppclinux 64 be elf64ppc 64 le elf64lppc }
881b8e
+
881b8e
+global ld
881b8e
+catch "exec $ld --help | grep emulations" ldemul
881b8e
+
881b8e
+foreach { abi endian emul } $abis {
881b8e
+    if { [string first $emul $ldemul] != -1 } then {
881b8e
+	powerpc_export_class_test $abi $endian $emul
881b8e
+    }
881b8e
 }
881b8e
diff --git a/ld/testsuite/ld-powerpc/powerpc-64-export-class.xd b/ld/testsuite/ld-powerpc/powerpc-64-export-class.xd
881b8e
index d0388ad..264803c 100644
881b8e
--- a/ld/testsuite/ld-powerpc/powerpc-64-export-class.xd
881b8e
+++ b/ld/testsuite/ld-powerpc/powerpc-64-export-class.xd
881b8e
@@ -1,11 +1,11 @@
881b8e
 Hex dump of section '\.data':
881b8e
-  0x12340000 00000000 123400a0 00000000 00000000 .*
881b8e
-  0x12340010 00000000 123400a0 00000000 00000000 .*
881b8e
-  0x12340020 00000000 123400a0 00000000 00000000 .*
881b8e
-  0x12340030 00000000 00000000 00000000 00000000 .*
881b8e
-  0x12340040 00000000 123400a0 00000000 00000000 .*
881b8e
-  0x12340050 00000000 123400a0 00000000 00000000 .*
881b8e
-  0x12340060 00000000 123400a0 00000000 00000000 .*
881b8e
-  0x12340070 00000000 123400a0 00000000 00000000 .*
881b8e
-  0x12340080 00000000 123400a0 00000000 00000000 .*
881b8e
-  0x12340090 00000000 123400a0 00000000 00000000 .*
881b8e
+  0x12340000 (00000000|a0003412) (123400a0|00000000) 00000000 00000000 .*
881b8e
+  0x12340010 (00000000|a0003412) (123400a0|00000000) 00000000 00000000 .*
881b8e
+  0x12340020 (00000000|a0003412) (123400a0|00000000) 00000000 00000000 .*
881b8e
+  0x12340030 (00000000|00000000) (00000000|00000000) 00000000 00000000 .*
881b8e
+  0x12340040 (00000000|a0003412) (123400a0|00000000) 00000000 00000000 .*
881b8e
+  0x12340050 (00000000|a0003412) (123400a0|00000000) 00000000 00000000 .*
881b8e
+  0x12340060 (00000000|a0003412) (123400a0|00000000) 00000000 00000000 .*
881b8e
+  0x12340070 (00000000|a0003412) (123400a0|00000000) 00000000 00000000 .*
881b8e
+  0x12340080 (00000000|a0003412) (123400a0|00000000) 00000000 00000000 .*
881b8e
+  0x12340090 (00000000|a0003412) (123400a0|00000000) 00000000 00000000 .*