Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion cross-images/03_alpine_populate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ else
for fp in 4d07755e 524d27bb 58199dcc 58cbb476 58e4f17d ; do
wget https://alpinelinux.org/keys/[email protected]$fp.rsa.pub
done
for fp in 616a9724 ; do
wget https://git.alpinelinux.org/aports/plain/main/alpine-keys/[email protected]$fp.rsa.pub
done

# Propagate the new keys into the sysroot and also tell it to start pulling in
# packages from the internet.
Expand All @@ -24,9 +27,13 @@ fi

# g++ is needed to get libstdc++.a, annoyingly
apk --root $root add --no-scripts \
brotli-static \
bzip2-dev \
bzip2-static \
expat-dev \
expat-static \
fontconfig-dev \
fontconfig-static \
freetype-dev \
freetype-static \
g++ \
Expand All @@ -40,7 +47,9 @@ apk --root $root add --no-scripts \
libpng-dev \
libpng-static \
openssl-dev \
zlib-dev
openssl-libs-static \
zlib-dev \
zlib-static

if [ $TARGET_ARCH != native ] ; then
# Let's also install those cross-compilers!
Expand Down
9 changes: 6 additions & 3 deletions cross-images/06_setup_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,13 @@ else
sysroot=/alpine/home/rust/sysroot-$os_arch
fi

RUSTFLAGS="-C target-feature=+crt-static -L ${sysroot}/usr/lib"
RUSTFLAGS="-C target-feature=+crt-static -C link-arg=-L${sysroot}/usr/lib"

for tectonic_implicit_dep in bz2 expat uuid stdc++ ; do
RUSTFLAGS="$RUSTFLAGS -l static=${tectonic_implicit_dep}"
for tectonic_implicit_dep in bz2 brotlidec brotlicommon expat uuid stdc++ ; do
# Thanks to a behavior change introduced in Rust 1.61,
# https://github.com/rust-lang/rust/pull/93901/ , we have to add these
# libraries using this approach rather than `-l static=...`.
RUSTFLAGS="$RUSTFLAGS -C link-arg=-l${tectonic_implicit_dep}"
done

if [ "$rust_platform" = aarch64-unknown-linux-musl ] ; then
Expand Down
8 changes: 4 additions & 4 deletions cross-images/Dockerfile.alpine-chroot
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
# Copyright 2019 The Tectonic Project
# Copyright 2019-2022 The Tectonic Project
# Licensed under the MIT License.

# We do some fancy Docker gymnastics to set up an Alpine instance that then
# becomes a chroot inside an Ubuntu install. Unlike
# `Dockerfile.alpine-chroot-cross`, though, we don't need to install our own
# cross-compiler or anything.

FROM alpine:3.10 AS chroot
FROM alpine:3.16 AS chroot

ARG UID=1000
ARG rust_platform
ARG alpine_platform

# Privileged Alpine setup: make an unprivileged user to work inside the
# chroot. This script also sets up that user build packages, which we don't
# chroot. This script also sets up that user to build packages, which we don't
# need but is quick so there's no point forking the script.
RUN apk update && apk add --update alpine-sdk
RUN apk update && apk add --update alpine-sdk sudo
ADD 01_alpine_priv_setup.sh /
RUN sh /01_alpine_priv_setup.sh "$UID"

Expand Down
6 changes: 3 additions & 3 deletions cross-images/Dockerfile.alpine-chroot-cross
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Copyright 2019 The Tectonic Project
# Copyright 2019-2022 The Tectonic Project
# Licensed under the MIT License.

# We do some fancy Docker gymnastics to set up an Alpine instance that then
# becomes a chroot inside an Ubuntu install.

FROM alpine:3.10 AS chroot
FROM alpine:3.16 AS chroot

ARG UID=1000
ARG rust_platform
Expand All @@ -13,7 +13,7 @@ ARG alpine_arch
ARG qemu_arch

# Privileged Alpine setup: make a user that will build the desired cross compiler.
RUN apk update && apk add --update alpine-sdk
RUN apk update && apk add --update alpine-sdk sudo
ADD 01_alpine_priv_setup.sh /
RUN sh /01_alpine_priv_setup.sh "$UID"

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
From bbf05b742fde518fb97c789b043fe0d3aaf549f0 Mon Sep 17 00:00:00 2001
From: Ariadne Conill <[email protected]>
Date: Tue, 21 Sep 2021 14:53:13 +0000
Subject: [PATCH] Revert "PR25882, .gnu.attributes are not checked for shared
libraries"

