From owner-freebsd-arm@FreeBSD.ORG Mon Apr 8 06:24:12 2013 Return-Path: Delivered-To: freebsd-arm@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 69BF9797; Mon, 8 Apr 2013 06:24:12 +0000 (UTC) (envelope-from andrew@fubar.geek.nz) Received: from mta02.xtra.co.nz (mta05.xtra.co.nz [210.54.141.250]) by mx1.freebsd.org (Postfix) with ESMTP id DD29E2D5; Mon, 8 Apr 2013 06:24:11 +0000 (UTC) Received: from bender ([222.154.134.108]) by mta02.xtra.co.nz with ESMTP id <20130408062352.MCWR7887.mta02.xtra.co.nz@bender>; Mon, 8 Apr 2013 18:23:52 +1200 Date: Mon, 8 Apr 2013 18:24:00 +1200 From: Andrew Turner To: Ralf Wenk Subject: Re: arm/177686: assertion failed in ld-elf.so.1 when invoking telnet with parameters (clang, EABI) Message-ID: <20130408182400.426dcb93@bender> In-Reply-To: <201304070915.r379F83s096494@red.freebsd.org> References: <201304070915.r379F83s096494@red.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: freebsd-arm@freebsd.org, freebsd-gnats-submit@FreeBSD.org X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list 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:24:12 -0000 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