From owner-freebsd-arm@freebsd.org Wed Jan 4 10:22:35 2017 Return-Path: Delivered-To: freebsd-arm@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D45FDC9C7BA for ; Wed, 4 Jan 2017 10:22:35 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 534941064 for ; Wed, 4 Jan 2017 10:22:35 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id v04AMPXK062539 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 4 Jan 2017 12:22:25 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua v04AMPXK062539 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id v04AMPJi062538; Wed, 4 Jan 2017 12:22:25 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 4 Jan 2017 12:22:25 +0200 From: Konstantin Belousov To: tech-lists Cc: freebsd-arm@freebsd.org Subject: Re: compiling ports on rpi3 - relocation 1031 Message-ID: <20170104102224.GB2356@kib.kiev.ua> References: <055826e7-9b91-11ac-6ae2-2a5d5da4db4a@zyxst.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <055826e7-9b91-11ac-6ae2-2a5d5da4db4a@zyxst.net> User-Agent: Mutt/1.7.2 (2016-11-26) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Jan 2017 10:22:35 -0000 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));