Merge pull request #54 from stikonas/binutils

Binutils
This commit is contained in:
fosslinux 2021-03-03 16:24:09 +11:00 committed by GitHub
commit 5ef1baeccf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 331 additions and 2 deletions

View File

@ -3,9 +3,11 @@ f0611136bee505811e9ca11ca7ac188ef5323a8e2ef19cffd3edb3cf08fd791e autoconf-2.13.
534e99b61b81e79327b6d08f1a3edb0755ac246e1249009b0e1bf5887b60d7a9 autoconf-2.52.tar.gz
503cdc2b0992a4309545d17f462cb15f99bb57b7161dfc4082b2e7188f2bcc0f automake-1.4-p6.tar.gz
ba03d412998cc54bd0b0f2d6c32100967d3137098affdc2d32e6e7c11b163fe4 bash-2.05b.tar.gz
e20bdd49a0fb317959b410c1fe81269a620ec21207045d8a37cadea621be4b59 binutils-2.14.tar.bz2
7007fc89c216fbfaff5525359b02a7e5b612694df5168c74673f67055f015095 bison-3.4.1.tar.gz
ab5a03176ee106d3f0fa90e381da478ddae405918153cca248e682cd0c4a2269 bzip2-1.0.8.tar.gz
c25b36b8af6e0ad2a875daf4d6196bd0df28a62be7dd252e5f99a4d5d7288d95 coreutils-5.0.tar.bz2
8815a918867a14dcfeb623786b3a7f7483a039a78dd5a94e9b562667684c07a1 coreutils-6.3.tar.bz2
d5f2489c4056a31528e3ada4adacc23d498532b0af1a980f2f76158162b139d6 diffutils-2.7.tar.gz
bc79b890f35ca38d66ff89a6e3758226131e51ccbd10ef78d5ff150b7bd73689 flex-2.5.11.tar.gz
e87aae032bf07c26f85ac0ed3250998c37621d95f8bd748b31f15b33c45ee995 flex-2.6.4.tar.gz

View File

@ -306,6 +306,11 @@ coreutils 5.0
including ``comm``, ``expr``, ``date``, ``dd``, ``sort``, ``uname`` and
``uniq``. This fixes a variety of issues with existing ``coreutils``.
coreutils 6.3
=============
We build ``sha256sum`` from coreutils 6.3 since it is absent in 5.0.
Other utils are not build at this stage.
gawk 3.0.4
==========
@ -392,3 +397,13 @@ autoconf 2.12
=============
Yet another old autoconf version that we will need for GNU Binutils.
binutils 2.14
=============
The GNU Binary Utilities, or binutils, are a set of programming tools for creating and
managing binary programs, object files, libraries, profile data, and assembly source code.
In particular we can now use full featured ``ar`` instead of ``tcc -ar``,
the GNU linker ``ld``, which allows us building shared libraries,
and the GNU assembler ``as``.

View File

@ -110,7 +110,7 @@ cp -r tar-1.12 tmp/after
mkdir tmp/after/tar-1.12/{src,build}
pushd tmp/after/tar-1.12/src
if [ ! -f "$(basename $url)" ]; then
wget "$url"
_wget "$url"
fi
popd
tar -C tmp/after/tar-1.12/src -xf "tmp/after/tar-1.12/src/$(basename $url)" --strip-components=1
@ -156,6 +156,9 @@ get_file ftp://sourceware.org/pub/bzip2/bzip2-1.0.8.tar.gz 1
# coreutils 5.0
get_file https://ftp.gnu.org/gnu/coreutils/coreutils-5.0.tar.bz2 1
# coreutils 6.3
get_file https://ftp.gnu.org/gnu/coreutils/coreutils-6.3.tar.bz2
# heirloom-devtools
get_file http://downloads.sourceforge.net/project/heirloom/heirloom-devtools/070527/heirloom-devtools-070527.tar.bz2
@ -213,6 +216,9 @@ get_file https://ftp.gnu.org/gnu/autoconf/autoconf-2.13.tar.gz
# autoconf 2.12
get_file https://ftp.gnu.org/gnu/autoconf/autoconf-2.12.tar.gz
# binutils 2.14
get_file https://ftp.gnu.org/gnu/binutils/binutils-2.14.tar.bz2
# General cleanup
find tmp -name .git -exec rm -rf \;

View File

