Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 4 Jan 2017 12:22:25 +0200
From:      Konstantin Belousov <kostikbel@gmail.com>
To:        tech-lists <tech-lists@zyxst.net>
Cc:        freebsd-arm@freebsd.org
Subject:   Re: compiling ports on rpi3 - relocation 1031
Message-ID:  <20170104102224.GB2356@kib.kiev.ua>
In-Reply-To: <055826e7-9b91-11ac-6ae2-2a5d5da4db4a@zyxst.net>
References:  <055826e7-9b91-11ac-6ae2-2a5d5da4db4a@zyxst.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Jan 04, 2017 at 09:36:34AM +0000, tech-lists wrote:
> Hello list,
> 
> I get this error when, for instance, trying to compile screen on the rpi3:
> 
> ===>  Building for screen-4.4.0_2
> /usr/local/lib/libintl.so: Unhandled relocation 1031
> Fatal error
> *** Error code 1
> 
> Stop.
> make[1]: stopped in /usr/ports/sysutils/screen
> *** Error code 1
> 
> Stop.
> make: stopped in /usr/ports/sysutils/screen
> 
> Is there a workaround for this?
> 
> I'm using an image built with sources r311011 ports r430455 and the
> image was created with crochet.
> 
> uname -a
> FreeBSD rpi3 12.0-CURRENT FreeBSD 12.0-CURRENT #0 7456285(master)-dirty:
> Tue Jan  3 16:25:46 GMT 2017
> john@localhost:/root/tmp/crochet/work/obj/arm64.aarch64/root/tmp/crochet/fbsd12-src/sys/PEA
>  arm64

This is TLSDESC relocation outside PLT.

Try this (I did not even compiled the changed code).

diff --git a/libexec/rtld-elf/aarch64/reloc.c b/libexec/rtld-elf/aarch64/reloc.c
index 3f9de07db29..45ad5d02ce3 100644
--- a/libexec/rtld-elf/aarch64/reloc.c
+++ b/libexec/rtld-elf/aarch64/reloc.c
@@ -317,6 +317,7 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld, int flags,
 	const Elf_Sym *def;
 	SymCache *cache;
 	Elf_Addr *where;
+	struct tls_data *tlsdesc;
 	unsigned long symnum;
 
 	if ((flags & SYMLOOK_IFUNC) != 0)
@@ -391,6 +392,14 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld, int flags,
 		case R_AARCH64_RELATIVE:
 			*where = (Elf_Addr)(obj->relocbase + rela->r_addend);
 			break;
+		case R_AARCH64_TLSDESC:
+			if (symnum != 0) {
+				tlsdesc = (struct tls_data *)where[1];
+				if (tlsdesc->index == -1)
+					rtld_tlsdesc_handle_locked(tlsdesc,
+					    SYMLOOK_IN_PLT | flags, lockstate);
+			}
+			break;
 		default:
 			rtld_printf("%s: Unhandled relocation %lu\n",
 			    obj->path, ELF_R_TYPE(rela->r_info));



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20170104102224.GB2356>