NetBSD resynchronization fixes

Change-Id: I99b109890de1d555e2ff023c62a38f78e4cfc6b3
This commit is contained in:
David van Moolenbroek 2015-11-11 05:30:14 +01:00 committed by Lionel Sambuc
parent 57ca7ad105
commit df29ad7c0e
19 changed files with 56 additions and 20 deletions

View File

@ -2,6 +2,10 @@
.include <bsd.init.mk>
.if defined(__MINIX)
.PATH: ${SRCDIR}
.endif # defined(__MINIX)
.if ${MKSHARE} != "no"
FILESDIR= /usr/share/doc/reference/ref1/kyua/kyua-atf-compat
FILESMODE= 444

View File

@ -2,6 +2,10 @@
.include <bsd.init.mk>
.if defined(__MINIX)
.PATH: ${SRCDIR}
.endif # defined(__MINIX)
FILES= lib.subr tests_lib.subr
FILESDIR= /usr/share/kyua-atf-compat
FILESMODE= 444

View File

@ -75,7 +75,7 @@ CPPFLAGS+= -D_NLS_PRIVATE=1
.endif # ${HOST_OSTYPE:C/\-.*//} == "Minix"
.endif # !defined(__MINIX)
LLVM_CONFIGURE_ARGS= \
LLVM_CONFIGURE_ARGS+= \
--enable-targets=x86,powerpc,sparc,aarch64,arm,mips \
--with-c-include-dirs=/usr/include/clang-${CLANG_VERSION:R}:/usr/include \
--disable-timestamps --prefix=/usr --sysconfdir=/etc/llvm \

View File

@ -43,6 +43,7 @@ __RCSID("$NetBSD: abort.c,v 1.15 2012/06/08 11:15:26 abs Exp $");
#include <stdlib.h>
#include <unistd.h>
#if !defined(__minix) || !defined(_LIBMINC)
extern void (*__cleanup)(void);
static int aborting = 0;
@ -82,3 +83,13 @@ abort(void)
(void)raise(SIGABRT);
_exit(1);
}
#else /* defined(__minix) && defined(_LIBMINC) */
void
abort(void)
{
/* We cannot use signals from system services. */
exit(1);
}
#endif /* defined(__minix) && defined(_LIBMINC) */

View File

@ -82,6 +82,13 @@ extracted-mtype.h: extract-mtype.sh ../include/minix/com.h
cd ${.CURDIR} ; ${HOST_SH} extract-mtype.sh > ${.OBJDIR}/extracted-mtype.h
.if ${USE_BITCODE:Uno} == "yes"
# dcvmoole: this is a copy of the "${_P}: ${_P}.bcl.o" block from bsd.prog.mk,
# with two changes: 1) ${OBJS} is added so as to link in objects that have not
# been compiled with bitcode, and 2) we are directly loading the gold plugin
# rather than through ${BITCODE_LD_FLAGS_2ND.kernel}, because LLVMgold will
# not load libLTO when no LTO can be performed (due to the non- bitcode
# objects), causing it to fail on unrecognized -disable-opt/-disable-inlining
# options. At least I think that's what's going on? I'm no expert here..
kernel: kernel.bcl.o
${_MKTARGET_LINK}
${_CCLINK.kernel} \
@ -89,7 +96,7 @@ kernel: kernel.bcl.o
-L${DESTDIR}/usr/lib \
${_LDSTATIC.kernel} -o ${.TARGET} \
${.TARGET}.bcl.o ${OBJS} ${_PROGLDOPTS} ${_LDADD.kernel} \
${BITCODE_LD_FLAGS_2ND.kernel} \
-Wl,-plugin=${GOLD_PLUGIN} \
-Wl,--allow-multiple-definition
.endif

View File

@ -110,7 +110,7 @@ if [ "${GENERATE_MAP}" != "" ] && [[ ${GENERATE_MAP} =~ [yY][eE][sS] ]]; then
generate_modules_map
fi
: ${OPTFLAGS="-disable-opt -disable-internalize -disable-inlining -load ${MINIX_LLVM_DIR}/bin/weak-alias-module-override.so -weak-alias-module-override"}
: ${OPTFLAGS="-disable-opt -disable-inlining -load ${MINIX_LLVM_DIR}/bin/weak-alias-module-override.so -weak-alias-module-override"}
# If we are really instrumenting with some pass...
if [ "${LLVMPASS_PATHS}" != "" ]; then

View File

@ -26,7 +26,7 @@ cd ${OBJ_LLVM}
${LLVMSRCDIR}/llvm/configure \
--enable-targets=x86 \
--with-c-include-dirs=/usr/include/clang-3.4:/usr/include \
--with-c-include-dirs=/usr/include/clang-3.6:/usr/include \
--disable-timestamps \
--prefix=/usr \
--sysconfdir=/etc/llvm \

