Module Name:    src
Committed By:   martin
Date:           Thu Nov 14 12:19:35 UTC 2013

Modified Files:
        src/distrib/sets/lists/comp: md.sparc64
        src/lib/csu/common: Makefile.inc sysident_assym.cf
Added Files:
        src/lib/csu/common: compident.S

Log Message:
On sparc64: create additional "marker" object files, that can be used by the
compiler to encode the used code model in binaries.


To generate a diff of this commit:
cvs rdiff -u -r1.175 -r1.176 src/distrib/sets/lists/comp/md.sparc64
cvs rdiff -u -r1.20 -r1.21 src/lib/csu/common/Makefile.inc
cvs rdiff -u -r0 -r1.1 src/lib/csu/common/compident.S
cvs rdiff -u -r1.3 -r1.4 src/lib/csu/common/sysident_assym.cf

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/distrib/sets/lists/comp/md.sparc64
diff -u src/distrib/sets/lists/comp/md.sparc64:1.175 src/distrib/sets/lists/comp/md.sparc64:1.176
--- src/distrib/sets/lists/comp/md.sparc64:1.175	Sun Nov 10 02:43:23 2013
+++ src/distrib/sets/lists/comp/md.sparc64	Thu Nov 14 12:19:35 2013
@@ -1,4 +1,4 @@
-# $NetBSD: md.sparc64,v 1.175 2013/11/10 02:43:23 mrg Exp $
+# $NetBSD: md.sparc64,v 1.176 2013/11/14 12:19:35 martin Exp $
 ./usr/include/g++/bits/sparc			comp-c-include
 ./usr/include/g++/bits/sparc/c++config.h	comp-c-include		gcccmds,gcc=48,compat
 ./usr/include/g++/bits/sparc64			comp-c-include
@@ -143,6 +143,9 @@
 ./usr/include/sparc64/vuid_event.h		comp-c-include
 ./usr/include/sparc64/wchar_limits.h		comp-c-include
 ./usr/include/sparc64/z8530var.h		comp-c-include
+./usr/lib/sparc_mcmedany.o			comp-c-lib
+./usr/lib/sparc_mcmedlow.o			comp-c-lib
+./usr/lib/sparc_mcmedmid.o			comp-c-lib
 ./usr/lib/sparc/crt0.o				comp-c-lib		compat
 ./usr/lib/sparc/crtbegin.o			comp-c-lib		compat
 ./usr/lib/sparc/crtbeginS.o			comp-c-lib		compat,pic

Index: src/lib/csu/common/Makefile.inc
diff -u src/lib/csu/common/Makefile.inc:1.20 src/lib/csu/common/Makefile.inc:1.21
--- src/lib/csu/common/Makefile.inc:1.20	Mon Nov 11 10:24:27 2013
+++ src/lib/csu/common/Makefile.inc	Thu Nov 14 12:19:34 2013
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.20 2013/11/11 10:24:27 joerg Exp $
+#	$NetBSD: Makefile.inc,v 1.21 2013/11/14 12:19:34 martin Exp $
 
 .include <bsd.own.mk>
 
@@ -21,6 +21,16 @@ CFLAGS.crtbegin.c+= -fPIE
 OBJS+=		crtfm.o
 .endif
 
+.if ${MACHINE_ARCH} == "sparc64"
+# create helper objects for the compiler to mark compiler memory models
+.for m in medlow medmid medany
+sparc_mc${m}.o:	compident.S sysident_assym.h
+	${CC} ${ASFLAGS} -I. -DCONTENT=\"${m}\\0\\0\" -DCONTENTLENGTH=8 -c \
+		-o $@ ${COMMON_DIR}/compident.S
+.endfor
+OBJS += sparc_mcmedlow.o sparc_mcmedmid.o sparc_mcmedany.o
+.endif
+
 realall: ${OBJS}
 
 .if exists(${ARCHDIR}/crtbegin.S)

Index: src/lib/csu/common/sysident_assym.cf
diff -u src/lib/csu/common/sysident_assym.cf:1.3 src/lib/csu/common/sysident_assym.cf:1.4
--- src/lib/csu/common/sysident_assym.cf:1.3	Tue Sep 10 17:23:55 2013
+++ src/lib/csu/common/sysident_assym.cf	Thu Nov 14 12:19:34 2013
@@ -18,3 +18,6 @@ define	ELF_NOTE_TYPE_MARCH_TAG		ELF_NOTE
 #define	ELF_NOTE_MARCH_NAME		ELF_NOTE_MARCH_NAME
 #define	ELF_NOTE_MARCH_DESC		ELF_NOTE_MARCH_DESC
 endif
+
+define	ELF_NOTE_MCMODEL_NAMESZ		ELF_NOTE_MCMODEL_NAMESZ
+define	ELF_NOTE_TYPE_MCMODEL_TAG	ELF_NOTE_TYPE_MCMODEL_TAG

Added files:

Index: src/lib/csu/common/compident.S
diff -u /dev/null src/lib/csu/common/compident.S:1.1
--- /dev/null	Thu Nov 14 12:19:35 2013
+++ src/lib/csu/common/compident.S	Thu Nov 14 12:19:34 2013
@@ -0,0 +1,65 @@
+/* $NetBSD: compident.S,v 1.1 2013/11/14 12:19:34 martin Exp $ */
+
+/*-
+ * Copyright (c) 2002, 2008 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Martin Husemann <[email protected]>.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+
+/*
+ * This file is used to generate a note describing the code model in use by
+ * the compiler on some architectures where this has consequences for the
+ * VA layout applied by the kernel. On sparc64 the topdown VA layout can
+ * only be enabled for processes compiled with -mcmodel=medany or greater,
+ * but not for processes without this note or -mcmodel=medlow.
+ *
+ * The note looks similar to the .note.netbsd.march note used (for example)
+ * on arm to note the ABI used by the process.
+ *
+ * [NOTE HEADER]
+ *	long		name size
+ *	long		content size
+ *	long		note type
+ *
+ * [NOTE DATUM]
+ *	string		code model (for sparc64: medlow, medmid, medany,
+ *			the embedany model is never PIC, so not used here)
+ *
+ * The DATUM fields should be padded out such that their actual (not
+ * declared) sizes % 4 == 0.
+ */
+
+#include "sysident_assym.h"
+
+	.section ".note.netbsd.mcmodel", "a"
+	.p2align 2
+
+	.long	ELF_NOTE_MCMODEL_NAMESZ
+	.long	CONTENTLENGTH
+	.long	ELF_NOTE_TYPE_MCMODEL_TAG
+	.ascii	"NetBSD\0\0"
+	.ascii	CONTENT

Reply via email to