Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src On sparc64: create additional "marker" object files, that ca...
details: https://anonhg.NetBSD.org/src/rev/95c78b8f8c39
branches: trunk
changeset: 791366:95c78b8f8c39
user: martin <martin%NetBSD.org@localhost>
date: Thu Nov 14 12:19:34 2013 +0000
description:
On sparc64: create additional "marker" object files, that can be used by the
compiler to encode the used code model in binaries.
diffstat:
distrib/sets/lists/comp/md.sparc64 | 5 ++-
lib/csu/common/Makefile.inc | 12 ++++++-
lib/csu/common/compident.S | 65 ++++++++++++++++++++++++++++++++++++++
lib/csu/common/sysident_assym.cf | 3 +
4 files changed, 83 insertions(+), 2 deletions(-)
diffs (124 lines):
diff -r d158cf89d3e7 -r 95c78b8f8c39 distrib/sets/lists/comp/md.sparc64
--- a/distrib/sets/lists/comp/md.sparc64 Thu Nov 14 12:11:13 2013 +0000
+++ b/distrib/sets/lists/comp/md.sparc64 Thu Nov 14 12:19:34 2013 +0000
@@ -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
diff -r d158cf89d3e7 -r 95c78b8f8c39 lib/csu/common/Makefile.inc
--- a/lib/csu/common/Makefile.inc Thu Nov 14 12:11:13 2013 +0000
+++ b/lib/csu/common/Makefile.inc Thu Nov 14 12:19:34 2013 +0000
@@ -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 @@
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)
diff -r d158cf89d3e7 -r 95c78b8f8c39 lib/csu/common/compident.S
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/csu/common/compident.S Thu Nov 14 12:19:34 2013 +0000
@@ -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 <martin%NetBSD.org@localhost>.
+ *
+ * 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
diff -r d158cf89d3e7 -r 95c78b8f8c39 lib/csu/common/sysident_assym.cf
--- a/lib/csu/common/sysident_assym.cf Thu Nov 14 12:11:13 2013 +0000
+++ b/lib/csu/common/sysident_assym.cf Thu Nov 14 12:19:34 2013 +0000
@@ -18,3 +18,6 @@
#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
Home |
Main Index |
Thread Index |
Old Index