Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/csu Add support for a NetBSD MARCH elf note to record th...
details: https://anonhg.NetBSD.org/src/rev/33dd43c3dce5
branches: trunk
changeset: 789844:33dd43c3dce5
user: matt <matt%NetBSD.org@localhost>
date: Tue Sep 10 16:45:33 2013 +0000
description:
Add support for a NetBSD MARCH elf note to record the MACHINE_ARCH for
which a program was compiled.
diffstat:
lib/csu/Makefile | 21 +++++++++------------
lib/csu/arch/earm/Makefile.inc | 4 ++--
lib/csu/common/Makefile.inc | 5 +++--
lib/csu/common/sysident.S | 17 ++++++++++++++---
lib/csu/common/sysident_assym.cf | 6 ++++++
5 files changed, 34 insertions(+), 19 deletions(-)
diffs (128 lines):
diff -r 0ca9d86210f7 -r 33dd43c3dce5 lib/csu/Makefile
--- a/lib/csu/Makefile Tue Sep 10 16:35:10 2013 +0000
+++ b/lib/csu/Makefile Tue Sep 10 16:45:33 2013 +0000
@@ -1,24 +1,21 @@
-# $NetBSD: Makefile,v 1.32 2013/04/28 06:09:52 matt Exp $
+# $NetBSD: Makefile,v 1.33 2013/09/10 16:45:33 matt Exp $
.include <bsd.own.mk>
.if ${USE_COMPILERCRTSTUFF} != "yes"
-.if defined(CSU_MACHINE_ARCH)
-. if !exists(${.CURDIR}/arch/${CSU_MACHINE_ARCH}/Makefile.inc)
-. error CSU_MACHINE_ARCH (${CSU_MACHINE_ARCH}) is unsupported
-. endif
-.elif !empty(MACHINE_ARCH:Mearm*)
-CSU_MACHINE_ARCH= earm
-.elif exists(${.CURDIR}/arch/${MACHINE_ARCH}/Makefile.inc)
-CSU_MACHINE_ARCH= ${MACHINE_ARCH}
+CSU_MACHINE_ARCH?= ${MACHINE_ARCH}
+
+.if !empty(CSU_MACHINE_ARCH:Mearm*)
+ARCHDIR:= ${.CURDIR}/arch/earm
+.elif exists(${.CURDIR}/arch/${CSU_MACHINE_ARCH}/Makefile.inc)
+ARCHDIR:= ${.CURDIR}/arch/${CSU_MACHINE_ARCH}
.elif exists(${.CURDIR}/arch/${MACHINE_CPU}/Makefile.inc)
-CSU_MACHINE_ARCH= ${MACHINE_CPU}
+ARCHDIR:= ${.CURDIR}/arch/${MACHINE_CPU}
.else
-.error Architecture (${MACHINE_ARCH} or ${MACHINE_CPU}) unsupported
+.error Architecture (${CSU_MACHINE_ARCH} or ${MACHINE_CPU}) unsupported
.endif
-ARCHDIR:= ${.CURDIR}/arch/${CSU_MACHINE_ARCH}
.PATH: ${ARCHDIR}
. include "${ARCHDIR}/Makefile.inc"
diff -r 0ca9d86210f7 -r 33dd43c3dce5 lib/csu/arch/earm/Makefile.inc
--- a/lib/csu/arch/earm/Makefile.inc Tue Sep 10 16:35:10 2013 +0000
+++ b/lib/csu/arch/earm/Makefile.inc Tue Sep 10 16:45:33 2013 +0000
@@ -1,5 +1,5 @@
-# $NetBSD: Makefile.inc,v 1.2 2013/06/27 21:24:39 matt Exp $
+# $NetBSD: Makefile.inc,v 1.3 2013/09/10 16:45:33 matt Exp $
CPPFLAGS+= -I${ARCHDIR}
CPPFLAGS+= -DHAVE_INITFINI_ARRAY
-
+CPPFLAGS+= -DELF_NOTE_MARCH_DESC=\"${CSU_MACHINE_ARCH}\"
diff -r 0ca9d86210f7 -r 33dd43c3dce5 lib/csu/common/Makefile.inc
--- a/lib/csu/common/Makefile.inc Tue Sep 10 16:35:10 2013 +0000
+++ b/lib/csu/common/Makefile.inc Tue Sep 10 16:45:33 2013 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.inc,v 1.16 2013/08/05 13:38:35 matt Exp $
+# $NetBSD: Makefile.inc,v 1.17 2013/09/10 16:45:33 matt Exp $
.include <bsd.own.mk>
@@ -94,6 +94,7 @@
rm -f ${.TARGET}.o
.endif
+GENASSYM_CONF= ${COMMON_DIR}/sysident_assym.cf
sysident_assym.h: ${GENASSYM_CONF} ${GENASSYM_EXTRAS}
${_MKTARGET_CREATE}
cat ${COMMON_DIR}/sysident_assym.cf | \
@@ -103,7 +104,7 @@
CLEANFILES+= sysident_assym.h
-crti.o: crti.S sysident_assym.h
+crti.o: crti.S sysident_assym.h sysident.S
crtn.o: crtn.S
FILES=${OBJS}
diff -r 0ca9d86210f7 -r 33dd43c3dce5 lib/csu/common/sysident.S
--- a/lib/csu/common/sysident.S Tue Sep 10 16:35:10 2013 +0000
+++ b/lib/csu/common/sysident.S Tue Sep 10 16:45:33 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sysident.S,v 1.1 2010/08/07 18:01:33 joerg Exp $ */
+/* $NetBSD: sysident.S,v 1.2 2013/09/10 16:45:33 matt Exp $ */
/*
* Copyright (c) 1997 Christopher G. Demetriou
@@ -59,7 +59,7 @@
#include "sysident_assym.h"
.section ".note.netbsd.ident", "a"
- .align 4
+ .p2align 2
.long ELF_NOTE_NETBSD_NAMESZ
.long ELF_NOTE_NETBSD_DESCSZ
@@ -68,10 +68,21 @@
.long __NetBSD_Version__
.section ".note.netbsd.pax", "a"
- .align 4
+ .p2align 2
.long ELF_NOTE_PAX_NAMESZ
.long ELF_NOTE_PAX_DESCSZ
.long ELF_NOTE_TYPE_PAX_TAG
.ascii "PaX\0" /* ELF_NOTE_PAX_NAME */
.long 0
+
+#ifdef ELF_NOTE_MARCH_DESC
+ .section ".note.netbsd.march", "a"
+ .p2align 2
+
+ .long ELF_NOTE_MARCH_NAMESZ
+ .long ELF_NOTE_MARCH_DESCSZ
+ .long ELF_NOTE_TYPE_MARCH_TAG
+ .ascii "NetBSD\0\0"
+ .asciz ELF_NOTE_MARCH_DESC
+#endif
diff -r 0ca9d86210f7 -r 33dd43c3dce5 lib/csu/common/sysident_assym.cf
--- a/lib/csu/common/sysident_assym.cf Tue Sep 10 16:35:10 2013 +0000
+++ b/lib/csu/common/sysident_assym.cf Tue Sep 10 16:45:33 2013 +0000
@@ -10,3 +10,9 @@
define ELF_NOTE_PAX_DESCSZ ELF_NOTE_PAX_DESCSZ
define ELF_NOTE_TYPE_PAX_TAG ELF_NOTE_TYPE_PAX_TAG
#define ELF_NOTE_PAX_NAME ELF_NOTE_PAX_NAME
+
+define ELF_NOTE_MARCH_NAMESZ ELF_NOTE_MARCH_NAMESZ
+define ELF_NOTE_MARCH_DESCSZ sizeof(ELF_NOTE_MARCH_DESC)
+define ELF_NOTE_TYPE_MARCH_TAG ELF_NOTE_TYPE_MARCH_TAG
+#define ELF_NOTE_MARCH_NAME ELF_NOTE_MARCH_NAME
+#define ELF_NOTE_MARCH_DESC ELF_NOTE_MARCH_DESC
Home |
Main Index |
Thread Index |
Old Index