I've backported a few Go-specific patches to the GCC 4.9 branch.

https://codereview.appspot.com/154800044

        compiler: Recognize 64-bit symbol tables in archives.

        By Dominik Vogt.

2014-11-21  Lynn Boger  <labo...@linux.vnet.ibm.com>

        * go.test/go-test.exp (go-set-goarch): Add case for ppc64le goarch
        value for go testing.

https://codereview.appspot.com/168710043

        runtime: GOARCH values for ppc64 BE & LE

        ppc64 for BE
        ppc64le for LE
        issue 8654

https://codereview.appspot.com/167780044

        debug/elf: add power64 support along with relocation test

        Backport of https://codereview.appspot.com/125910043 from the
        dev.power64 branch of the master repository.


Ian
Index: gcc/go/gofrontend/import-archive.cc
===================================================================
--- gcc/go/gofrontend/import-archive.cc (revision 219119)
+++ gcc/go/gofrontend/import-archive.cc (working copy)
@@ -295,6 +295,15 @@ Archive_file::interpret_header(const Arc
       // This is the symbol table.
       pname->clear();
     }
+  else if (hdr->ar_name[1] == 'S' && hdr->ar_name[2] == 'Y'
+          && hdr->ar_name[3] == 'M' && hdr->ar_name[4] == '6'
+          && hdr->ar_name[5] == '4' && hdr->ar_name[6] == '/'
+          && hdr->ar_name[7] == ' '
+         )
+    {
+      // 64-bit symbol table.
+      pname->clear();
+    }
   else if (hdr->ar_name[1] == '/')
     {
       // This is the extended name table.
Index: gcc/testsuite/go.test/go-test.exp
===================================================================
--- gcc/testsuite/go.test/go-test.exp   (revision 219119)
+++ gcc/testsuite/go.test/go-test.exp   (working copy)
@@ -241,7 +241,11 @@ proc go-set-goarch { } {
            if [check_effective_target_ilp32] {
                set goarch "ppc"
            } else {
-               set goarch "ppc64"
+               if [istarget "powerpc64le-*-*"] {
+                   set goarch "ppc64le"
+               } else {
+                   set goarch "ppc64"
+               }
            }
        }
        "sparc*-*-*" {
Index: libgo/configure.ac
===================================================================
--- libgo/configure.ac  (revision 219119)
+++ libgo/configure.ac  (working copy)
@@ -179,6 +179,7 @@ is_m68k=no
 mips_abi=unknown
 is_ppc=no
 is_ppc64=no
+is_ppc64le=no
 is_sparc=no
 is_sparc64=no
 is_x86_64=no
@@ -249,11 +250,18 @@ changequote([,])dnl
 #ifdef _ARCH_PPC64
 #error 64-bit
 #endif],
-[is_ppc=yes], [is_ppc64=yes])
+[is_ppc=yes],
+    [AC_COMPILE_IFELSE([
+#if defined(_BIG_ENDIAN) || defined(__BIG_ENDIAN__)
+#error 64be
+#endif],
+[is_ppc64le=yes],[is_ppc64=yes])])
     if test "$is_ppc" = "yes"; then
       GOARCH=ppc
-    else
+    elif test "$is_ppc64" = "yes"; then
       GOARCH=ppc64
+    else
+      GOARCH=ppc64le
     fi
     ;;
   sparc*-*-*)
@@ -281,6 +289,7 @@ AM_CONDITIONAL(LIBGO_IS_MIPSN64, test $m
 AM_CONDITIONAL(LIBGO_IS_MIPSO64, test $mips_abi = o64)
 AM_CONDITIONAL(LIBGO_IS_PPC, test $is_ppc = yes)
 AM_CONDITIONAL(LIBGO_IS_PPC64, test $is_ppc64 = yes)
+AM_CONDITIONAL(LIBGO_IS_PPC64LE, test $is_ppc64le = yes)
 AM_CONDITIONAL(LIBGO_IS_SPARC, test $is_sparc = yes)
 AM_CONDITIONAL(LIBGO_IS_SPARC64, test $is_sparc64 = yes)
 AM_CONDITIONAL(LIBGO_IS_X86_64, test $is_x86_64 = yes)
Index: libgo/go/debug/elf/file.go
===================================================================
--- libgo/go/debug/elf/file.go  (revision 219119)
+++ libgo/go/debug/elf/file.go  (working copy)
@@ -681,7 +681,7 @@ func (f *File) DWARF() (*dwarf.Data, err
        // If there's a relocation table for .debug_info, we have to process it
        // now otherwise the data in .debug_info is invalid for x86-64 objects.
        rela := f.Section(".rela.debug_info")
-       if rela != nil && rela.Type == SHT_RELA && (f.Machine == EM_X86_64 || 
f.Machine == EM_AARCH64) {
+       if rela != nil && rela.Type == SHT_RELA && (f.Machine == EM_X86_64 || 
f.Machine == EM_AARCH64 || f.Machine == EM_PPC64) {
                data, err := rela.Data()
                if err != nil {
                        return nil, err
Index: libgo/go/go/build/syslist.go
===================================================================
--- libgo/go/go/build/syslist.go        (revision 219119)
+++ libgo/go/go/build/syslist.go        (working copy)
@@ -5,4 +5,4 @@
 package build
 
 const goosList = "darwin dragonfly freebsd linux netbsd openbsd plan9 windows 
solaris "
-const goarchList = "386 amd64 arm arm64 alpha m68k mipso32 mipsn32 mipsn64 
mipso64 ppc ppc64 sparc sparc64 "
+const goarchList = "386 amd64 arm arm64 alpha m68k mipso32 mipsn32 mipsn64 
mipso64 ppc ppc64 ppc64le sparc sparc64 "

Reply via email to