GNU bug report logs -
#31741
[PATCH] gnu: linux-libre: Fix build on AArch64.
Previous Next
Reported by: Marius Bakke <mbakke <at> fastmail.com>
Date: Wed, 6 Jun 2018 22:38:01 UTC
Severity: normal
Tags: patch
Done: Marius Bakke <mbakke <at> fastmail.com>
Bug is archived. No further changes may be made.
Full log
Message #13 received at 31741-done <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
ludo <at> gnu.org (Ludovic Courtès) writes:
> Hello Marius!
>
> Marius Bakke <mbakke <at> fastmail.com> skribis:
>
>> * gnu/packages/patches/binutils-aarch64-symbol-relocation.patch: New file.
>> * gnu/local.mk (dist_patch_DATA): Register it.
>> * gnu/packages/base.scm (binutils-sans-bug-22764): New public variable.
>> * gnu/packages/linux.scm (make-linux-libre)[native-inputs]: On aarch64, define
>> new ld-wrapper with the above binutils and use it.
>
> Woohoo, excellent!
>
>> +++ b/gnu/packages/patches/binutils-aarch64-symbol-relocation.patch
>> @@ -0,0 +1,108 @@
>> +Fix a regression in Binutils 2.30 where some symbols are incorrectly assumed
>> +to be addresses:
>> +
>> +https://sourceware.org/bugzilla/show_bug.cgi?id=22764
>> +
>> +Patch taken from upstream (with ChangeLog entries omitted):
>> +
>> +https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commitdiff;h=279b2f94168ee91e02ccd070d27c983fc001fe12
>> +
>> +diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c
>> +index af448f9..2737773 100644
>> +--- a/bfd/elfnn-aarch64.c
>> ++++ b/bfd/elfnn-aarch64.c
>> +@@ -7189,10 +7189,19 @@ elfNN_aarch64_check_relocs (bfd *abfd, struct bfd_link_info *info,
>> + #if ARCH_SIZE == 64
>> + case BFD_RELOC_AARCH64_32:
>> + #endif
>> +- if (bfd_link_pic (info)
>> +- && (sec->flags & SEC_ALLOC) != 0
>> +- && (sec->flags & SEC_READONLY) != 0)
>> ++ if (bfd_link_pic (info) && (sec->flags & SEC_ALLOC) != 0)
>> + {
>> ++ if (h != NULL
>> ++ /* This is an absolute symbol. It represents a value instead
>> ++ of an address. */
>> ++ && ((h->root.type == bfd_link_hash_defined
>> ++ && bfd_is_abs_section (h->root.u.def.section))
>> ++ /* This is an undefined symbol. */
>> ++ || h->root.type == bfd_link_hash_undefined))
>> ++ break;
>> ++
>> ++ /* For local symbols, defined global symbols in a non-ABS section,
>> ++ it is assumed that the value is an address. */
>> + int howto_index = bfd_r_type - BFD_RELOC_AARCH64_RELOC_START;
>> + _bfd_error_handler
>> + /* xgettext:c-format */
>
> Perhaps you can omit the ld/testsuite bits that follow (I don’t think we
> run this test suite, do we?).
Good idea. I dropped the tests since we don't use them and pushed as
cdbcfc113bfc02e58bdf6ec42c545c479681602f.
[signature.asc (application/pgp-signature, inline)]
This bug report was last modified 7 years and 53 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.