This revert is needed to avoid wrongly tagging objects with the incompatible
IBM long double ABI, which is not supported by musl and will result in
linking errors if used.

This reverts commit a8acd6eeb6dc2cc5460ece90f90ebe36b56b20ba.
---
bfd/elf32-tic6x.c | 3 ---
ld/ldlang.c | 10 ++++------
2 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/bfd/elf32-tic6x.c b/bfd/elf32-tic6x.c
index 5754f3cb860..3ad1d612749 100644
--- a/bfd/elf32-tic6x.c
+++ b/bfd/elf32-tic6x.c
@@ -3735,9 +3735,6 @@ elf32_tic6x_merge_attributes (bfd *ibfd, struct bfd_link_info *info)

case Tag_ABI_PIC:
case Tag_ABI_PID:
- /* Don't transfer these tags from dynamic objects. */
- if ((ibfd->flags & DYNAMIC) != 0)
- continue;
if (out_attr[i].i > in_attr[i].i)
out_attr[i].i = in_attr[i].i;
break;
diff --git a/ld/ldlang.c b/ld/ldlang.c
index 37b64c89ee1..f13beaef9d9 100644
--- a/ld/ldlang.c
+++ b/ld/ldlang.c
@@ -7071,13 +7071,11 @@ lang_check (void)
bfd_printable_name (input_bfd), input_bfd,
bfd_printable_name (link_info.output_bfd));
}
-
- /* If the input bfd has no contents, it shouldn't set the
- private data of the output bfd. */
- else if (!file->flags.just_syms
- && ((input_bfd->flags & DYNAMIC) != 0
- || bfd_count_sections (input_bfd) != 0))
+ else if (bfd_count_sections (input_bfd))
{
+ /* If the input bfd has no contents, it shouldn't set the
+ private data of the output bfd. */
+
bfd_error_handler_type pfn = NULL;

/* If we aren't supposed to warn about mismatched input
--
2.33.0

65 changes: 48 additions & 17 deletions cross-images/mini-aports/main/binutils/APKBUILD
Original file line number Diff line number Diff line change
@@ -1,56 +1,79 @@
# Maintainer: Natanael Copa <[email protected]>
# Contributor: Natanael Copa <[email protected]>
# Maintainer: Ariadne Conill <[email protected]>
pkgname=binutils
pkgver=2.32
pkgrel=0
pkgver=2.38
pkgrel=2
pkgdesc="Tools necessary to build programs"
url="https://www.gnu.org/software/binutils/"
makedepends_build="bison flex texinfo"
makedepends_host="zlib-dev"
makedepends="$makedepends_build $makedepends_host"
arch="all"
license="GPL-2.0 GPL-3.0-or-later LGPL-2.0 BSD"
subpackages="$pkgname-dev $pkgname-doc $pkgname-gold"
source="https://ftp.gnu.org/gnu/$pkgname/$pkgname-$pkgver.tar.bz2
subpackages="$pkgname-dev $pkgname-doc"
source="https://ftp.gnu.org/gnu/binutils/binutils-$pkgver.tar.xz
binutils-ld-fix-static-linking.patch
gold-mips.patch
ld-bfd-mips.patch
0001-Revert-PR25882-.gnu.attributes-are-not-checked-for-s.patch
binutils-mips-disable-assert.patch
binutils-ppc-fix-machine-options.patch
binutils-s390x-1.patch
binutils-s390x-2.patch
"
builddir="$srcdir/$pkgname-$pkgver"

if [ "$CHOST" = "$CBUILD" ] && [ "$CBUILD" = "$CTARGET" ] && [ "$CTARGET_ARCH" != "riscv64" ]; then
subpackages="$subpackages $pkgname-gold"
fi

if [ "$CHOST" != "$CTARGET" ]; then
pkgname="$pkgname-$CTARGET_ARCH"
subpackages=""
sonameprefix="$pkgname:"
fi

# secfixes:
# 2.35.2-r1:
# - CVE-2021-3487
# 2.32-r0:
# - CVE-2018-19931
# - CVE-2018-19932
# - CVE-2018-20002
# - CVE-2018-20712
# - CVE-2018-19931
# - CVE-2018-19932
# - CVE-2018-20002
# - CVE-2018-20712
# 2.28-r1:
# - CVE-2017-7614
# - CVE-2017-7614

build() {
local _sysroot=/
local _cross_configure="--enable-install-libiberty --enable-shared"
local _arch_configure=""
local _gold_configure="--disable-gold"
local _plugin_configure="--enable-plugins"

if [ "$CHOST" != "$CTARGET" ]; then
_sysroot="$CBUILDROOT"
_cross_configure="--disable-install-libiberty"
_plugin_configure="--disable-plugins"
fi

if [ "$CHOST" = "$CBUILD" ] && [ "$CBUILD" = "$CTARGET" ] && [ "$CTARGET_ARCH" != "riscv64" ]; then
_gold_configure="--enable-gold"
fi

if [ "$CTARGET_ARCH" = "x86_64" ]; then
_arch_configure="--enable-targets=x86_64-pep"
fi

if [ "$CTARGET_ARCH" = "riscv64" ]; then
_gold_configure="--disable-gold"
fi

case "$CTARGET_ARCH" in
mips*) _hash_style_configure="--enable-default-hash-style=sysv" ;;
*) _hash_style_configure="--enable-default-hash-style=gnu" ;;
esac

cd "$builddir"
./configure \
--build=$CBUILD \
--host=$CHOST \
Expand All @@ -62,9 +85,9 @@ build() {
--infodir=/usr/share/info \
--disable-multilib \
--enable-ld=default \
--enable-gold=yes \
$_gold_configure \
--enable-64-bit-bfd \
--enable-plugins \
$_plugin_configure \
--enable-relro \
--enable-deterministic-archives \
$_cross_configure \
Expand All @@ -79,7 +102,6 @@ build() {
}

package() {
cd "$builddir"
make install DESTDIR="$pkgdir"
if [ -d "$pkgdir"/usr/lib64 ]; then
mv "$pkgdir"/usr/lib64/* "$pkgdir"/usr/lib/
Expand All @@ -88,8 +110,9 @@ package() {
if [ "$CHOST" != "$CTARGET" ]; then
# creating cross tools: remove any files that would conflict
# with the native tools, or other cross tools
rm -r "$pkgdir"/usr/share
rm -r "${pkgdir:?}"/usr/share
rm -f "$pkgdir"/usr/lib/libiberty.a
rm -r "${pkgdir:?}"/usr/lib/bfd-plugins
fi
}

Expand All @@ -111,6 +134,14 @@ gold() {
mv "$pkgdir"/usr/$CTARGET/bin/ld.gold "$subpkgdir"/usr/$CTARGET/bin/ld.gold
}

sha512sums="99ec7ed2b5ebfd3ac16cecb1567ec4a72f81ac30717002d601708f7547b2f8122ffcce076c986f22894aede33c54c73012210a4e973ba9b6e2d87a242a2bee12 binutils-2.32.tar.bz2
sha512sums="
8bf0b0d193c9c010e0518ee2b2e5a830898af206510992483b427477ed178396cd210235e85fd7bd99a96fc6d5eedbeccbd48317a10f752b7336ada8b2bb826d binutils-2.38.tar.xz
ecee33b0e435aa704af1c334e560f201638ff79e199aa11ed78a72f7c9b46f85fbb227af5748e735fd681d1965fcc42ac81b0c8824e540430ce0c706c81e8b49 binutils-ld-fix-static-linking.patch
f55cf2e0bf82f97583a1abe10710e4013ecf7d64f1da2ef8659a44a06d0dd8beaf58dab98a183488ea137f03e32d62efc878d95f018f836f8cec870bc448556f gold-mips.patch"
f55cf2e0bf82f97583a1abe10710e4013ecf7d64f1da2ef8659a44a06d0dd8beaf58dab98a183488ea137f03e32d62efc878d95f018f836f8cec870bc448556f gold-mips.patch
314d2ef9071c89940aa6c8118e8a1e2f191a5d0a4bf596da1ad9cc84f884d8bc7dea8bd7b9fc3f8f1bddd3fd41c6eb017e1e804044b3bf084df1ed9e6e095e2d ld-bfd-mips.patch
70ec22bd72ef6dddecfd970613387dd4a8cdc8730dd3cbf03d5a0c3a7c4d839383167bb06dad21bf7c235329fd44b5dc4aefe762f68544f17155cf002bf1be4a 0001-Revert-PR25882-.gnu.attributes-are-not-checked-for-s.patch
609cd90d8b334eb309f586b17b9d335a08d3dbb6def7c3eb5c010028fcb681674031e5b9d853aa7a39a50304356a86afc184b85562b3f228f8197f4d29395c8f binutils-mips-disable-assert.patch
27ea91e0e406e2ed464fd692cf92a07e338781789f2d968c8b95d9d5545985056a6f7f500df3952e5ab42165db28b741aa33d6b717e880b11a2e41fe406b13c4 binutils-ppc-fix-machine-options.patch
a9efe2689624865f0ff33d4776a5bd295bcad6484bdd38d0ca490fea43691c4933ab33d17478851998eef12922dbf83d6c3225bb1f8faf92a1367d086390f7d3 binutils-s390x-1.patch
0e291df80ad279005265634014d0935d2c115a5ed708d25407094b7ad4ddf267d1fb7fcbcb2d9ad73bd305b4e3974628b820bd1f249f56c095e4896872434cc9 binutils-s390x-2.patch
"
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
diff -urN binutils-2.35.2.orig/bfd/elfxx-mips.c binutils-2.35.2/bfd/elfxx-mips.c
--- binutils-2.35.2.orig/bfd/elfxx-mips.c 2021-01-30 01:38:03.000000000 -0700
+++ binutils-2.35.2/bfd/elfxx-mips.c 2021-05-13 17:35:34.706913601 -0600
@@ -6744,8 +6744,10 @@
in the relocation. */
if (h != NULL && ! SYMBOL_REFERENCES_LOCAL (info, &h->root))
{
+#if 0
BFD_ASSERT (htab->root.target_os == is_vxworks
|| h->global_got_area != GGA_NONE);
+#endif
indx = h->root.dynindx;
if (SGI_COMPAT (output_bfd))
defined_p = h->root.def_regular;
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
Fix for DARN opcode error during ppc64le compilation of rng-tools which
occurs with binutils 2.38 but not with binutils 2.37..

https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=cebc89b9328;hp=9cbed90ee623d75e31994e7943960c997ba565f2


diff -aur a/gas/config/tc-ppc.c b/gas/config/tc-ppc.c
--- a/gas/config/tc-ppc.c
+++ b/gas/config/tc-ppc.c
@@ -5965,7 +5965,30 @@
options do not count as a new machine, instead they add
to currently selected opcodes. */
ppc_cpu_t machine_sticky = 0;
- new_cpu = ppc_parse_cpu (ppc_cpu, &machine_sticky, cpu_string);
+ /* Unfortunately, some versions of gcc emit a .machine
+ directive very near the start of the compiler's assembly
+ output file. This is bad because it overrides user -Wa
+ cpu selection. Worse, there are versions of gcc that
+ emit the *wrong* cpu, not even respecting the -mcpu given
+ to gcc. See gcc pr101393. And to compound the problem,
+ as of 20220222 gcc doesn't pass the correct cpu option to
+ gas on the command line. See gcc pr59828. Hack around
+ this by keeping sticky options for an early .machine. */
+ asection *sec;
+ for (sec = stdoutput->sections; sec != NULL; sec = sec->next)
+ {
+ segment_info_type *info = seg_info (sec);
+ /* Are the frags for this section perturbed from their
+ initial state? Even .align will count here. */
+ if (info != NULL
+ && (info->frchainP->frch_root != info->frchainP->frch_last
+ || info->frchainP->frch_root->fr_type != rs_fill
+ || info->frchainP->frch_root->fr_fix != 0))
+ break;
+ }
+ new_cpu = ppc_parse_cpu (ppc_cpu,
+ sec == NULL ? &sticky : &machine_sticky,
+ cpu_string);
if (new_cpu != 0)
ppc_cpu = new_cpu;
else
Loading