From owner-svn-src-all@FreeBSD.ORG Thu Sep 26 07:53:20 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 32A546EE; Thu, 26 Sep 2013 07:53:20 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 110D62528; Thu, 26 Sep 2013 07:53:20 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r8Q7rJiO026021; Thu, 26 Sep 2013 07:53:19 GMT (envelope-from andrew@svn.freebsd.org) Received: (from andrew@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r8Q7rJYF026004; Thu, 26 Sep 2013 07:53:19 GMT (envelope-from andrew@svn.freebsd.org) Message-Id: <201309260753.r8Q7rJYF026004@svn.freebsd.org> From: Andrew Turner Date: Thu, 26 Sep 2013 07:53:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r255874 - in head: contrib/binutils/binutils contrib/binutils/include/elf lib/csu/arm lib/csu/common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Sep 2013 07:53:20 -0000 Author: andrew Date: Thu Sep 26 07:53:18 2013 New Revision: 255874 URL: http://svnweb.freebsd.org/changeset/base/255874 Log: Add an elf note on ARM to store the MACHINE_ARCH an executable was built for. This is useful for software needing to know which architecture a binary is built for as arm and armv6 have slight differences meaning only some binaries build for one will work as expected on the other. It is expected pkgng will be able to make use of this to simplify the logic to determine which package ABI to use. Approved by: re (kib) Modified: head/contrib/binutils/binutils/readelf.c head/contrib/binutils/include/elf/common.h head/lib/csu/arm/crt1.c head/lib/csu/common/notes.h Modified: head/contrib/binutils/binutils/readelf.c ============================================================================== --- head/contrib/binutils/binutils/readelf.c Wed Sep 25 20:37:16 2013 (r255873) +++ head/contrib/binutils/binutils/readelf.c Thu Sep 26 07:53:18 2013 (r255874) @@ -9169,6 +9169,8 @@ get_freebsd_note_type (unsigned e_type) return _("NT_FREEBSD_ABI_TAG"); case NT_FREEBSD_NOINIT_TAG: return _("NT_FREEBSD_NOINIT_TAG"); + case NT_FREEBSD_ARCH_TAG: + return _("NT_FREEBSD_ARCH_TAG"); default: break; } Modified: head/contrib/binutils/include/elf/common.h ============================================================================== --- head/contrib/binutils/include/elf/common.h Wed Sep 25 20:37:16 2013 (r255873) +++ head/contrib/binutils/include/elf/common.h Thu Sep 26 07:53:18 2013 (r255874) @@ -456,6 +456,7 @@ #define NT_FREEBSD_TAG 1 #define NT_FREEBSD_NOINIT_TAG 2 +#define NT_FREEBSD_ARCH_TAG 3 /* These three macros disassemble and assemble a symbol table st_info field, which contains the symbol binding and symbol type. The STB_ and STT_ Modified: head/lib/csu/arm/crt1.c ============================================================================== --- head/lib/csu/arm/crt1.c Wed Sep 25 20:37:16 2013 (r255873) +++ head/lib/csu/arm/crt1.c Thu Sep 26 07:53:18 2013 (r255874) @@ -115,6 +115,20 @@ __start(int argc, char **argv, char **en exit(main(argc, argv, env)); } +static const struct { + int32_t namesz; + int32_t descsz; + int32_t type; + char name[sizeof(NOTE_FREEBSD_VENDOR)]; + char desc[sizeof(MACHINE_ARCH)]; +} archtag __attribute__ ((section (NOTE_SECTION), aligned(4))) __used = { + .namesz = sizeof(NOTE_FREEBSD_VENDOR), + .descsz = sizeof(int32_t), + .type = ARCH_NOTETYPE, + .name = NOTE_FREEBSD_VENDOR, + .desc = MACHINE_ARCH +}; + #ifdef GCRT __asm__(".text"); __asm__("eprol:"); Modified: head/lib/csu/common/notes.h ============================================================================== --- head/lib/csu/common/notes.h Wed Sep 25 20:37:16 2013 (r255873) +++ head/lib/csu/common/notes.h Thu Sep 26 07:53:18 2013 (r255874) @@ -34,5 +34,6 @@ #define ABI_NOTETYPE 1 #define CRT_NOINIT_NOTETYPE 2 +#define ARCH_NOTETYPE 3 #endif