[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
02/10: gnu: linux-libre: Fix build on AArch64.
From: |
Marius Bakke |
Subject: |
02/10: gnu: linux-libre: Fix build on AArch64. |
Date: |
Sat, 16 Jun 2018 15:37:23 -0400 (EDT) |
mbakke pushed a commit to branch master
in repository guix.
commit cdbcfc113bfc02e58bdf6ec42c545c479681602f
Author: Marius Bakke <address@hidden>
Date: Wed Jun 6 17:19:18 2018 +0200
gnu: linux-libre: Fix build on AArch64.
* gnu/packages/patches/binutils-aarch64-symbol-relocation.patch: New file.
* gnu/local.mk (dist_patch_DATA): Register it.
* gnu/packages/base.scm (binutils/fixed): 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.
---
gnu/local.mk | 1 +
gnu/packages/base.scm | 11 +++++++
gnu/packages/linux.scm | 6 ++++
.../binutils-aarch64-symbol-relocation.patch | 36 ++++++++++++++++++++++
4 files changed, 54 insertions(+)
diff --git a/gnu/local.mk b/gnu/local.mk
index 4d2cefd..d02f070 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -582,6 +582,7 @@ dist_patch_DATA =
\
%D%/packages/patches/bash-completion-directories.patch \
%D%/packages/patches/bazaar-CVE-2017-14176.patch \
%D%/packages/patches/bind-CVE-2018-5738.patch \
+ %D%/packages/patches/binutils-aarch64-symbol-relocation.patch \
%D%/packages/patches/binutils-loongson-workaround.patch \
%D%/packages/patches/blast+-fix-makefile.patch \
%D%/packages/patches/boost-fix-icu-build.patch \
diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm
index 6d9f019..fef6002 100644
--- a/gnu/packages/base.scm
+++ b/gnu/packages/base.scm
@@ -480,6 +480,17 @@ included.")
(license gpl3+)
(home-page "https://www.gnu.org/software/binutils/")))
+(define-public binutils/fixed
+ ;; TODO: Incorporate this in binutils during the next rebuild cycle.
+ (hidden-package
+ (package
+ (inherit binutils)
+ (source (origin
+ (inherit (package-source binutils))
+ (patches (append (origin-patches (package-source binutils))
+ (search-patches
+
"binutils-aarch64-symbol-relocation.patch"))))))))
+
(define* (make-ld-wrapper name #:key
(target (const #f))
binutils
diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index 9938af9..4ed418d 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -295,6 +295,12 @@ for ARCH and optionally VARIANT, or #f if there is no such
configuration."
(or (%current-target-system) (%current-system)))
((or "x86_64" "i386")
`(("gcc" ,gcc-7)))
+ ("arm64"
+ ;; Work around a binutils 2.30 bug where some kernel symbols would
+ ;; be incorrectly marked as relocatable:
+ ;; <https://sourceware.org/bugzilla/show_bug.cgi?id=22764>.
+ `(("ld-wrapper" ,(make-ld-wrapper "ld-wrapper"
+ #:binutils binutils/fixed))))
(_
'()))
,@(match (and configuration-file
diff --git a/gnu/packages/patches/binutils-aarch64-symbol-relocation.patch
b/gnu/packages/patches/binutils-aarch64-symbol-relocation.patch
new file mode 100644
index 0000000..fbd5968
--- /dev/null
+++ b/gnu/packages/patches/binutils-aarch64-symbol-relocation.patch
@@ -0,0 +1,36 @@
+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 and tests 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 */
- branch master updated (f77886c -> ed2ae0d), Marius Bakke, 2018/06/16
- 01/10: doc: Clarify when branches are "frozen"., Marius Bakke, 2018/06/16
- 07/10: gnu: ffmpeg: Update to 4.0.1., Marius Bakke, 2018/06/16
- 04/10: gnu: libedit: Update to 20180525-3.1., Marius Bakke, 2018/06/16
- 03/10: gnu: openal: Update to 0.18.2., Marius Bakke, 2018/06/16
- 08/10: gnu: maim: Update to 5.5.2., Marius Bakke, 2018/06/16
- 06/10: gnu: ldb: Fix build on 32-bit systems., Marius Bakke, 2018/06/16
- 09/10: gnu: offlineimap: Update to 7.2.1., Marius Bakke, 2018/06/16
- 10/10: gnu: strace: Update to 4.23., Marius Bakke, 2018/06/16
- 02/10: gnu: linux-libre: Fix build on AArch64.,
Marius Bakke <=
- 05/10: gnu: perl: Fix CVE-2018-12015., Marius Bakke, 2018/06/16