@ -0,0 +1,85 @@
# SPDX-FileCopyrightText: 2021 Andrius Štikonas <andrius@stikonas.eu>
# SPDX-FileCopyrightText: 2021 Paul Dersey <pdersey@gmail.com>
#
# SPDX-License-Identifier: GPL-3.0-or-later
src_prepare() {
default_src_prepare
rm configure
autoconf-2.13
for dir in binutils bfd gas ld gprof libiberty opcodes; do
cd $dir
rm configure
autoconf-2.13
cd ..
done
for dir in etc intl; do
cd $dir
rm configure
autoconf-2.12
cd ..
done
# automake errors out without this
cd gas
mv config/m68k-parse.y .
sed -i 's#config/m68k-parse.y#m68k-parse.y#' Makefile.am
cd ..
# Disable documentation build which needs pod2man
for dir in bfd binutils gas gprof ld opcodes; do
cd $dir
sed -i '/SUBDIRS/d' Makefile.am
rm Makefile.in
automake-1.4
cd ..
done
# Rebuild bison files
touch */*.y
rm ld/ldgram.c ld/ldgram.h
rm gas/itbl-parse.c gas/itbl-parse.h
rm gas/m68k-parse.c
rm binutils/arparse.c binutils/arparse.h
rm binutils/nlmheader.c binutils/nlmheader.h
rm binutils/sysinfo.c binutils/sysinfo.h
rm binutils/defparse.c binutils/defparse.h
rm binutils/rcparse.c binutils/rcparse.h
# Rebuild flex generated files
touch */*.l
rm ld/ldlex.c
rm gas/itbl-lex.c
rm binutils/syslex.c binutils/rclex.c binutils/deflex.c binutils/arlex.c
}
src_configure() {
AR="tcc -ar" RANLIB="true" CC="tcc -D __GLIBC_MINOR__=6" \
./configure \
--disable-nls \
--disable-shared \
--disable-werror \
--build=i386-unknown-linux \
--host=i386-unknown-linux \
--target=i386-unknown-linux \
--with-sysroot=/after \
--disable-64-bit-bfd \
--prefix="${PREFIX}" \
--libdir="${PREFIX}/lib/musl"
# TODO: Find a way to avoid these hacks
sed -i '/#undef pid_t/d' libiberty/config.in
sed -i '/#undef uintptr_t/d' libiberty/config.in
sed -i 's/C_alloca/alloca/g' libiberty/alloca.c
sed -i 's/C_alloca/alloca/g' include/libiberty.h
}
src_compile() {
# Rebuild generated header files. bfd/Makefile does not exists at this stage,
# so we need to create it first.
make configure-bfd
make -C bfd headers
default_src_compile
}

View File

@ -0,0 +1,20 @@
9d04d6617616fe5cb2cfb3fbc32b9fe9ab891a8f21ecf5fbf9e9570831826ef4 /after/bin/addr2line
8ac5f9c6281a4272bb5329b5d3b73bb744102b0e9c6964ebd5fbc893e56d866f /after/bin/ar
6dc5bf6e40feacd8ea20e7a8a3ded12fe37c2848b6023f284d22e89db09b101f /after/bin/as
4eae20278831c452f01d4a7dde2a795e9e1c0ab60f9d32590c8d77e98a33b39e /after/bin/c++filt
c70b11d11aaebefb92d08e61a18c2a79eb78f63add3a62c2b31fd73d394430ed /after/bin/gprof
20f10bddc981e797943980195794fdb19bfaf679be49c2e1236f0522ed9c07aa /after/bin/ld
e4409a21081ec94abda6c749a9791f68a5bdc35ee77093abb608cf7beefa8020 /after/bin/nm
97fcc442ec3785b1413133c2b4f528a005aa927a4e54f955bc17a07df620f189 /after/bin/objcopy
3d7a99f65f51aca2ec4c526683740637586c9321cf43fc0fc561955615c4d7ad /after/bin/objdump
e49bba1ea6a61fb90f754e8de4692ed0810e7c68429f0b22fbf37670607a7807 /after/bin/od
530d1747439ab516ad010d170e2f56ebe2b2049043fb3d5e18a4234b04b96e5c /after/bin/ranlib
978d6cf91009703d14aa2c678b0fd90fa7e417dc4ade9c151986a56bca98a79a /after/bin/readelf
9d1b1179b67279109e9648368a8ffedd71fdd1c21857ee77058192b0f1dbaeba /after/bin/size
82657d370bca61bf6a6a4cbfb621614582519f2e938be1a4d09c135344c7c889 /after/bin/strings
fe6eaa5cf6e6621356fff3cd047c7cd0051490e895915027b6d4439159707f36 /after/bin/strip
f5934b4f057018b7f14adc197460d8b238cff80294234d771a17a408d5794104 /after/lib/musl/libbfd.a
3c9ab37cff5f732bca1258879fabf3c6c734890de1d7aa6381a5945d38f31c86 /after/lib/musl/libbfd.la
61a03b0d2eafa5ad50242a7ee8ce8664c2ef342bf727f46ceab8999b61a9a61b /after/lib/musl/libiberty.a
6530574bde4f5c57b194ae4229efb9784a97cc89cd45fc0d852e9afb5e103e4f /after/lib/musl/libopcodes.a
d3c307c7a2cd62a3fc39aa933f40bee94b94aff5db58a3652689ebfe0f616c82 /after/lib/musl/libopcodes.la

View File

