Index: libgo/go/debug/elf/elf.go
===================================================================
--- libgo/go/debug/elf/elf.go	(revision 218639)
+++ libgo/go/debug/elf/elf.go	(working copy)
@@ -1246,6 +1246,242 @@ var r386Strings = []intName{
 func (i R_386) String() string   { return stringName(uint32(i), r386Strings, false) }
 func (i R_386) GoString() string { return stringName(uint32(i), r386Strings, true) }
 
+// Relocation types for ppc64.
+type R_PPC64 int
+
+const (
+	R_PPC64_NONE                R_PPC64 = 0 /* No relocation. */
+	R_PPC64_ADDR32              R_PPC64 = 1
+	R_PPC64_ADDR24              R_PPC64 = 2
+	R_PPC64_ADDR16              R_PPC64 = 3
+	R_PPC64_ADDR16_LO           R_PPC64 = 4
+	R_PPC64_ADDR16_HI           R_PPC64 = 5
+	R_PPC64_ADDR16_HA           R_PPC64 = 6
+	R_PPC64_ADDR14              R_PPC64 = 7
+	R_PPC64_ADDR14_BRTAKEN      R_PPC64 = 8
+	R_PPC64_ADDR14_BRNTAKEN     R_PPC64 = 9
+	R_PPC64_REL24               R_PPC64 = 10
+	R_PPC64_REL14               R_PPC64 = 11
+	R_PPC64_REL14_BRTAKEN       R_PPC64 = 12
+	R_PPC64_REL14_BRNTAKEN      R_PPC64 = 13
+	R_PPC64_GOT16               R_PPC64 = 14
+	R_PPC64_GOT16_LO            R_PPC64 = 15
+	R_PPC64_GOT16_HI            R_PPC64 = 16
+	R_PPC64_GOT16_HA            R_PPC64 = 17
+				    
+	R_PPC64_COPY                R_PPC64 = 19
+	R_PPC64_GLOB_DAT            R_PPC64 = 20
+	R_PPC64_JMP_SLOT            R_PPC64 = 21
+	R_PPC64_RELATIVE            R_PPC64 = 22
+				    
+	R_PPC64_UADDR32             R_PPC64 = 24
+	R_PPC64_UADDR16             R_PPC64 = 25
+	R_PPC64_REL32               R_PPC64 = 26
+	R_PPC64_PLT32               R_PPC64 = 27
+	R_PPC64_PLTREL32            R_PPC64 = 28
+	R_PPC64_PLT16_LO            R_PPC64 = 29
+	R_PPC64_PLT16_HI            R_PPC64 = 30
+	R_PPC64_PLT16_HA            R_PPC64 = 31
+				    
+	R_PPC64_SECTOFF             R_PPC64 = 33
+	R_PPC64_SECTOFF_LO          R_PPC64 = 34
+	R_PPC64_SECTOFF_HI          R_PPC64 = 35
+	R_PPC64_SECTOFF_HA          R_PPC64 = 36
+	R_PPC64_REL30	            R_PPC64 = 37
+	R_PPC64_ADDR64		    R_PPC64 = 38
+	R_PPC64_ADDR16_HIGHER	    R_PPC64 = 39
+	R_PPC64_ADDR16_HIGHERA	    R_PPC64 = 40
+	R_PPC64_ADDR16_HIGHEST	    R_PPC64 = 41
+	R_PPC64_ADDR16_HIGHESTA     R_PPC64 = 42
+	R_PPC64_UADDR64		    R_PPC64 = 43
+	R_PPC64_REL64		    R_PPC64 = 44
+	R_PPC64_PLT64		    R_PPC64 = 45
+	R_PPC64_PLTREL64	    R_PPC64 = 46
+	R_PPC64_TOC16		    R_PPC64 = 47
+	R_PPC64_TOC16_LO	    R_PPC64 = 48
+	R_PPC64_TOC16_HI	    R_PPC64 = 49
+	R_PPC64_TOC16_HA	    R_PPC64 = 50
+	R_PPC64_TOC		    R_PPC64 = 51
+	R_PPC64_PLTGOT16	    R_PPC64 = 52
+	R_PPC64_PLTGOT16_LO	    R_PPC64 = 53
+	R_PPC64_PLTGOT16_HI	    R_PPC64 = 54
+	R_PPC64_PLTGOT16_HA	    R_PPC64 = 55
+				    
+	R_PPC64_ADDR16_DS	    R_PPC64 = 56
+	R_PPC64_ADDR16_LO_DS	    R_PPC64 = 57
+	R_PPC64_GOT16_DS	    R_PPC64 = 58
+	R_PPC64_GOT16_LO_DS	    R_PPC64 = 59
+	R_PPC64_PLT16_LO_DS	    R_PPC64 = 60
+	R_PPC64_SECTOFF_DS	    R_PPC64 = 61
+	R_PPC64_SECTOFF_LO_DS	    R_PPC64 = 62
+	R_PPC64_TOC16_DS	    R_PPC64 = 63
+	R_PPC64_TOC16_LO_DS	    R_PPC64 = 64
+	R_PPC64_PLTGOT16_DS	    R_PPC64 = 65
+	R_PPC64_PLTGOT16_LO_DS	    R_PPC64 = 66
+				    
+	R_PPC64_TLS		    R_PPC64 = 67
+	R_PPC64_DTPMOD64	    R_PPC64 = 68
+	R_PPC64_TPREL16		    R_PPC64 = 69
+	R_PPC64_TPREL16_LO 	    R_PPC64 = 70
+	R_PPC64_TPREL16_HI          R_PPC64 = 71
+	R_PPC64_TPREL16_HA          R_PPC64 = 72
+	R_PPC64_TPREL64       	    R_PPC64 = 73
+	R_PPC64_DTPREL16            R_PPC64 = 74
+	R_PPC64_DTPREL16_LO   	    R_PPC64 = 75
+	R_PPC64_DTPREL16_HI   	    R_PPC64 = 76
+	R_PPC64_DTPREL16_HA         R_PPC64 = 77
+	R_PPC64_DTPREL64            R_PPC64 = 78
+	R_PPC64_GOT_TLSGD16    	    R_PPC64 = 79
+	R_PPC64_GOT_TLSGD16_LO      R_PPC64 = 80
+	R_PPC64_GOT_TLSGD16_HI      R_PPC64 = 81
+	R_PPC64_GOT_TLSGD16_HA      R_PPC64 = 82
+	R_PPC64_GOT_TLSLD16         R_PPC64 = 83
+	R_PPC64_GOT_TLSLD16_LO      R_PPC64 = 84
+	R_PPC64_GOT_TLSLD16_HI      R_PPC64 = 85
+	R_PPC64_GOT_TLSLD16_HA      R_PPC64 = 86
+	R_PPC64_GOT_TPREL16_DS      R_PPC64 = 87
+	R_PPC64_GOT_TPREL16_LO_DS   R_PPC64 = 88
+	R_PPC64_GOT_TPREL16_HI	    R_PPC64 = 89
+	R_PPC64_GOT_TPREL16_HA      R_PPC64 = 90
+	R_PPC64_GOT_DTPREL16_DS     R_PPC64 = 91
+	R_PPC64_GOT_DTPREL16_LO_DS  R_PPC64 = 92
+	R_PPC64_GOT_DTPREL16_HI     R_PPC64 = 93
+	R_PPC64_GOT_DTPREL16_HA     R_PPC64 = 94
+	R_PPC64_TPREL16_DS	    R_PPC64 = 95
+	R_PPC64_TPREL16_LO_DS       R_PPC64 = 96
+	R_PPC64_TPREL16_HIGHER      R_PPC64 = 97
+	R_PPC64_TPREL16_HIGHERA     R_PPC64 = 98
+	R_PPC64_TPREL16_HIGHEST     R_PPC64 = 99
+	R_PPC64_TPREL16_HIGHESTA    R_PPC64 = 100
+	R_PPC64_DTPREL16_DS	    R_PPC64 = 101
+	R_PPC64_DTPREL16_LO_DS      R_PPC64 = 102
+	R_PPC64_DTPREL16_HIGHER     R_PPC64 = 103
+	R_PPC64_DTPREL16_HIGHERA    R_PPC64 = 104
+	R_PPC64_DTPREL16_HIGHEST    R_PPC64 = 105
+	R_PPC64_DTPREL16_HIGHESTA   R_PPC64 = 106
+
+	R_PPC64_GNU_VTINHERIT	    R_PPC64 = 253
+	R_PPC64_GNU_VTENTRY	    R_PPC64 = 254
+)
+
+var rppc64Strings = []intName{
+        {0, "R_PPC64_NONE"},
+	{1, "R_PPC64_ADDR32"},
+	{2, "R_PPC64_ADDR24"},
+	{3, "R_PPC64_ADDR16"},
+	{4, "R_PPC64_ADDR16_LO"},
+	{5, "R_PPC64_ADDR16_HI"},
+	{6, "R_PPC64_ADDR16_HA"},
+	{7, "R_PPC64_ADDR14"},
+	{8, "R_PPC64_ADDR14_BRTAKEN"},
+	{9, "R_PPC64_ADDR14_BRNTAKEN"},
+	{10, "R_PPC64_REL24"},
+	{11, "R_PPC64_REL14"},
+	{12, "R_PPC64_REL14_BRTAKEN"},
+	{13, "R_PPC64_REL14_BRNTAKEN"},
+	{14, "R_PPC64_GOT16"},
+	{15, "R_PPC64_GOT16_LO"},
+	{16, "R_PPC64_GOT16_HI"},
+	{17, "R_PPC64_GOT16_HA"},
+
+	{19, "R_PPC64_COPY"},
+	{20, "R_PPC64_GLOB_DAT"},
+	{21, "R_PPC64_JMP_SLOT"},
+	{22, "R_PPC64_RELATIVE"},
+
+	{24, "R_PPC64_UADDR32"},
+	{25, "R_PPC64_UADDR16"},
+	{26, "R_PPC64_REL32"},
+	{27, "R_PPC64_PLT32"},
+	{28, "R_PPC64_PLTREL32"},
+	{29, "R_PPC64_PLT16_LO"},
+	{30, "R_PPC64_PLT16_HI"},
+	{31, "R_PPC64_PLT16_HA"},
+
+	{33, "R_PPC64_SECTOFF"},
+	{34, "R_PPC64_SECTOFF_LO"},
+	{35, "R_PPC64_SECTOFF_HI"},
+	{36, "R_PPC64_SECTOFF_HA"},
+	{37, "R_PPC64_REL30"},
+	{38, "R_PPC64_ADDR64"},
+	{39, "R_PPC64_ADDR16_HIGHER"},
+	{40, "R_PPC64_ADDR16_HIGHERA"},
+	{41, "R_PPC64_ADDR16_HIGHEST"},
+	{42, "R_PPC64_ADDR16_HIGHESTA"},
+	{43, "R_PPC64_UADDR64"},
+	{44, "R_PPC64_REL64"},
+	{45, "R_PPC64_PLT64"},
+	{46, "R_PPC64_PLTREL64"},
+	{47, "R_PPC64_TOC16"},
+	{48, "R_PPC64_TOC16_LO"},
+	{49, "R_PPC64_TOC16_HI"},
+	{50, "R_PPC64_TOC16_HA"},
+	{51, "R_PPC64_TOC"},
+	{52, "R_PPC64_PLTGOT16"},
+	{53, "R_PPC64_PLTGOT16_LO"},
+	{54, "R_PPC64_PLTGOT16_HI"},
+	{55, "R_PPC64_PLTGOT16_HA"},
+
+	{56, "R_PPC64_ADDR16_DS"},
+	{57, "R_PPC64_ADDR16_LO_DS"},
+	{58, "R_PPC64_GOT16_DS"},
+	{59, "R_PPC64_GOT16_LO_DS"},
+	{60, "R_PPC64_PLT16_LO_DS"},
+	{61, "R_PPC64_SECTOFF_DS"},
+	{62, "R_PPC64_SECTOFF_LO_DS"},
+	{63, "R_PPC64_TOC16_DS"},
+	{64, "R_PPC64_TOC16_LO_DS"},
+	{65, "R_PPC64_PLTGOT16_DS"},
+	{66, "R_PPC64_PLTGOT16_LO_DS"},
+
+	{67, "R_PPC64_TLS"},
+	{68, "R_PPC64_DTPMOD64"},
+	{69, "R_PPC64_TPREL16"},
+	{70, "R_PPC64_TPREL16_LO"},
+	{71, "R_PPC64_TPREL16_HI"},
+	{72, "R_PPC64_TPREL16_HA"},
+	{73, "R_PPC64_TPREL64"},
+	{74, "R_PPC64_DTPREL16"},
+	{75, "R_PPC64_DTPREL16_LO"},
+	{76, "R_PPC64_DTPREL16_HI"},
+	{77, "R_PPC64_DTPREL16_HA"},
+	{78, "R_PPC64_DTPREL64"},
+	{79, "R_PPC64_GOT_TLSGD16"},
+	{80, "R_PPC64_GOT_TLSGD16_LO"},
+	{81, "R_PPC64_GOT_TLSGD16_HI"},
+	{82, "R_PPC64_GOT_TLSGD16_HA"},
+	{83, "R_PPC64_GOT_TLSLD16"},
+	{84, "R_PPC64_GOT_TLSLD16_LO"},
+	{85, "R_PPC64_GOT_TLSLD16_HI"},
+	{86, "R_PPC64_GOT_TLSLD16_HA"},
+	{87, "R_PPC64_GOT_TPREL16_DS"},
+	{88, "R_PPC64_GOT_TPREL16_LO_DS"},
+	{89, "R_PPC64_GOT_TPREL16_HI"},
+	{90, "R_PPC64_GOT_TPREL16_HA"},
+	{91, "R_PPC64_GOT_DTPREL16_DS"},
+	{92, "R_PPC64_GOT_DTPREL16_LO_DS"},
+	{93, "R_PPC64_GOT_DTPREL16_HI"},
+	{94, "R_PPC64_GOT_DTPREL16_HA"},
+	{95, "R_PPC64_TPREL16_DS"},
+	{96, "R_PPC64_TPREL16_LO_DS"},
+	{97, "R_PPC64_TPREL16_HIGHER"},
+	{98, "R_PPC64_TPREL16_HIGHERA"},
+	{99, "R_PPC64_TPREL16_HIGHEST"},
+	{100, "R_PPC64_TPREL16_HIGHESTA"},
+	{101, "R_PPC64_DTPREL16_DS"},
+	{102, "R_PPC64_DTPREL16_LO_DS"},
+	{103, "R_PPC64_DTPREL16_HIGHER"},
+	{104, "R_PPC64_DTPREL16_HIGHERA"},
+	{105, "R_PPC64_DTPREL16_HIGHEST"},
+	{106, "R_PPC64_DTPREL16_HIGHESTA"},
+
+	{253, "R_PPC64_GNU_VTINHERIT"},
+	{254, "R_PPC64_GNU_VTENTRY"},
+}
+
+func (i R_PPC64) String() string   { return stringName(uint32(i), rppc64Strings, false) }
+func (i R_PPC64) GoString() string { return stringName(uint32(i), rppc64Strings, true) }
+
 // Relocation types for PowerPC.
 type R_PPC int
 
Index: libgo/go/debug/elf/file.go
===================================================================
--- libgo/go/debug/elf/file.go	(revision 218639)
+++ libgo/go/debug/elf/file.go	(working copy)
@@ -1,4 +1,4 @@
-// Copyright 2009 The Go Authors.  All rights reserved.
+
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
@@ -519,6 +519,9 @@ func (f *File) applyRelocations(dst []byte, rels [
 	if f.Class == ELFCLASS64 && f.Machine == EM_X86_64 {
 		return f.applyRelocationsAMD64(dst, rels)
 	}
+	if f.Class == ELFCLASS64 && f.Machine == EM_PPC64 {
+		return f.applyRelocationsPPC64(dst, rels)
+	}
 	if f.Class == ELFCLASS64 && f.Machine == EM_AARCH64 {
 		return f.applyRelocationsARM64(dst, rels)
 	}
@@ -615,6 +618,46 @@ func (f *File) applyRelocationsARM64(dst []byte, r
 	return nil
 }
 
+func (f *File) applyRelocationsPPC64(dst []byte, rels []byte) error {
+	if len(rels)%Sym64Size != 0 {
+		return errors.New("length of relocation section is not a multiple of Sym64Size")
+	}
+
+	symbols, _, err := f.getSymbols(SHT_SYMTAB)
+	if err != nil {
+		return err
+	}
+
+	b := bytes.NewBuffer(rels)
+	var rela Rela64
+
+	for b.Len() > 0 {
+		binary.Read(b, f.ByteOrder, &rela)
+		symNo := rela.Info >> 32
+		t := R_PPC64(rela.Info & 0xffff)
+
+		if symNo == 0 || symNo > uint64(len(symbols)) {
+			continue
+		}
+		sym := &symbols[symNo-1]
+
+	switch t {
+		case R_PPC64_ADDR64:
+			if rela.Off+8 >= uint64(len(dst)) || rela.Addend < 0 {
+				continue
+			}
+			f.ByteOrder.PutUint64(dst[rela.Off:rela.Off+8], uint64(rela.Addend) + uint64(sym.Value))
+		case R_PPC64_ADDR32:
+			if rela.Off+4 >= uint64(len(dst)) || rela.Addend < 0 {
+				continue
+			}
+			f.ByteOrder.PutUint32(dst[rela.Off:rela.Off+4], uint32(rela.Addend) + uint32(sym.Value))
+		}
+	}
+
+	return nil
+}
+
 func (f *File) DWARF() (*dwarf.Data, error) {
 	// There are many other DWARF sections, but these
 	// are the required ones, and the debug/dwarf package
Index: libgo/go/debug/elf/file_test.go
===================================================================
--- libgo/go/debug/elf/file_test.go	(revision 218639)
+++ libgo/go/debug/elf/file_test.go	(working copy)
@@ -261,6 +261,12 @@ var relocationTests = []relocationTest{
 		},
 	},
 	{
+		"testdata/go-relocation-test-gcc447-ppc64.obj",
+		[]relocationTestEntry{
+			{0, &dwarf.Entry{Offset: 0xb, Tag: dwarf.TagCompileUnit, Children: true, Field: []dwarf.Field{dwarf.Field{Attr: dwarf.AttrProducer, Val: "GNU C 4.4.7 20120313 (Red Hat 4.4.7-4)"}, dwarf.Field{Attr: dwarf.AttrLanguage, Val: int64(1)}, dwarf.Field{Attr: dwarf.AttrName, Val: "t.c"}, dwarf.Field{Attr: dwarf.AttrCompDir, Val: "/tmp"}, dwarf.Field{Attr: dwarf.AttrLowpc, Val: uint64(0x0)}, dwarf.Field{Attr: dwarf.AttrHighpc, Val: uint64(0x24)}, dwarf.Field{Attr: dwarf.AttrStmtList, Val: int64(0)}}}},
+		},
+	},
+	{
 		"testdata/gcc-amd64-openbsd-debug-with-rela.obj",
 		[]relocationTestEntry{
 			{203, &dwarf.Entry{Offset: 0xc62, Tag: dwarf.TagMember, Children: false, Field: []dwarf.Field{{Attr: dwarf.AttrName, Val: "it_interval"}, {Attr: dwarf.AttrDeclFile, Val: int64(7)}, {Attr: dwarf.AttrDeclLine, Val: int64(236)}, {Attr: dwarf.AttrType, Val: dwarf.Offset(0xb7f)}, {Attr: dwarf.AttrDataMemberLoc, Val: []byte{0x23, 0x0}}}}},
