Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a2c22fa
commit 28b0e9b
Showing
2 changed files
with
162 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
# Maintainer: Bartłomiej Piotrowski <bpiotrowski@archlinux.org> | ||
# Contributor: Allan McRae <allan@archlinux.org> | ||
|
||
# toolchain build order: linux-api-headers->glibc->binutils->gcc->binutils->glibc | ||
|
||
pkgname=binutils | ||
pkgver=2.32 | ||
pkgrel=2 | ||
pkgdesc='A set of programs to assemble and manipulate binary and object files' | ||
arch=(x86_64) | ||
url='https://www.gnu.org/software/binutils/' | ||
license=(GPL) | ||
groups=(base-devel) | ||
depends=(glibc zlib) | ||
checkdepends=(dejagnu bc) | ||
conflicts=(binutils-multilib) | ||
replaces=(binutils-multilib) | ||
options=(staticlibs !distcc !ccache) | ||
source=(https://ftp.gnu.org/gnu/binutils/binutils-$pkgver.tar.xz{,.sig} | ||
bug-24389.patch) | ||
validpgpkeys=(3A24BC1E8FB409FA9F14371813FCEF89DD9E3C4F) | ||
md5sums=('0d174cdaf85721c5723bf52355be41e6' | ||
'SKIP' | ||
'f2dd05c9dec6df48747a29cec436018c') | ||
|
||
prepare() { | ||
mkdir -p binutils-build | ||
|
||
#cd binutils-gdb | ||
cd binutils-$pkgver | ||
|
||
# https://sourceware.org/bugzilla/show_bug.cgi?id=24389 | ||
patch -p1 -i ../bug-24389.patch | ||
|
||
# hack! - libiberty configure tests for header files using "$CPP $CPPFLAGS" | ||
sed -i "/ac_cpp=/s/\$CPPFLAGS/\$CPPFLAGS -O2/" libiberty/configure | ||
} | ||
|
||
build() { | ||
cd binutils-build | ||
|
||
"$srcdir/binutils-$pkgver/configure" \ | ||
--prefix=/usr \ | ||
--with-lib-path=/usr/lib:/usr/local/lib \ | ||
--with-bugurl=https://bugs.archlinux.org/ \ | ||
--enable-deterministic-archives \ | ||
--enable-gold \ | ||
--enable-ld=default \ | ||
--enable-lto \ | ||
--enable-plugins \ | ||
--enable-relro \ | ||
--enable-shared \ | ||
--enable-targets=x86_64-pep \ | ||
--enable-threads \ | ||
--disable-gdb \ | ||
--disable-werror \ | ||
--with-pic \ | ||
--with-system-zlib | ||
|
||
make configure-host | ||
make tooldir=/usr | ||
} | ||
|
||
check() { | ||
cd binutils-build | ||
|
||
# unset LDFLAGS as testsuite makes assumptions about which ones are active | ||
# ignore failures in gold testsuite... | ||
make -k LDFLAGS="" check || true | ||
} | ||
|
||
package() { | ||
cd binutils-build | ||
make prefix="$pkgdir/usr" tooldir="$pkgdir/usr" install | ||
|
||
# Remove unwanted files | ||
rm -f "$pkgdir"/usr/share/man/man1/{dlltool,nlmconv,windres,windmc}* | ||
|
||
# No shared linking to these files outside binutils | ||
rm -f "$pkgdir"/usr/lib/lib{bfd,opcodes}.so | ||
echo 'INPUT( /usr/lib/libbfd.a -liberty -lz -ldl )' > "$pkgdir/usr/lib/libbfd.so" | ||
echo 'INPUT( /usr/lib/libopcodes.a -lbfd )' > "$pkgdir/usr/lib/libopcodes.so" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
From: Jim Wilson <jimw@sifive.com> | ||
Date: Tue, 2 Apr 2019 20:30:07 +0000 (-0700) | ||
Subject: RISC-V: Don't check ABI flags if no code section. | ||
X-Git-Url: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commitdiff_plain;h=87f98bacb76001157d5a26555a41738ac3841a56;hp=4c7c79dd9858438a25fcc37ba419baa00d31978d | ||
|
||
RISC-V: Don't check ABI flags if no code section. | ||
|
||
This fixes a glib build failure reported in PR 24389. Using ld -b binary | ||
creates an object file with no elf header flags set which has the wrong ABI | ||
info for riscv64-linux. But the file also has no code sections, so I added | ||
code borrowed from the arm port that only checks the ELF header ABI flags if | ||
there is a code section. | ||
|
||
bfd/ | ||
PR 24389 | ||
* elfnn-riscv.c (_bfd_riscv_elf_merge_private_bfd_data): Move read of | ||
ELF header flags to after check for ELF object file. Loop through | ||
sections looking for code sections, if none, then skip ABI checks. | ||
--- | ||
|
||
diff --git a/bfd/elfnn-riscv.c b/bfd/elfnn-riscv.c | ||
index dba1025..964b6bd 100644 | ||
--- a/bfd/elfnn-riscv.c | ||
+++ b/bfd/elfnn-riscv.c | ||
@@ -3086,8 +3086,7 @@ static bfd_boolean | ||
_bfd_riscv_elf_merge_private_bfd_data (bfd *ibfd, struct bfd_link_info *info) | ||
{ | ||
bfd *obfd = info->output_bfd; | ||
- flagword new_flags = elf_elfheader (ibfd)->e_flags; | ||
- flagword old_flags = elf_elfheader (obfd)->e_flags; | ||
+ flagword new_flags, old_flags; | ||
|
||
if (!is_riscv_elf (ibfd) || !is_riscv_elf (obfd)) | ||
return TRUE; | ||
@@ -3107,6 +3106,9 @@ _bfd_riscv_elf_merge_private_bfd_data (bfd *ibfd, struct bfd_link_info *info) | ||
if (!riscv_merge_attributes (ibfd, info)) | ||
return FALSE; | ||
|
||
+ new_flags = elf_elfheader (ibfd)->e_flags; | ||
+ old_flags = elf_elfheader (obfd)->e_flags; | ||
+ | ||
if (! elf_flags_init (obfd)) | ||
{ | ||
elf_flags_init (obfd) = TRUE; | ||
@@ -3114,6 +3116,34 @@ _bfd_riscv_elf_merge_private_bfd_data (bfd *ibfd, struct bfd_link_info *info) | ||
return TRUE; | ||
} | ||
|
||
+ /* Check to see if the input BFD actually contains any sections. If not, | ||
+ its flags may not have been initialized either, but it cannot actually | ||
+ cause any incompatibility. Do not short-circuit dynamic objects; their | ||
+ section list may be emptied by elf_link_add_object_symbols. | ||
+ | ||
+ Also check to see if there are no code sections in the input. In this | ||
+ case, there is no need to check for code specific flags. */ | ||
+ if (!(ibfd->flags & DYNAMIC)) | ||
+ { | ||
+ bfd_boolean null_input_bfd = TRUE; | ||
+ bfd_boolean only_data_sections = TRUE; | ||
+ asection *sec; | ||
+ | ||
+ for (sec = ibfd->sections; sec != NULL; sec = sec->next) | ||
+ { | ||
+ if ((bfd_get_section_flags (ibfd, sec) | ||
+ & (SEC_LOAD | SEC_CODE | SEC_HAS_CONTENTS)) | ||
+ == (SEC_LOAD | SEC_CODE | SEC_HAS_CONTENTS)) | ||
+ only_data_sections = FALSE; | ||
+ | ||
+ null_input_bfd = FALSE; | ||
+ break; | ||
+ } | ||
+ | ||
+ if (null_input_bfd || only_data_sections) | ||
+ return TRUE; | ||
+ } | ||
+ | ||
/* Disallow linking different float ABIs. */ | ||
if ((old_flags ^ new_flags) & EF_RISCV_FLOAT_ABI) | ||
{ |