aboutsummaryrefslogtreecommitdiffstats
path: root/main/binutils
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2011-12-09 09:28:48 +0200
committerTimo Teräs <timo.teras@iki.fi>2011-12-09 09:28:48 +0200
commitbfc02e3184e593b9cdea76f80faaa3a9e4d12bb2 (patch)
tree4484cb54f3bef04bf0755b85101326711e069d21 /main/binutils
parent84009e4c79006b51709b9c3a92a2e58d2121af7d (diff)
downloadaports-bfc02e3184e593b9cdea76f80faaa3a9e4d12bb2.tar.bz2
aports-bfc02e3184e593b9cdea76f80faaa3a9e4d12bb2.tar.xz
main/binutils: fix static linking on PIE
The linker script mistakenly assumess crtbegin, or crtbegin? for the gcc crt glue filename. On PIE system it is called crtbeginTS which would not match the filter. Fixes #855.
Diffstat (limited to 'main/binutils')
-rw-r--r--main/binutils/APKBUILD25
-rw-r--r--main/binutils/binutils-ld-fix-static-linking.patch37
2 files changed, 58 insertions, 4 deletions
diff --git a/main/binutils/APKBUILD b/main/binutils/APKBUILD
index 0b2717d627..4017199634 100644
--- a/main/binutils/APKBUILD
+++ b/main/binutils/APKBUILD
@@ -1,18 +1,34 @@
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=binutils
pkgver=2.22
-pkgrel=0
+pkgrel=1
pkgdesc="Tools necessary to build programs"
url="http://www.gnu.org/software/binutils/"
-source="http://ftp.gnu.org/gnu/binutils/binutils-$pkgver.tar.bz2"
depends=
makedepends="bison flex texinfo zlib-dev"
arch="all"
license="GPL"
subpackages="$pkgname-doc"
+source="http://ftp.gnu.org/gnu/binutils/binutils-$pkgver.tar.bz2
+ binutils-ld-fix-static-linking.patch"
+
+_builddir="$srcdir/$pkgname-$pkgver"
+
+prepare() {
+ local i
+ cd "$_builddir"
+ for i in $source; do
+ case $i in
+ *.patch|*.diff)
+ msg "Applying $i..."
+ patch -p1 -i "$srcdir"/$i || return 1
+ ;;
+ esac
+ done
+}
build() {
- cd "$srcdir/$pkgname-$pkgver"
+ cd "$_builddir"
./configure --prefix=/usr \
--mandir /usr/share/man \
--build ${CHOST:-i486-alpine-linux-uclibc} \
@@ -35,4 +51,5 @@ package() {
fi
rm "$pkgdir"/usr/lib/*.la || return 1
}
-md5sums="ee0f10756c84979622b992a4a61ea3f5 binutils-2.22.tar.bz2"
+md5sums="ee0f10756c84979622b992a4a61ea3f5 binutils-2.22.tar.bz2
+6b744d0574338cc69d3096a890a7b609 binutils-ld-fix-static-linking.patch"
diff --git a/main/binutils/binutils-ld-fix-static-linking.patch b/main/binutils/binutils-ld-fix-static-linking.patch
new file mode 100644
index 0000000000..b192936af7
--- /dev/null
+++ b/main/binutils/binutils-ld-fix-static-linking.patch
@@ -0,0 +1,37 @@
+Index: binutils-2.22/ld/scripttempl/elf.sc
+===================================================================
+--- binutils-2.22.orig/ld/scripttempl/elf.sc 2011-04-11 18:38:12.000000000 +0300
++++ binutils-2.22/ld/scripttempl/elf.sc 2011-12-09 09:11:24.000000000 +0200
+@@ -225,8 +225,8 @@
+ if test "${ENABLE_INITFINI_ARRAY}" = "yes"; then
+ SORT_INIT_ARRAY="KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*)))"
+ SORT_FINI_ARRAY="KEEP (*(SORT_BY_INIT_PRIORITY(.fini_array.*) SORT_BY_INIT_PRIORITY(.dtors.*)))"
+- CTORS_IN_INIT_ARRAY="KEEP (*(EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o $OTHER_EXCLUDE_FILES) .ctors))"
+- DTORS_IN_FINI_ARRAY="KEEP (*(EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o $OTHER_EXCLUDE_FILES) .dtors))"
++ CTORS_IN_INIT_ARRAY="KEEP (*(EXCLUDE_FILE (*crtbegin*.o *crtend*.o $OTHER_EXCLUDE_FILES) .ctors))"
++ DTORS_IN_FINI_ARRAY="KEEP (*(EXCLUDE_FILE (*crtbegin*.o *crtend*.o $OTHER_EXCLUDE_FILES) .dtors))"
+ else
+ SORT_INIT_ARRAY="KEEP (*(SORT(.init_array.*)))"
+ SORT_FINI_ARRAY="KEEP (*(SORT(.fini_array.*)))"
+@@ -262,8 +262,7 @@
+ doesn't matter which directory crtbegin.o
+ is in. */
+
+- KEEP (*crtbegin.o(.ctors))
+- KEEP (*crtbegin?.o(.ctors))
++ KEEP (*crtbegin*.o(.ctors))
+
+ /* We don't want to include the .ctor section from
+ the crtend.o file until after the sorted ctors.
+@@ -278,9 +277,8 @@
+ DTOR=".dtors ${CONSTRUCTING-0} :
+ {
+ ${CONSTRUCTING+${DTOR_START}}
+- KEEP (*crtbegin.o(.dtors))
+- KEEP (*crtbegin?.o(.dtors))
+- KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o $OTHER_EXCLUDE_FILES) .dtors))
++ KEEP (*crtbegin*.o(.dtors))
++ KEEP (*(EXCLUDE_FILE (*crtend*.o $OTHER_EXCLUDE_FILES) .dtors))
+ KEEP (*(SORT(.dtors.*)))
+ KEEP (*(.dtors))
+ ${CONSTRUCTING+${DTOR_END}}