aboutsummaryrefslogtreecommitdiffstats
path: root/devel/binutils
diff options
context:
space:
mode:
authorAndrew Turner <andrew@FreeBSD.org>2016-11-29 21:44:46 +0800
committerAndrew Turner <andrew@FreeBSD.org>2016-11-29 21:44:46 +0800
commit263f32f71729c948ab9501287e6df81efd57c8f2 (patch)
tree7bfd2375bbbc12ed2d93b60782ed84a916222765 /devel/binutils
parent885d7eadbe3f7b4b92e93975704394a09da770e0 (diff)
downloadfreebsd-ports-263f32f71729c948ab9501287e6df81efd57c8f2.tar.gz
freebsd-ports-263f32f71729c948ab9501287e6df81efd57c8f2.tar.zst
freebsd-ports-263f32f71729c948ab9501287e6df81efd57c8f2.zip
Fix booting the arm64 kernel when built with clang 3.9.0
Clang 3.9.0 changes how weak extern is handled. They now use the got to handle them. This is a problem as ld.bfd doesn't fill out any default value in the got so pointers become NULL. This caused the kernel to fail to boot as we use this in linker sets. This fixes the issue by setting a default value in the got. The kernel still loads data through it, but because we always load it at a fixed virtual address the address it finds is valid. Approved by: bapt Differential Revision: https://reviews.freebsd.org/D8622
Notes
Notes: svn path=/head/; revision=427378
Diffstat (limited to 'devel/binutils')
-rw-r--r--devel/binutils/Makefile2
-rw-r--r--devel/binutils/files/patch-bfd_elfnn-aarch64.c28
2 files changed, 29 insertions, 1 deletions
diff --git a/devel/binutils/Makefile b/devel/binutils/Makefile
index 42fb76b698a4..c813c3d2570e 100644
--- a/devel/binutils/Makefile
+++ b/devel/binutils/Makefile
@@ -3,7 +3,7 @@
PORTNAME= binutils
PORTVERSION= 2.27
-PORTREVISION= 4
+PORTREVISION= 5
PORTEPOCH?= 1
CATEGORIES?= devel
MASTER_SITES= SOURCEWARE/binutils/releases
diff --git a/devel/binutils/files/patch-bfd_elfnn-aarch64.c b/devel/binutils/files/patch-bfd_elfnn-aarch64.c
new file mode 100644
index 000000000000..4967426b6faf
--- /dev/null
+++ b/devel/binutils/files/patch-bfd_elfnn-aarch64.c
@@ -0,0 +1,28 @@
+--- bfd/elfnn-aarch64.c.orig 2016-11-20 12:04:44.613621000 +0000
++++ bfd/elfnn-aarch64.c 2016-11-20 12:05:01.143334000 +0000
+@@ -4369,7 +4369,9 @@
+ off = h->got.offset;
+ BFD_ASSERT (off != (bfd_vma) - 1);
+ if (!WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, bfd_link_pic (info), h)
+- || (bfd_link_pic (info)
++ || ((bfd_link_pic (info)
++ || (!bfd_link_relocatable (info)
++ && (info->export_dynamic || info->dynamic)))
+ && SYMBOL_REFERENCES_LOCAL (info, h))
+ || (ELF_ST_VISIBILITY (h->other)
+ && h->root.type == bfd_link_hash_undefweak))
+@@ -8891,6 +8893,14 @@
+ + h->root.u.def.section->output_section->vma
+ + h->root.u.def.section->output_offset);
+ }
++ else if (!bfd_link_relocatable (info)
++ && (info->export_dynamic || info->dynamic)
++ && SYMBOL_REFERENCES_LOCAL (info, h))
++ {
++ BFD_ASSERT ((h->got.offset & 1) != 0);
++ rela.r_info = ELFNN_R_INFO (h->dynindx, AARCH64_R (GLOB_DAT));
++ rela.r_addend = 0;
++ }
+ else
+ {
+ do_glob_dat: