mirror of
https://github.com/dslm4515/BMLFS.git
synced 2025-08-13 14:24:02 +00:00
Upgraded Google's Go compiler with go-bootstrap
This commit is contained in:
@ -1,55 +0,0 @@
|
||||
#! /bin/bash
|
||||
|
||||
# go[lang]
|
||||
# Source: https://golang.org/dl/go1.15.5.src.tar.gz
|
||||
#
|
||||
# $BUILD = Directory to temporarily install
|
||||
# $PKGS = Directory to store built packages
|
||||
#
|
||||
# DEPS
|
||||
# Required: patchelf, gcc-go
|
||||
# Recommended: NONE
|
||||
# Optional: NONE
|
||||
|
||||
cd go/src &&
|
||||
|
||||
./make.bash &&
|
||||
|
||||
cd .. &&
|
||||
sudo -S mkdir -pv ${BUILD}/usr/bin &&
|
||||
sudo -S mkdir -pv ${BUILD}/usr/lib/go &&
|
||||
sudo -S mkdir -pv ${BUILD}/usr/share/go &&
|
||||
sudo -S cp -dv bin/{go,gofmt} ${BUILD}/usr/bin/ &&
|
||||
sudo -S cp -av pkg src lib ${BUILD}/usr/lib/go &&
|
||||
sudo -S cp -rv doc misc -t ${BUILD}/usr/share/go &&
|
||||
sudo -S ln -s /usr/share/go/doc ${BUILD}/usr/lib/go/doc &&
|
||||
sudo -S ln -sf /usr/bin ${BUILD}/usr/lib/go/bin &&
|
||||
sudo -S ln -sfr ${BUILD}/usr/share/go/misc ${BUILD}/usr/lib/go/misc &&
|
||||
|
||||
sudo -S rm -fv ${BUILD}/usr/lib/go/pkg/tool/*/api &&
|
||||
|
||||
cd $BUILD && sudo -S mkdir -v ${BUILD}/install &&
|
||||
cat > /tmp/slack-desc << "EOF"
|
||||
# HOW TO EDIT THIS FILE:
|
||||
# The "handy ruler" below makes it easier to edit a package description. Line
|
||||
# up the first '|' above the ':' following the base package name, and the '|'
|
||||
# on the right side marks the last column you can put a character in. You must
|
||||
# make exactly 11 lines for the formatting to be correct. It's also
|
||||
# customary to leave one space after the ':' except on otherwise blank lines.
|
||||
|
||||
|-----handy-ruler------------------------------------------------------|
|
||||
google-go-lang: google-go-lang (Google's Go Language kit with gc tool chain)
|
||||
google-go-lang:
|
||||
google-go-lang: The Go programming language is an open source project to make
|
||||
google-go-lang: programmers more productive. Go is expressive, concise, clean, and
|
||||
google-go-lang: efficient. Its concurrency mechanisms make it easy to write programs
|
||||
google-go-lang: that get the most out of multicore and networked machines, while its
|
||||
google-go-lang: novel type system enables flexible and modular program construction.
|
||||
google-go-lang:
|
||||
google-go-lang:
|
||||
google-go-lang:
|
||||
google-go-lang:
|
||||
EOF
|
||||
sudo -S mv -v /tmp/slack-desc install/ &&
|
||||
sudo -S makepkg -l y -c n $PKGS/google-go-lang-1.15.5-$(uname -m)-mlfs.txz &&
|
||||
sudo -S rm -rf ${BUILD}/*
|
75
build-scripts/golang-bootstrap.build
Normal file
75
build-scripts/golang-bootstrap.build
Normal file
@ -0,0 +1,75 @@
|
||||
#! /bin/bash
|
||||
|
||||
# Golang Bootstrap
|
||||
# Source: https://storage.googleapis.com/golang/go1.4.3.src.tar.gz
|
||||
#
|
||||
# $BUILD = Directory to temporarily install
|
||||
# $PKGS = Directory to store built packages
|
||||
#
|
||||
# DEPS
|
||||
# Required: NONE
|
||||
# Recommended: NONE
|
||||
# Optional: NONE
|
||||
|
||||
# Apply patches from Alpine Linux
|
||||
patch -Np1 -i ../go-bootstrap-alpine/default-sc-getpw-r-size-max.patch\?h\=3.7-stable
|
||||
patch -Np1 -i ../go-bootstrap-alpine/fix-arm-hackery.patch\?h\=3.7-stable
|
||||
patch -Np1 -i ../go-bootstrap-alpine/new-binutils.patch\?h\=3.7-stable
|
||||
patch -Np1 -i ../go-bootstrap-alpine/no-longjmp-redefine.patch\?h\=3.7-stable
|
||||
patch -Np1 -i ../go-bootstrap-alpine/no-pic.patch\?h\=3.7-stable
|
||||
|
||||
# Set the paths
|
||||
export GOPATH="/src" # Full path to where source was unpacked
|
||||
export GOROOT="/src/go" # Full path to unpacked source
|
||||
export GOBIN="$GOROOT"/bin
|
||||
export GOROOT_FINAL=/usr/lib/go-bootstrap # Full path where bootstrap will finally be installed
|
||||
export CGO_ENABLED=0
|
||||
|
||||
# Set the arch
|
||||
case $(uname -m) in
|
||||
x86) export GOARCH="386" ;;
|
||||
x86_64) export GOARCH="amd64" ;;
|
||||
arm*) export GOARCH="arm" ;;
|
||||
*)return 1 ;;
|
||||
esac
|
||||
|
||||
# Build!
|
||||
cd src &&
|
||||
./make.bash --no-clean
|
||||
|
||||
# Install!
|
||||
cd ..
|
||||
sudo -S mkdir -pv $BUILD/usr/lib/go-bootstrap $BUILD/usr/lib/go-bootstrap
|
||||
|
||||
# Per Apline Linux:
|
||||
# The source needs to be installed due to an upstream
|
||||
# bug (https://github.com/golang/go/issues/2775).
|
||||
sudo -S cp -a bin pkg src $BUILD/usr/lib/go-bootstrap
|
||||
|
||||
# Remove tests and bashscripts from /usr/lib/go/src.
|
||||
# Those shouldn't be affacted by the upstream bug (see above).
|
||||
find $BUILD/usr/lib/go-bootstrap/src \( -type f -a -name "*_test.go" \) \
|
||||
-exec sudo -S rm -rvf \{\} \+ || return 1
|
||||
find $BUILD/usr/lib/go-bootstrap/src \( -type d -a -name "testdata" \) \
|
||||
-exec sudo -S rm -rvf \{\} \+ || return 1
|
||||
find $BUILD/usr/lib/go-bootstrap/src \( -type f -a -name "*.bash" \) \
|
||||
-exec rm -rf \{\} \+ || return 1
|
||||
|
||||
cd $BUILD && sudo -S mkdir -v ${BUILD}/install &&
|
||||
cat > /tmp/slack-desc << "EOF"
|
||||
# HOW TO EDIT THIS FILE:
|
||||
# The "handy ruler" below makes it easier to edit a package description. Line
|
||||
# up the first '|' above the ':' following the base package name, and the '|'
|
||||
# on the right side marks the last column you can put a character in. You must
|
||||
# make exactly 11 lines for the formatting to be correct. It's also
|
||||
# customary to leave one space after the ':' except on otherwise blank lines.
|
||||
|
||||
|-----handy-ruler------------------------------------------------------|
|
||||
go-bootstrap: Go Bootstrap
|
||||
go-bootstrap:
|
||||
go-bootstrap: Go programming language compiler used for bootstraping
|
||||
go-bootstrap:
|
||||
EOF
|
||||
sudo -S mv -v /tmp/slack-desc install/ &&
|
||||
sudo -S makepkg -l y -c n $PKGS/go-bootstrap-1.4.3-$(uname -m)-mlfs.txz &&
|
||||
sudo -S rm -rf ${BUILD}/*
|
116
build-scripts/golang.build
Normal file
116
build-scripts/golang.build
Normal file
@ -0,0 +1,116 @@
|
||||
#! /bin/bash
|
||||
|
||||
# Go Compiler
|
||||
# Source: https://go.dev/dl/go1.17.8.src.tar.gz
|
||||
#
|
||||
# $BUILD = Directory to temporarily install
|
||||
# $PKGS = Directory to store built packages
|
||||
#
|
||||
# DEPS
|
||||
# Required: golang-bootstrap
|
||||
# Recommended: NONE
|
||||
# Optional: NONE
|
||||
|
||||
# Apply patches from Alpine Linux
|
||||
patch -Np1 -i ../patches/go-alpine/allow-unshare-to-return-enosys.patch
|
||||
patch -Np1 -i ../patches/go-alpine/disable-flaky-gc-test.patch
|
||||
patch -Np1 -i ../patches/go-alpine/disable-flaky-sync-test.patch
|
||||
|
||||
# For AMD64/x86_64
|
||||
export GOARCH="amd64"
|
||||
|
||||
# For i686
|
||||
# export GOARCH=386
|
||||
# For arch64
|
||||
# export GOARCH=arm64
|
||||
# For armv7
|
||||
# export GOARCH="arm" GOARM=7
|
||||
# For armhf
|
||||
# export GOARCH="arm" GOARM=6
|
||||
|
||||
# compile go itself as a PIE on supported arches.
|
||||
case $(uname -m) in
|
||||
x86_64|s390x|aarch64) export GO_LDFLAGS=-buildmode=pie ;;
|
||||
esac
|
||||
|
||||
export GOOS="linux"
|
||||
export GOPATH="/src"
|
||||
export GOROOT="/src/go"
|
||||
export GOBIN="$GOROOT"/bin
|
||||
export GOROOT_FINAL=/usr/lib/go
|
||||
|
||||
for p in /usr/lib/go-bootstrap /usr/lib/go-linux-$GOARCH-bootstrap /usr/lib/go; do
|
||||
if [ -d "$p" ]; then
|
||||
export GOROOT_BOOTSTRAP="$p"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
# Build!
|
||||
cd src && ./make.bash -v
|
||||
|
||||
# Install
|
||||
cd .. && \
|
||||
sudo -S mkdir -pv $BUILD/usr/bin $BUILD/usr/lib/go/bin $BUILD/usr/share/doc/go &&
|
||||
for binary in go gofmt; do
|
||||
sudo -S install -Dm755 bin/"$binary" $BUILD/usr/lib/go/bin/"$binary"
|
||||
sudo -S ln -sv ../../usr/lib/go/bin/"$binary" $BUILD/usr/bin/
|
||||
done
|
||||
|
||||
sudo -S cp -av pkg lib $BUILD/usr/lib/go && \
|
||||
sudo -S cp -rv doc misc $BUILD/usr/share/doc/go && \
|
||||
sudo -S rm -rfv $BUILD/usr/lib/go/pkg/obj && \
|
||||
sudo -S rm -rfv $BUILD/usr/lib/go/pkg/bootstrap && \
|
||||
sudo -S rm -fv $BUILD/usr/lib/go/pkg/tool/*/api && \
|
||||
|
||||
sudo -S mkdir -pv $BUILD/usr/lib/go/ && \
|
||||
sudo -S cp -a src $BUILD/usr/lib/go/ && \
|
||||
|
||||
# Per Alpine Linux
|
||||
# Remove tests from /usr/lib/go/src to reduce package size,
|
||||
# these should not be needed at run-time by any program.
|
||||
find $BUILD/usr/lib/go/src \( -type f -a -name "*_test.go" \) \
|
||||
-exec sudo -S rm -rf \{\} \+
|
||||
find $BUILD/usr/lib/go/src \( -type d -a -name "testdata" \) \
|
||||
-exec sudo -S rm -rf \{\} \+
|
||||
|
||||
# Per Alpine Linux
|
||||
# Remove rc (plan 9) and bat scripts (windows) to reduce package
|
||||
#
|
||||
# See: https://gitlab.alpinelinux.org/alpine/aports/issues/11091
|
||||
find $BUILD/usr/lib/go/src -type f -a \( -name "*.rc" -o -name "*.bat" \) \
|
||||
-exec sudo -S rm -rf \{\} \+
|
||||
|
||||
cd $BUILD && sudo -S mkdir -v ${BUILD}/install &&
|
||||
cat > /tmp/slack-desc << "EOF"
|
||||
# HOW TO EDIT THIS FILE:
|
||||
# The "handy ruler" below makes it easier to edit a package description. Line
|
||||
# up the first '|' above the ':' following the base package name, and the '|'
|
||||
# on the right side marks the last column you can put a character in. You must
|
||||
# make exactly 11 lines for the formatting to be correct. It's also
|
||||
# customary to leave one space after the ':' except on otherwise blank lines.
|
||||
|
||||
|-----handy-ruler------------------------------------------------------|
|
||||
golang: golang
|
||||
golang:
|
||||
golang: Go programming language compiler
|
||||
golang:
|
||||
golang: https://go.dev/
|
||||
golang:
|
||||
EOF
|
||||
sudo -S mv -v /tmp/slack-desc install/ &&
|
||||
sudo -S mkdir -pv /BMAN/install /BMAN/usr && \
|
||||
sudo mv $BUILD/usr/share /BMAN/usr/ && \
|
||||
sudo -S makepkg -l y -c n $PKGS/golang-1.17.8-$(uname -m)-mlfs.txz &&
|
||||
cd /BMAN && \
|
||||
cat > /tmp/slack-desc << "EOF"
|
||||
golang-doc: Documentation for golang
|
||||
golang-doc:
|
||||
golang-doc: Go programming language compiler
|
||||
golang-doc:
|
||||
golang-doc: https://go.dev/
|
||||
golang-doc:
|
||||
EOF
|
||||
sudo -S mv -v /tmp/slack-desc install/ && \
|
||||
sudo -S makepkg -l y -c n $PKGS/golang-doc-1.17.8-noarch-mlfs.txz &&
|
||||
sudo -S rm -rf ${BUILD}/*
|
19
patches/go-alpine/allow-unshare-to-return-enosys.patch
Normal file
19
patches/go-alpine/allow-unshare-to-return-enosys.patch
Normal file
@ -0,0 +1,19 @@
|
||||
On the Alpine CI our moby configuration returns ENOSYS instead of EPERM
|
||||
when attempting to use the unshare(2) system call from a container. The
|
||||
Go test suite expects unshare(2) to return EPERM in this scenario and
|
||||
skips tests using it when it does. By treating the ENOSYS errno in the
|
||||
same way as the EPERM errno we can ensure that the Go test suite
|
||||
continues to work on the Alpine CI.
|
||||
|
||||
diff -upr go.orig/src/runtime/testdata/testprog/syscalls_linux.go go/src/runtime/testdata/testprog/syscalls_linux.go
|
||||
--- go.orig/src/runtime/testdata/testprog/syscalls_linux.go 2021-03-11 18:14:31.000000000 +0100
|
||||
+++ go/src/runtime/testdata/testprog/syscalls_linux.go 2021-03-12 17:26:10.927644763 +0100
|
||||
@@ -46,7 +46,7 @@ func unshareFs() error {
|
||||
err := syscall.Unshare(syscall.CLONE_FS)
|
||||
if err != nil {
|
||||
errno, ok := err.(syscall.Errno)
|
||||
- if ok && errno == syscall.EPERM {
|
||||
+ if ok && (errno == syscall.EPERM || errno == syscall.ENOSYS) {
|
||||
return errNotPermitted
|
||||
}
|
||||
}
|
17
patches/go-alpine/disable-flaky-gc-test.patch
Normal file
17
patches/go-alpine/disable-flaky-gc-test.patch
Normal file
@ -0,0 +1,17 @@
|
||||
See https://github.com/golang/go/issues/37331
|
||||
|
||||
diff -upr go.orig/src/runtime/gc_test.go go/src/runtime/gc_test.go
|
||||
--- go.orig/src/runtime/gc_test.go 2020-06-01 00:59:57.179164980 +0200
|
||||
+++ go/src/runtime/gc_test.go 2020-06-01 01:00:52.282339799 +0200
|
||||
@@ -15,9 +15,11 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
"unsafe"
|
||||
+ "internal/testenv"
|
||||
)
|
||||
|
||||
func TestGcSys(t *testing.T) {
|
||||
+ testenv.SkipFlaky(t, 37331)
|
||||
if os.Getenv("GOGC") == "off" {
|
||||
t.Skip("skipping test; GOGC=off in environment")
|
||||
}
|
22
patches/go-alpine/disable-flaky-sync-test.patch
Normal file
22
patches/go-alpine/disable-flaky-sync-test.patch
Normal file
@ -0,0 +1,22 @@
|
||||
See https://github.com/golang/go/issues/20072
|
||||
|
||||
diff --git a/src/sync/waitgroup_test.go b/src/sync/waitgroup_test.go
|
||||
index 4ab438c..5f4fc80 100644
|
||||
--- a/src/sync/waitgroup_test.go
|
||||
+++ b/src/sync/waitgroup_test.go
|
||||
@@ -10,6 +10,7 @@ import (
|
||||
. "sync"
|
||||
"sync/atomic"
|
||||
"testing"
|
||||
+ "internal/testenv"
|
||||
)
|
||||
|
||||
func testWaitGroup(t *testing.T, wg1 *WaitGroup, wg2 *WaitGroup) {
|
||||
@@ -84,6 +85,7 @@ func pollUntilEqual(v *uint32, target uint32) {
|
||||
}
|
||||
|
||||
func TestWaitGroupMisuse2(t *testing.T) {
|
||||
+ testenv.SkipFlaky(t, 20072)
|
||||
knownRacy(t)
|
||||
if runtime.NumCPU() <= 4 {
|
||||
t.Skip("NumCPU<=4, skipping: this test requires parallelism")
|
@ -0,0 +1,15 @@
|
||||
--- a/src/os/user/lookup_unix.go
|
||||
+++ b/src/os/user/lookup_unix.go
|
||||
@@ -57,6 +57,12 @@
|
||||
bufSize = 1024
|
||||
} else {
|
||||
bufSize = C.sysconf(C._SC_GETPW_R_SIZE_MAX)
|
||||
+ // The musl alternative standard library on Linux
|
||||
+ // return -1 as specified by POSIX if there are no
|
||||
+ // hard limit on _SC_GETPW_R_SIZE_MAX.
|
||||
+ if bufSize == -1 {
|
||||
+ bufSize = 1024
|
||||
+ }
|
||||
if bufSize <= 0 || bufSize > 1<<20 {
|
||||
return nil, fmt.Errorf("user: unreasonable _SC_GETPW_R_SIZE_MAX of %d", bufSize)
|
||||
}
|
@ -0,0 +1,98 @@
|
||||
--- go/src/cmd/dist/arm.c
|
||||
+++ go.fixed/src/cmd/dist/arm.c
|
||||
@@ -11,8 +11,8 @@
|
||||
return "6";
|
||||
}
|
||||
#else
|
||||
-static void useVFPv3(void);
|
||||
-static void useVFPv1(void);
|
||||
+void useVFPv3(void);
|
||||
+void useVFPv1(void);
|
||||
|
||||
char *
|
||||
xgetgoarm(void)
|
||||
@@ -26,46 +26,6 @@
|
||||
else if(xtryexecfunc(useVFPv1))
|
||||
return "6";
|
||||
return "5";
|
||||
-}
|
||||
-
|
||||
-static void
|
||||
-useVFPv3(void)
|
||||
-{
|
||||
- // try to run VFPv3-only "vmov.f64 d0, #112" instruction
|
||||
- // we can't use that instruction directly, because we
|
||||
- // might be compiling with a soft-float only toolchain.
|
||||
- //
|
||||
- // some newer toolchains are configured to use thumb
|
||||
- // by default, so we need to do some mode changing magic
|
||||
- // here.
|
||||
- // We can use "bx pc; nop" here, but GNU as(1) insists
|
||||
- // on warning us
|
||||
- // "use of r15 in bx in ARM mode is not really useful"
|
||||
- // so we workaround that by using "bx r0"
|
||||
- __asm__ __volatile__ ("mov r0, pc");
|
||||
- __asm__ __volatile__ ("bx r0");
|
||||
- __asm__ __volatile__ (".word 0xeeb70b00"); // vmov.f64 d0, #112
|
||||
- __asm__ __volatile__ (".word 0xe12fff1e"); // bx lr
|
||||
-}
|
||||
-
|
||||
-static void
|
||||
-useVFPv1(void)
|
||||
-{
|
||||
- // try to run "vmov.f64 d0, d0" instruction
|
||||
- // we can't use that instruction directly, because we
|
||||
- // might be compiling with a soft-float only toolchain
|
||||
- //
|
||||
- // some newer toolchains are configured to use thumb
|
||||
- // by default, so we need to do some mode changing magic
|
||||
- // here.
|
||||
- // We can use "bx pc; nop" here, but GNU as(1) insists
|
||||
- // on warning us
|
||||
- // "use of r15 in bx in ARM mode is not really useful"
|
||||
- // so we workaround that by using "bx r0"
|
||||
- __asm__ __volatile__ ("mov r0, pc");
|
||||
- __asm__ __volatile__ ("bx r0");
|
||||
- __asm__ __volatile__ (".word 0xeeb00b40"); // vomv.f64 d0, d0
|
||||
- __asm__ __volatile__ (".word 0xe12fff1e"); // bx lr
|
||||
}
|
||||
|
||||
#endif
|
||||
--- go/src/make.bash
|
||||
+++ go.fixed/src/make.bash
|
||||
@@ -129,7 +132,7 @@
|
||||
if [ -z "$CC" -a -z "$(type -t gcc)" -a -n "$(type -t clang)" ]; then
|
||||
export CC=clang CXX=clang++
|
||||
fi
|
||||
-${CC:-gcc} $mflag -O2 -Wall -Werror -o cmd/dist/dist -Icmd/dist "$DEFGOROOT" cmd/dist/*.c
|
||||
+${CC:-gcc} $mflag -O2 -Wall -Werror -o cmd/dist/dist -Icmd/dist "$DEFGOROOT" cmd/dist/*.c cmd/dist/*.S
|
||||
|
||||
# -e doesn't propagate out of eval, so check success by hand.
|
||||
eval $(./cmd/dist/dist env -p || echo FAIL=true)
|
||||
--- /dev/null 2014-12-09 07:52:31.203329541 -0200
|
||||
+++ go.fixed/src/cmd/dist/arm.S 2014-12-09 10:29:34.149969243 -0200
|
||||
@@ -0,0 +1,24 @@
|
||||
+#ifdef __ARMEL__
|
||||
+
|
||||
+.text
|
||||
+
|
||||
+.global useVFPv3
|
||||
+.hidden useVFPv3
|
||||
+.type useVFPv3,%function
|
||||
+useVFPv3:
|
||||
+ mov r0, pc
|
||||
+ bx r0
|
||||
+ .word 0xeeb70b00 // vmov.f64 d0, #112
|
||||
+ .word 0xe12fff1e // bx lr
|
||||
+
|
||||
+
|
||||
+.global useVFPv1
|
||||
+.hidden useVFPv1
|
||||
+.type useVFPv1,%function
|
||||
+useVFPv1:
|
||||
+ mov r0, pc
|
||||
+ bx r0
|
||||
+ .word 0xeeb00b40 // vomv.f64 d0, d0
|
||||
+ .word 0xe12fff1e // bx lr
|
||||
+
|
||||
+#endif
|
186
patches/go-bootstrap-alpine/new-binutils.patch?h=3.7-stable
Normal file
186
patches/go-bootstrap-alpine/new-binutils.patch?h=3.7-stable
Normal file
@ -0,0 +1,186 @@
|
||||
https://github.com/golang/go/issues/13114
|
||||
https://gnats.netbsd.org/50777
|
||||
|
||||
--- a/src/cmd/6l/asm.c 2014-12-11 01:18:10.000000000 +0000
|
||||
+++ b/src/cmd/6l/asm.c
|
||||
@@ -118,6 +118,8 @@ adddynrel(LSym *s, Reloc *r)
|
||||
return;
|
||||
|
||||
case 256 + R_X86_64_GOTPCREL:
|
||||
+ case 256 + R_X86_64_GOTPCRELX:
|
||||
+ case 256 + R_X86_64_REX_GOTPCRELX:
|
||||
if(targ->type != SDYNIMPORT) {
|
||||
// have symbol
|
||||
if(r->off >= 2 && s->p[r->off-2] == 0x8b) {
|
||||
|
||||
--- a/src/cmd/ld/ldelf.c.orig 2015-09-23 04:37:36.000000000 +0000
|
||||
+++ b/src/cmd/ld/ldelf.c
|
||||
@@ -888,12 +888,15 @@ reltype(char *pn, int elftype, uchar *si
|
||||
case R('6', R_X86_64_PC32):
|
||||
case R('6', R_X86_64_PLT32):
|
||||
case R('6', R_X86_64_GOTPCREL):
|
||||
+ case R('6', R_X86_64_GOTPCRELX):
|
||||
+ case R('6', R_X86_64_REX_GOTPCRELX):
|
||||
case R('8', R_386_32):
|
||||
case R('8', R_386_PC32):
|
||||
case R('8', R_386_GOT32):
|
||||
case R('8', R_386_PLT32):
|
||||
case R('8', R_386_GOTOFF):
|
||||
case R('8', R_386_GOTPC):
|
||||
+ case R('8', R_386_GOT32X):
|
||||
*siz = 4;
|
||||
break;
|
||||
case R('6', R_X86_64_64):
|
||||
|
||||
--- a/src/cmd/ld/elf.h.orig 2015-09-23 04:37:36.000000000 +0000
|
||||
+++ b/src/cmd/ld/elf.h
|
||||
@@ -478,32 +478,47 @@ typedef struct {
|
||||
* Relocation types.
|
||||
*/
|
||||
|
||||
-#define R_X86_64_NONE 0 /* No relocation. */
|
||||
-#define R_X86_64_64 1 /* Add 64 bit symbol value. */
|
||||
-#define R_X86_64_PC32 2 /* PC-relative 32 bit signed sym value. */
|
||||
-#define R_X86_64_GOT32 3 /* PC-relative 32 bit GOT offset. */
|
||||
-#define R_X86_64_PLT32 4 /* PC-relative 32 bit PLT offset. */
|
||||
-#define R_X86_64_COPY 5 /* Copy data from shared object. */
|
||||
-#define R_X86_64_GLOB_DAT 6 /* Set GOT entry to data address. */
|
||||
-#define R_X86_64_JMP_SLOT 7 /* Set GOT entry to code address. */
|
||||
-#define R_X86_64_RELATIVE 8 /* Add load address of shared object. */
|
||||
-#define R_X86_64_GOTPCREL 9 /* Add 32 bit signed pcrel offset to GOT. */
|
||||
-#define R_X86_64_32 10 /* Add 32 bit zero extended symbol value */
|
||||
-#define R_X86_64_32S 11 /* Add 32 bit sign extended symbol value */
|
||||
-#define R_X86_64_16 12 /* Add 16 bit zero extended symbol value */
|
||||
-#define R_X86_64_PC16 13 /* Add 16 bit signed extended pc relative symbol value */
|
||||
-#define R_X86_64_8 14 /* Add 8 bit zero extended symbol value */
|
||||
-#define R_X86_64_PC8 15 /* Add 8 bit signed extended pc relative symbol value */
|
||||
-#define R_X86_64_DTPMOD64 16 /* ID of module containing symbol */
|
||||
-#define R_X86_64_DTPOFF64 17 /* Offset in TLS block */
|
||||
-#define R_X86_64_TPOFF64 18 /* Offset in static TLS block */
|
||||
-#define R_X86_64_TLSGD 19 /* PC relative offset to GD GOT entry */
|
||||
-#define R_X86_64_TLSLD 20 /* PC relative offset to LD GOT entry */
|
||||
-#define R_X86_64_DTPOFF32 21 /* Offset in TLS block */
|
||||
-#define R_X86_64_GOTTPOFF 22 /* PC relative offset to IE GOT entry */
|
||||
-#define R_X86_64_TPOFF32 23 /* Offset in static TLS block */
|
||||
-
|
||||
-#define R_X86_64_COUNT 24 /* Count of defined relocation types. */
|
||||
+#define R_X86_64_NONE 0
|
||||
+#define R_X86_64_64 1
|
||||
+#define R_X86_64_PC32 2
|
||||
+#define R_X86_64_GOT32 3
|
||||
+#define R_X86_64_PLT32 4
|
||||
+#define R_X86_64_COPY 5
|
||||
+#define R_X86_64_GLOB_DAT 6
|
||||
+#define R_X86_64_JMP_SLOT 7
|
||||
+#define R_X86_64_RELATIVE 8
|
||||
+#define R_X86_64_GOTPCREL 9
|
||||
+#define R_X86_64_32 10
|
||||
+#define R_X86_64_32S 11
|
||||
+#define R_X86_64_16 12
|
||||
+#define R_X86_64_PC16 13
|
||||
+#define R_X86_64_8 14
|
||||
+#define R_X86_64_PC8 15
|
||||
+#define R_X86_64_DTPMOD64 16
|
||||
+#define R_X86_64_DTPOFF64 17
|
||||
+#define R_X86_64_TPOFF64 18
|
||||
+#define R_X86_64_TLSGD 19
|
||||
+#define R_X86_64_TLSLD 20
|
||||
+#define R_X86_64_DTPOFF32 21
|
||||
+#define R_X86_64_GOTTPOFF 22
|
||||
+#define R_X86_64_TPOFF32 23
|
||||
+#define R_X86_64_PC64 24
|
||||
+#define R_X86_64_GOTOFF64 25
|
||||
+#define R_X86_64_GOTPC32 26
|
||||
+#define R_X86_64_GOT64 27
|
||||
+#define R_X86_64_GOTPCREL64 28
|
||||
+#define R_X86_64_GOTPC64 29
|
||||
+#define R_X86_64_GOTPLT64 30
|
||||
+#define R_X86_64_PLTOFF64 31
|
||||
+#define R_X86_64_SIZE32 32
|
||||
+#define R_X86_64_SIZE64 33
|
||||
+#define R_X86_64_GOTPC32_TLSDEC 34
|
||||
+#define R_X86_64_TLSDESC_CALL 35
|
||||
+#define R_X86_64_TLSDESC 36
|
||||
+#define R_X86_64_IRELATIVE 37
|
||||
+#define R_X86_64_PC32_BND 40
|
||||
+#define R_X86_64_GOTPCRELX 41
|
||||
+#define R_X86_64_REX_GOTPCRELX 42
|
||||
|
||||
|
||||
#define R_ALPHA_NONE 0 /* No reloc */
|
||||
@@ -581,39 +596,42 @@ typedef struct {
|
||||
#define R_ARM_COUNT 38 /* Count of defined relocation types. */
|
||||
|
||||
|
||||
-#define R_386_NONE 0 /* No relocation. */
|
||||
-#define R_386_32 1 /* Add symbol value. */
|
||||
-#define R_386_PC32 2 /* Add PC-relative symbol value. */
|
||||
-#define R_386_GOT32 3 /* Add PC-relative GOT offset. */
|
||||
-#define R_386_PLT32 4 /* Add PC-relative PLT offset. */
|
||||
-#define R_386_COPY 5 /* Copy data from shared object. */
|
||||
-#define R_386_GLOB_DAT 6 /* Set GOT entry to data address. */
|
||||
-#define R_386_JMP_SLOT 7 /* Set GOT entry to code address. */
|
||||
-#define R_386_RELATIVE 8 /* Add load address of shared object. */
|
||||
-#define R_386_GOTOFF 9 /* Add GOT-relative symbol address. */
|
||||
-#define R_386_GOTPC 10 /* Add PC-relative GOT table address. */
|
||||
-#define R_386_TLS_TPOFF 14 /* Negative offset in static TLS block */
|
||||
-#define R_386_TLS_IE 15 /* Absolute address of GOT for -ve static TLS */
|
||||
-#define R_386_TLS_GOTIE 16 /* GOT entry for negative static TLS block */
|
||||
-#define R_386_TLS_LE 17 /* Negative offset relative to static TLS */
|
||||
-#define R_386_TLS_GD 18 /* 32 bit offset to GOT (index,off) pair */
|
||||
-#define R_386_TLS_LDM 19 /* 32 bit offset to GOT (index,zero) pair */
|
||||
-#define R_386_TLS_GD_32 24 /* 32 bit offset to GOT (index,off) pair */
|
||||
-#define R_386_TLS_GD_PUSH 25 /* pushl instruction for Sun ABI GD sequence */
|
||||
-#define R_386_TLS_GD_CALL 26 /* call instruction for Sun ABI GD sequence */
|
||||
-#define R_386_TLS_GD_POP 27 /* popl instruction for Sun ABI GD sequence */
|
||||
-#define R_386_TLS_LDM_32 28 /* 32 bit offset to GOT (index,zero) pair */
|
||||
-#define R_386_TLS_LDM_PUSH 29 /* pushl instruction for Sun ABI LD sequence */
|
||||
-#define R_386_TLS_LDM_CALL 30 /* call instruction for Sun ABI LD sequence */
|
||||
-#define R_386_TLS_LDM_POP 31 /* popl instruction for Sun ABI LD sequence */
|
||||
-#define R_386_TLS_LDO_32 32 /* 32 bit offset from start of TLS block */
|
||||
-#define R_386_TLS_IE_32 33 /* 32 bit offset to GOT static TLS offset entry */
|
||||
-#define R_386_TLS_LE_32 34 /* 32 bit offset within static TLS block */
|
||||
-#define R_386_TLS_DTPMOD32 35 /* GOT entry containing TLS index */
|
||||
-#define R_386_TLS_DTPOFF32 36 /* GOT entry containing TLS offset */
|
||||
-#define R_386_TLS_TPOFF32 37 /* GOT entry of -ve static TLS offset */
|
||||
-
|
||||
-#define R_386_COUNT 38 /* Count of defined relocation types. */
|
||||
+#define R_386_NONE 0
|
||||
+#define R_386_32 1
|
||||
+#define R_386_PC32 2
|
||||
+#define R_386_GOT32 3
|
||||
+#define R_386_PLT32 4
|
||||
+#define R_386_COPY 5
|
||||
+#define R_386_GLOB_DAT 6
|
||||
+#define R_386_JMP_SLOT 7
|
||||
+#define R_386_RELATIVE 8
|
||||
+#define R_386_GOTOFF 9
|
||||
+#define R_386_GOTPC 10
|
||||
+#define R_386_TLS_TPOFF 14
|
||||
+#define R_386_TLS_IE 15
|
||||
+#define R_386_TLS_GOTIE 16
|
||||
+#define R_386_TLS_LE 17
|
||||
+#define R_386_TLS_GD 18
|
||||
+#define R_386_TLS_LDM 19
|
||||
+#define R_386_TLS_GD_32 24
|
||||
+#define R_386_TLS_GD_PUSH 25
|
||||
+#define R_386_TLS_GD_CALL 26
|
||||
+#define R_386_TLS_GD_POP 27
|
||||
+#define R_386_TLS_LDM_32 28
|
||||
+#define R_386_TLS_LDM_PUSH 29
|
||||
+#define R_386_TLS_LDM_CALL 30
|
||||
+#define R_386_TLS_LDM_POP 31
|
||||
+#define R_386_TLS_LDO_32 32
|
||||
+#define R_386_TLS_IE_32 33
|
||||
+#define R_386_TLS_LE_32 34
|
||||
+#define R_386_TLS_DTPMOD32 35
|
||||
+#define R_386_TLS_DTPOFF32 36
|
||||
+#define R_386_TLS_TPOFF32 37
|
||||
+#define R_386_TLS_GOTDESC 39
|
||||
+#define R_386_TLS_DESC_CALL 40
|
||||
+#define R_386_TLS_DESC 41
|
||||
+#define R_386_IRELATIVE 42
|
||||
+#define R_386_GOT32X 43
|
||||
|
||||
#define R_PPC_NONE 0 /* No relocation. */
|
||||
#define R_PPC_ADDR32 1
|
@ -0,0 +1,10 @@
|
||||
--- a/include/libc.h
|
||||
+++ b/include/libc.h
|
||||
@@ -102,7 +102,6 @@ extern void sysfatal(char*, ...);
|
||||
#define atoll p9atoll
|
||||
#define getenv p9getenv
|
||||
#define getwd p9getwd
|
||||
-#define longjmp p9longjmp
|
||||
#undef setjmp
|
||||
#define setjmp p9setjmp
|
||||
#define putenv p9putenv
|
14
patches/go-bootstrap-alpine/no-pic.patch?h=3.7-stable
Normal file
14
patches/go-bootstrap-alpine/no-pic.patch?h=3.7-stable
Normal file
@ -0,0 +1,14 @@
|
||||
--- a/src/cmd/ld/lib.c
|
||||
+++ b/src/cmd/ld/lib.c
|
||||
@@ -786,6 +786,11 @@ hostlink(void)
|
||||
p = strchr(p + 1, ' ');
|
||||
}
|
||||
|
||||
+ // The Go linker does not currently support building objects that
|
||||
+ // may be linked into a PIE. See:
|
||||
+ // https://code.google.com/p/go/issues/detail?id=6940
|
||||
+ argv[argc++] = "-fno-PIC";
|
||||
+
|
||||
argv[argc] = nil;
|
||||
|
||||
quotefmtinstall();
|
Reference in New Issue
Block a user