View File

@ -163,7 +163,7 @@
(T)->contained_types = NULL; \
(T)->bit_width = (S)*8; \
(T)->name = N; \
sprintf(B, "i%d", (T)->bit_width); \
snprintf(B, sizeof(B), "i%d", (T)->bit_width); \
(T)->type_str = B; \
} while(0)

View File

@ -106,9 +106,9 @@
&& "Sentry key length too long!"); \
\
sentry_hash->key[0] = 0; \
sprintf(sentry_hash->key, "%s%s%s" MAGIC_ID_FORMAT, \
MAGIC_DSENTRY_ABS_NAME_SEP, sentry->name, \
MAGIC_DSENTRY_ABS_NAME_SEP, \
snprintf(sentry_hash->key, sizeof(sentry_hash->key), \
"%s%s%s" MAGIC_ID_FORMAT, MAGIC_DSENTRY_ABS_NAME_SEP, \
sentry->name, MAGIC_DSENTRY_ABS_NAME_SEP, \
(_magic_id_t) MAGIC_DSENTRY_SITE_ID_NULL); \
sentry_list->sentry = sentry; \
sentry_hash->sentry_list = sentry_list; \
@ -123,8 +123,9 @@
&& "Dsentry key length too long!"); \
\
sentry_hash->key[0] = 0; \
sprintf(sentry_hash->key, "%s%s%s%s" MAGIC_ID_FORMAT, \
dsentry->parent_name, MAGIC_DSENTRY_ABS_NAME_SEP, sentry->name, \
snprintf(sentry_hash->key, sizeof(sentry_hash->key), \
"%s%s%s%s" MAGIC_ID_FORMAT, dsentry->parent_name, \
MAGIC_DSENTRY_ABS_NAME_SEP, sentry->name, \
MAGIC_DSENTRY_ABS_NAME_SEP, dsentry->site_id); \
sentry_list->sentry = sentry; \
sentry_hash->sentry_list = sentry_list; \

View File

@ -57,7 +57,7 @@ LLVMGOLD_RANLIB=$(LLVMGOLD_AR) -s
LLVMGOLD_AR_FLAGS=--plugin $(LLVMGOLD_PLUGIN) -cru
LLVMGOLD_CFLAGS=-fasynchronous-unwind-tables -g -D_MINIX -D_POSIX_SOURCE -D_SYSTEM -Wno-long-long --sysroot=$(_MINIX_SYSROOT) -I$(LLVMINC) -I$(_MINIX_OBJ_LLVM_DIR)/include/llvm -I$(_MINIX_ROOT)/external/bsd/llvm/dist/llvm/include -I$(_MINIX_OBJ_LLVM_DIR)/include -I$(_MINIX_SYSROOT)/usr/include
LLVMGOLD_LINK=-Wl,--plugin -Wl,$(LLVMGOLD_PLUGIN)
LLVMGOLD_LINKFLAGS=-Wl,-plugin-opt=-disable-fp-elim -Wl,-plugin-opt=-disable-inlining -Wl,-plugin-opt=also-emit-llvm
LLVMGOLD_LINKFLAGS=-Wl,-plugin-opt=-disable-fp-elim -Wl,-plugin-opt=save-temps
LLVMGOLD_LINKCOMMONFLAGS=-L$(_MINIX_OBJ_DIR)/destdir.$(_MINIX_ARCH)/usr/lib -rdynamic
LLVMGOLD_LIBS=
LLVMGOLD_LDFLAGS=$(LLVMGOLD_LINK) $(LLVMGOLD_LINKFLAGS) $(LLVMGOLD_LINKCOMMONFLAGS) $(LLVMGOLD_LIBS)

View File

@ -453,7 +453,7 @@ PUBLIC void magic_init(void)
/* Initialize memory pool descriptors. */
for (i = 0; i < MAGIC_MAX_MEMPOOLS; i++) {
sprintf(_magic_mpdescs[i].name, "%s%d%s", MAGIC_MEMPOOL_NAME_PREFIX, i, MAGIC_ALLOC_NAME_SUFFIX);
snprintf(_magic_mpdescs[i].name, sizeof(_magic_mpdescs[i].name), "%s%d%s", MAGIC_MEMPOOL_NAME_PREFIX, i, MAGIC_ALLOC_NAME_SUFFIX);
}
/* Initialize special types. */

View File

@ -33,16 +33,16 @@ PUBLIC int magic_selement_lookup_by_name(char *name,
/*
* Dsentry. Will contain: sentry_id<DELIM>parent_name<DELIM>name<DELIM>site_id.
*/
delim = '\0';
*delim = '\0';
/* Skip sentry_id */
sentry_parent_name = delim + 1;
delim = strchr(delim + 1, MAGIC_DSENTRY_ABS_NAME_SEP[0]);
assert(!delim && "No dsentry name found in selement name!");
delim = '\0';
*delim = '\0';
sentry_name = delim + 1;
delim = strchr(delim + 1, MAGIC_DSENTRY_ABS_NAME_SEP[0]);
assert(!delim && "No dsentry site id found in selement name!");
delim = '\0';
*delim = '\0';
dsentry_site_id = strtoul((const char*)delim+1, NULL, 10);
}

View File

@ -882,7 +882,7 @@ PUBLIC struct _magic_sentry *magic_sentry_lookup_by_name_hash(
char key[MAGIC_SENTRY_NAME_MAX_KEY_LEN];
struct _magic_sentry_hash *res, *head;
key[0] = 0;
sprintf(key, "%s%s%s%s" MAGIC_ID_FORMAT, parent_name,
snprintf(key, sizeof(key), "%s%s%s%s" MAGIC_ID_FORMAT, parent_name,
MAGIC_DSENTRY_ABS_NAME_SEP, name, MAGIC_DSENTRY_ABS_NAME_SEP, site_id);
head = (struct _magic_sentry_hash *) magic_sentry_hash_head;
@ -906,7 +906,7 @@ PUBLIC struct _magic_sentry_list *magic_sentry_list_lookup_by_name_hash(
char key[MAGIC_SENTRY_NAME_MAX_KEY_LEN];
struct _magic_sentry_hash *res, *head;
key[0] = 0;
sprintf(key, "%s%s%s%s" MAGIC_ID_FORMAT, parent_name,
snprintf(key, sizeof(key), "%s%s%s%s" MAGIC_ID_FORMAT, parent_name,
MAGIC_DSENTRY_ABS_NAME_SEP, name, MAGIC_DSENTRY_ABS_NAME_SEP, site_id);
head = (struct _magic_sentry_hash *) magic_sentry_hash_head;

View File

@ -445,7 +445,8 @@ PUBLIC int st_add_special_mmapped_region(void *address, size_t size,
if (!_magic_enabled) return OK;
if (!name) {
sprintf(addr_name, "%%MMAP_0x%08x", (unsigned int) address);
snprintf(addr_name, sizeof(addr_name), "%%MMAP_0x%08x",
(unsigned int) address);
name = addr_name;
}
obdsentry = magic_create_obdsentry(address, MAGIC_VOID_TYPE,

View File

@ -493,6 +493,8 @@ main(void)
start(85);
setuid(geteuid());
signal(SIGINT, got_signal);
signal(SIGABRT, got_signal);
signal(SIGSEGV, got_signal);

View File

@ -69,7 +69,7 @@ GOLD_PLUGIN?=${NETBSDSRCDIR}/minix/llvm/bin/LLVMgold.so
# - run the passe which allows assembly weak symbols to be
# overriden by bitcode functions
OPTFLAGS?= -disable-opt \
-disable-internalize -disable-inlining \
-disable-inlining \
-load ${WEAKALIASOVERRIDEPASS} -weak-alias-module-override
BITCODE_LD_FLAGS_1ST?= \

View File

@ -62,7 +62,7 @@ CFLAGS+= -Wa,--fatal-warnings
.if (!defined(MKPIC) || ${MKPIC} != "no") && \
(!defined(LDSTATIC) || ${LDSTATIC} != "-static")
# XXX there are some strange problems not yet resolved
. if !defined(HAVE_GCC) || (defined(HAVE_LLVM) && !defined(USE_BITCODE))
. if defined(HAVE_LLVM) && !defined(USE_BITCODE)
LDFLAGS+= -Wl,--fatal-warnings
. endif
.endif

View File

@ -6,6 +6,8 @@ AFLAGS.cdboot.S= ${${ACTIVE_CC} == "clang":?-no-integrated-as:}
.if defined(__MINIX)
# LSC: Still required by our old binutils
AFLAGS.cdboot.S+= -Wa,--divide
USE_BITCODE=no
.endif # defined(__MINIX)
PIE_CFLAGS=

View File

@ -14,6 +14,10 @@ PIE_CFLAGS=
PIE_LDFLAGS=
PIE_AFLAGS=
.if defined(__MINIX)
USE_BITCODE=no
.endif # defined(__MINIX)
.include <bsd.own.mk>
STRIPFLAG= # override