From owner-freebsd-arch@FreeBSD.ORG Wed Jul 10 03:03:00 2013 Return-Path: Delivered-To: freebsd-arch@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 C827C238 for ; Wed, 10 Jul 2013 03:03:00 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from mail-ie0-f177.google.com (mail-ie0-f177.google.com [209.85.223.177]) by mx1.freebsd.org (Postfix) with ESMTP id 9BD6E1ED2 for ; Wed, 10 Jul 2013 03:03:00 +0000 (UTC) Received: by mail-ie0-f177.google.com with SMTP id aq17so14240170iec.36 for ; Tue, 09 Jul 2013 20:02:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=sender:subject:mime-version:content-type:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to:x-mailer :x-gm-message-state; bh=9Al2KcZqeTjR+/gO3Xf+XmP5lNIE29l/vo8FcpR38Rc=; b=OciC+8Sr/iYoGMo5ZU7C/BBFjR9B2+N1qCYpOr6zBS2hr4ilmmIjwU2zB10j2wBHTo RQemIuk+PEHjvUx3fcubg0eqIN+Nt4s0dkGPQoFSRnJ+GNwbfoUZoKnUBr+/pqBQwTNM 2sjmYn9StiDjuiVnJNDiBA+NTadl46/F+r0K2UKFRW2iHAT0XvE8xndGxQRW/83U8xN1 gvxP0XR3BBm/2+VjXC7bBdpyuOXKalTH0YthI/zWYnFA4vogaPjAp1ADfQnf7R2gB8QJ ZySItXoFmSg46wV/LmHO8Zl0NOcUGhvxpzc2zy1L2lsAe1kppn0URmrR/Ucc80uwcNA3 iwZg== X-Received: by 10.50.67.111 with SMTP id m15mr10914343igt.54.1373425374590; Tue, 09 Jul 2013 20:02:54 -0700 (PDT) Received: from 53.imp.bsdimp.com (50-78-194-198-static.hfc.comcastbusiness.net. [50.78.194.198]) by mx.google.com with ESMTPSA id z15sm36695467igp.0.2013.07.09.20.02.52 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 09 Jul 2013 20:02:53 -0700 (PDT) Sender: Warner Losh Subject: Re: Adding a MACHINE_ARCH note Mime-Version: 1.0 (Apple Message framework v1085) Content-Type: text/plain; charset=us-ascii From: Warner Losh In-Reply-To: <20130709234837.559e3769@bender.Home> Date: Tue, 9 Jul 2013 21:02:51 -0600 Content-Transfer-Encoding: quoted-printable Message-Id: <95B55330-1AC8-467C-942C-50795F168E49@bsdimp.com> References: <20130709090744.0e497e7e@bender.Home> <32F979BD-FB5C-4111-9586-4C5E7C6DFA71@bsdimp.com> <20130709234837.559e3769@bender.Home> To: Andrew Turner X-Mailer: Apple Mail (2.1085) X-Gm-Message-State: ALoCoQlUeI4meifHhnN4ncksgy3phFQ8DPwyXlQ/MR59rrxo3OFJkP6dv2xdyO77y1dbAEJuC5jn Cc: freebsd-arch@freebsd.org X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jul 2013 03:03:00 -0000 On Jul 9, 2013, at 4:48 PM, Andrew Turner wrote: > On Tue, 9 Jul 2013 08:19:46 -0600 > Warner Losh wrote: >> I thought that the ELF headers gave us all the data we needed to know >> how things were built... >=20 > It will tell us if it was for e.g. an ARM or MIPS ELF file, but I'm = not > sure how we can tell the difference between an arm and an armv6 ELF. >=20 > With armv6 there are a few changes in the userland/kernel > interface, e.g. reading the thread local storage pointer is different > such that an armv6 static binary would not run on an ARMv5 core as it > uses newer instructions. On MIPS I know all that is encoded in the ELF headers for sure, so I = went looking for ARM. OK. Found the ARM elf spec. = http://infocenter.arm.com/help/topic/com.arm.doc.dui0101a/DUI0101A_Elf.pdf= which is updated by = http://infocenter.arm.com/help/topic/com.arm.doc.ihi0044e/IHI0044E_aaelf.p= df For big endian vs little endian: ei_data is set to ELFDATA2LSB or = ELFDATA2MSB. EABI is denoted by setting EI_OSABI to ELFOSABI_ARM_AEABI. e_flags will have some info as well: EF_ARM_ABIMASK 0xFF000000 (value of 5 for EABI for armv6) EF_ARM_BE8 0x00800000 - The ELF file contains BE-8 code, suitable for = execution on an ARM=20 Architecture v6 processor EF_ARM_ABI_FLOAT_HARD 0x00000400 - Set in executable file headers = (e_type =3D ET_EXEC or ET_DYN) to note that=20 the executable file was built to conform to the hardware floating-point=20= procedure-call standard. Compatible with legacy (pre version 5) gcc use as EF_ARM_VFP_FLOAT. EF_ARM_ABI_FLOAT_SOFT 0x00000200 - Set in executable file headers = (e_type =3D ET_EXEC or ET_DYN) to note=20 explicitly that the executable file was built to conform to the software=20= floating-point procedure-call standard (the base standard). If both=20 EF_ARM_ABI_FLOAT_XXXX bits are clear, conformance to the base=20 procedure-call standard is implied. Compatible with legacy (pre version 5) gcc use as EF_ARM_SOFT_FLOAT What else is needed? Warner