From f63756e7e60f244c2c4ca537c5fd61f527a49585 Mon Sep 17 00:00:00 2001 From: Sergei Trofimovich Date: Sat, 18 Mar 2017 11:32:05 +0000 Subject: [PATCH] ia64: don't generate gprel64 relocations for linux kernel MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit linux kernel runtime linker does not support all relocation types yet. Recently added gprel64 broke linux kernel module loading: :: Loading from mdadm: raid0: invalid slot number 1 for IMM64 raid1: invalid slot number 1 for IMM64 The fix is to disable gprel64 optimisation in '-mconstant-gp' mode. Reported-by: Émeric Maschino Bug: https://bugs.gentoo.org/show_bug.cgi?id=601014 Signed-off-by: Sergei Trofimovich --- gcc/config/ia64/ia64.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/gcc/config/ia64/ia64.c b/gcc/config/ia64/ia64.c index 617d188d4f2..3fb8f278e24 100644 --- a/gcc/config/ia64/ia64.c +++ b/gcc/config/ia64/ia64.c @@ -1111,13 +1111,17 @@ ia64_expand_load_address (rtx dest, rtx src) emit_insn (gen_load_fptr (dest, src)); else if (sdata_symbolic_operand (src, VOIDmode)) emit_insn (gen_load_gprel (dest, src)); - else if (local_symbolic_operand64 (src, VOIDmode)) + else if ((!TARGET_CONST_GP) && local_symbolic_operand64 (src, VOIDmode)) { /* We want to use @gprel rather than @ltoff relocations for local symbols: - @gprel does not require dynamic linker - and does not use .sdata section - https://gcc.gnu.org/bugzilla/60465 */ + https://gcc.gnu.org/bugzilla/60465 + + Unfortunately linux kernel does not support gprel64 relocations + yet: https://bugs.gentoo.org/601014 + */ emit_insn (gen_load_gprel64 (dest, src)); } else -- 2.12.0