compiling ports on rpi3 - relocation 1031

Konstantin Belousov kostikbel at gmail.com
Wed Jan 4 10:22:35 UTC 2017


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 at 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));


More information about the freebsd-arm mailing list