@ -0,0 +1,68 @@
SPDX-FileCopyrightText: 2021 Andrius Štikonas <andrius@stikonas.eu>
SPDX-FileCopyrightText: 2009 Chris Demetriou <cgd@google.com>
SPDX-License-Identifier: GPL-2.0-or-later
Old binutils do not have support for creating deterministic archives.
Backported from upstream commit 36e4dce69dd23bea9ea2258dea35f034b6d6351c
--- bfd/archive.c 2021-03-01 00:05:54.888301655 +0000
+++ bfd/archive.c 2021-03-02 21:53:51.001617689 +0000
@@ -1396,10 +1396,6 @@
{
/* Assume we just "made" the member, and fake it. */
struct bfd_in_memory *bim = (struct bfd_in_memory *) member->iostream;
- time (&status.st_mtime);
- status.st_uid = getuid ();
- status.st_gid = getgid ();
- status.st_mode = 0644;
status.st_size = bim->size;
}
else if (stat (filename, &status) != 0)
@@ -1408,6 +1404,11 @@
return NULL;
}
+ status.st_mtime = 0;
+ status.st_uid = 0;
+ status.st_gid = 0;
+ status.st_mode = 0644;
+
amt = sizeof (struct ar_hdr) + sizeof (struct areltdata);
ared = (struct areltdata *) bfd_zalloc (abfd, amt);
if (ared == NULL)
@@ -2003,13 +2004,11 @@
stat (arch->filename, &statbuf);
memset ((char *) (&hdr), 0, sizeof (struct ar_hdr));
sprintf (hdr.ar_name, RANLIBMAG);
- /* Remember the timestamp, to keep it holy. But fudge it a little. */
- bfd_ardata (arch)->armap_timestamp = statbuf.st_mtime + ARMAP_TIME_OFFSET;
bfd_ardata (arch)->armap_datepos = (SARMAG
+ offsetof (struct ar_hdr, ar_date[0]));
- sprintf (hdr.ar_date, "%ld", bfd_ardata (arch)->armap_timestamp);
- sprintf (hdr.ar_uid, "%ld", (long) getuid ());
- sprintf (hdr.ar_gid, "%ld", (long) getgid ());
+ sprintf (hdr.ar_date, "%ld", 0);
+ sprintf (hdr.ar_uid, "%ld", 0);
+ sprintf (hdr.ar_gid, "%ld", 0);
sprintf (hdr.ar_size, "%-10d", (int) mapsize);
strncpy (hdr.ar_fmag, ARFMAG, 2);
for (i = 0; i < sizeof (struct ar_hdr); i++)
@@ -2082,6 +2081,8 @@
struct ar_hdr hdr;
unsigned int i;
+ return TRUE;
+
/* Flush writes, get last-write timestamp from file, and compare it
to the timestamp IN the file. */
bfd_flush (arch);
@@ -2169,7 +2170,7 @@
memset ((char *) (&hdr), 0, sizeof (struct ar_hdr));
hdr.ar_name[0] = '/';
sprintf (hdr.ar_size, "%-10d", (int) mapsize);
- sprintf (hdr.ar_date, "%ld", (long) time (NULL));
+ sprintf (hdr.ar_date, "%ld", 0);
/* This, at least, is what Intel coff sets the values to. */
sprintf ((hdr.ar_uid), "%d", 0);
sprintf ((hdr.ar_gid), "%d", 0);

View File

@ -0,0 +1 @@
34ec35d9de41dd954802dbcfc7c07697f1e7e3cecedbe32ea16a6da85c3eb260 /after/bin/sha256sum

View File

@ -0,0 +1,21 @@
# SPDX-FileCopyrightText: 2021 Andrius Štikonas <andrius@stikonas.eu>
#
# SPDX-License-Identifier: GPL-3.0-or-later
src_prepare() {
default_src_prepare
cp lib/fnmatch_.h lib/fnmatch.h
cp lib/fcntl_.h lib/fcntl.h
sed -i 's#@ABSOLUTE_FCNTL_H@#"/after/include/musl/fcntl.h"#' lib/fcntl.h
touch config.h lib/configmake.h
}
src_compile() {
make -f Makefile
}
src_install() {
make -f Makefile install PREFIX="${PREFIX}"
}

File diff suppressed because one or more lines are too long

View File

@ -57,7 +57,7 @@ build () {
cd ../..
echo "${pkg}: checksumming installed files."
sha256sum -c "${checksum_f}"
test -e "${checksum_f}" && sha256sum -c "${checksum_f}"
echo "${pkg}: build successful"
cd ..
@ -87,6 +87,7 @@ default_src_unpack() {
default_src_prepare() {
if test -d "${patch_dir}"; then
for p in "${patch_dir}"/*.patch; do
echo "Applying patch: ${p}"
patch -Np0 < "${p}"
done
fi

View File

@ -54,6 +54,9 @@ build diffutils-2.7
# Rebuild coreutils using musl
build coreutils-5.0 coreutils-5.0.sh checksums/pass2
# Build only sha256sum
build coreutils-6.3
build gawk-3.0.4
build perl-5.000
@ -79,4 +82,6 @@ build autoconf-2.13
build autoconf-2.12
build binutils-2.14
echo "Bootstrapping completed."