From owner-freebsd-arm@FreeBSD.ORG Mon Apr 8 06:30:02 2013 Return-Path: Delivered-To: freebsd-arm@smarthost.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 9DF6E80E for ; Mon, 8 Apr 2013 06:30:02 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id 9059D300 for ; Mon, 8 Apr 2013 06:30:02 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.6/8.14.6) with ESMTP id r386U1VP004015 for ; Mon, 8 Apr 2013 06:30:01 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.6/8.14.6/Submit) id r386U124004014; Mon, 8 Apr 2013 06:30:01 GMT (envelope-from gnats) Date: Mon, 8 Apr 2013 06:30:01 GMT Message-Id: <201304080630.r386U124004014@freefall.freebsd.org> To: freebsd-arm@FreeBSD.org Cc: From: Andrew Turner Subject: Re: arm/177686: assertion failed in ld-elf.so.1 when invoking telnet with parameters (clang, EABI) X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: Andrew Turner List-Id: Porting FreeBSD to the StrongARM Processor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Apr 2013 06:30:02 -0000 The following reply was made to PR arm/177686; it has been noted by GNATS. From: Andrew Turner To: Ralf Wenk Cc: freebsd-gnats-submit@FreeBSD.org, freebsd-arm@freebsd.org Subject: Re: arm/177686: assertion failed in ld-elf.so.1 when invoking telnet with parameters (clang, EABI) Date: Mon, 8 Apr 2013 18:24:00 +1200 On Sun, 7 Apr 2013 09:15:08 GMT Ralf Wenk wrote: > Invoking telnet with parameters triggers an assertion failure: > > # telnet www.belwue.de 80 > ld-elf.so.1: assert > failed: /home/rpi/src/libexec/rtldelf/rtld_lock.c:233 Abort (core > dumped) This is an issue with either llvm or out dynamic linker, I haven't yet decided. Normally llvm aligns the stack to an 8 byte boundary and generates code that relies on this alignment, however for leaf functions the compiler is allowed to only align to a 4 byte boundary. The problem is when there are functions that, from the C code, appear to be a leaf function however are not due to them calling other functions, for example __aeabi_read_tp(). With a static binary this would not be an issue, however with a dynamic libc it means, on the first call, we enter the dynamic linker which assumes the stack is aligned. One solution is to ensure the stack is aligned in the dynamic linker, however I'm leaning towards llvm being broken in this case as it should have aligned the stack correctly before calling another function as per the ABI documentation, as the stack pointer must be 8 byte aligned at any public interface. Andrew