support NetBSD

Conflicts:
	cctools/configure.ac
This commit is contained in:
Thomas Pöchtrager 2014-03-24 21:16:34 +01:00
parent 6ae47777a4
commit f5d5816851
16 changed files with 58 additions and 21 deletions

View File

@ -1,4 +1,4 @@
# Apple cctools port for Linux and FreeBSD #
# Apple cctools port for Linux, FreeBSD and NetBSD #
Current Version: 845 + ld64-136
Originally ported by cjacker from the [ios-toolchain-for-linux](https://code.google.com/p/ios-toolchain-based-on-clang-for-linux/) project.

View File

@ -81,7 +81,9 @@ static char rcsid[] = "$OpenBSD: contents.c,v 1.2 1996/06/26 05:31:19 deraadt Ex
#include "archive.h"
#include "extern.h"
#ifndef HAVE_STRMODE
extern void strmode(int mode, char *p);
#endif
/*
* contents --

View File

@ -10,11 +10,13 @@ AC_ARG_PROGRAM
CC=clang
CXX=clang++
CFLAGS="$CFLAGS `cat tmp/cflags 2>/dev/null` -O3"
CXXFLAGS="$CXXFLAGS `cat tmp/libcxx-conf 2>/dev/null || echo -stdlib=libc++` `cat tmp/cxxflags 2>/dev/null` -O3"
CFLAGS="$CFLAGS `cat tmp/cflags 2>/dev/null`"
CFLAGS="$CFLAGS -isystem /usr/local/include -isystem /usr/pkg/include -O3"
CXXFLAGS="$CXXFLAGS `cat tmp/libcxx-conf 2>/dev/null || echo -stdlib=libc++` `cat tmp/cxxflags 2>/dev/null`"
CXXFLAGS="$CXXFLAGS -isystem /usr/local/include -isystem /usr/pkg/include -O3"
LDFLAGS="$LDFLAGS -L/usr/local/lib `cat tmp/ldflags 2>/dev/null`"
export LD_LIBRARY_PATH="`cat tmp/ldpath 2>/dev/null`"
export C_INCLUDE_PATH="$C_INCLUDE_PATH:/usr/local/include"
CPP="clang -E"
@ -225,6 +227,17 @@ AC_COMPILE_IFELSE(
)
CFLAGS=$ORIGCFLAGS
ORIGCFLAGS=$CFLAGS
CFLAGS="$CFLAGS -Wno-char-subscripts"
AC_MSG_CHECKING([if -Wno-char-subscripts is supported])
AC_COMPILE_IFELSE(
[AC_LANG_SOURCE([[const char hw[] = "Hello, World\n";]])],
[WARNINGS="$WARNINGS -Wno-char-subscripts"
AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])]
)
CFLAGS=$ORIGCFLAGS
AC_SUBST([WARNINGS], [$WARNINGS])
@ -251,6 +264,8 @@ AC_SUBST(CRYPT_LIBS)
AC_C_BIGENDIAN([AC_SUBST([ENDIAN_FLAG],[-D__BIG_ENDIAN__=1])],
[AC_SUBST([ENDIAN_FLAG],[-D__LITTLE_ENDIAN__=1])])
AC_CHECK_FUNCS([strmode])
AC_CONFIG_FILES([Makefile libstuff/Makefile])
AC_CONFIG_FILES([ar/Makefile])
AC_CONFIG_FILES([as/Makefile])

View File

@ -96,9 +96,9 @@
#define BYTE_ORDER __DARWIN_BYTE_ORDER
#ifndef __FreeBSD__
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
#include <sys/_endian.h>
#endif /* !__FreeBSD__ */
#endif /* __FreeBSD__ || __NetBSD__ || __OpenBSD__ */
#endif /* defined(KERNEL) || (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)) */
#endif /* !_I386__ENDIAN_H_ */

View File

@ -40,9 +40,9 @@ typedef int sig_atomic_t;
#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
#ifndef __FreeBSD__
#if !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__OpenBSD__)
#include <sys/appleapiopts.h>
#endif /* __FreeBSD__ */
#endif /* !__FreeBSD__ && !__NetBSD__ && !__OpenBSD__ */
#ifdef __APPLE_API_OBSOLETE

View File

@ -67,6 +67,9 @@
#define _MACHTYPES_H_
#ifndef __ASSEMBLER__
#if defined(__NetBSD__) || defined(__OpenBSD__)
#include_next <machine/types.h> /* __cpu_simple_lock_t */
#endif /* __NetBSD__ || __OpenBSD__ */
#include <i386/_types.h>
#include <sys/cdefs.h>
/*
@ -90,9 +93,17 @@ typedef int int32_t;
typedef unsigned int u_int32_t;
#ifndef _INT64_T
#define _INT64_T
#if !defined(__NetBSD__) && !defined(__OpenBSD__)
typedef long long int64_t;
#else
typedef long int64_t;
#endif /* ! __NetBSD__ && !__OpenBSD__ */
#endif
#if !defined(__NetBSD__) && !defined(__OpenBSD__)
typedef unsigned long long u_int64_t;
#else
typedef unsigned long u_int64_t;
#endif /* ! __NetBSD__ && !__OpenBSD__ */
#if __LP64__
typedef int64_t register_t;

View File

@ -72,7 +72,11 @@
* vm_inherit_t inheritance codes.
*/
#if defined(__NetBSD__) || defined(__OpenBSD__)
typedef int vm_inherit_t; /* might want to change this */
#else
typedef unsigned int vm_inherit_t; /* might want to change this */
#endif /* __NetBSD__ || __OpenBSD__ */
/*
* Enumeration of valid values for vm_inherit_t.

View File

@ -88,6 +88,7 @@ typedef int vm_prot_t;
* The default protection for newly-created virtual memory
*/
#undef VM_PROT_DEFAULT
#define VM_PROT_DEFAULT (VM_PROT_READ|VM_PROT_WRITE)
/*

View File

@ -25,7 +25,7 @@
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
#ifdef __FreeBSD__
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
#include_next <machine/_limits.h>
#else
#ifndef _BSD_MACHINE__LIMITS_H_
@ -42,4 +42,4 @@
#endif
#endif /* _BSD_MACHINE__LIMITS_H_ */
#endif /* __FreeBSD__ */
#endif /* __FreeBSD__ || __NetBSD__ || __OpenBSD__ */

View File

@ -25,7 +25,7 @@
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
#ifdef __FreeBSD__
#if defined(__FreeBSD__)
#include_next <machine/_types.h>
#else
#ifndef _BSD_MACHINE__TYPES_H_

View File

@ -28,7 +28,7 @@
/*
* Copyright 1995 NeXT Computer, Inc. All rights reserved.
*/
#ifdef __FreeBSD__
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
#include_next <machine/endian.h>
#else
#ifndef _BSD_MACHINE_ENDIAN_H_
@ -45,4 +45,4 @@
#endif
#endif /* _BSD_MACHINE_ENDIAN_H_ */
#endif /* __FreeBSD__ */
#endif /* __FreeBSD__ || __NetBSD__ || __OpenBSD__ */

View File

@ -14,7 +14,7 @@
#include <sys/time.h>
#include <assert.h>
#ifdef __FreeBSD__
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
#include <sys/sysctl.h>
#endif
@ -27,6 +27,8 @@ void __assert_rtn(const char *func, const char *file, int line, const char *msg)
{
#ifdef __FreeBSD__
__assert(msg, file, line, func);
#elif defined(__NetBSD__) || defined(__OpenBSD__)
__assert(msg, line, file);
#else
__assert(msg, file, line);
#endif /* __FreeBSD__ */

View File

@ -37,9 +37,9 @@
#include <errno.h>
#include <limits.h>
#include <unistd.h>
#ifndef __FreeBSD__
#if !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__OpenBSD__)
#include <execinfo.h>
#endif /* __FreeBSD__ */
#endif /* !__FreeBSD__ && !__NetBSD__ && !__OpenBSD__ */
#include <mach/mach_time.h>
#include <mach/vm_statistics.h>
#include <mach/mach_init.h>
@ -756,7 +756,7 @@ int main(int argc, const char* argv[])
// implement assert() function to print out a backtrace before aborting
void __assert_rtn(const char* func, const char* file, int line, const char* failedexpr)
{
#ifndef __FreeBSD__
#if !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__OpenBSD__)
Snapshot *snapshot = Snapshot::globalSnapshot;
snapshot->setSnapshotMode(Snapshot::SNAPSHOT_DEBUG);
@ -782,7 +782,7 @@ void __assert_rtn(const char* func, const char* file, int line, const char* fail
snapshot->recordAssertionMessage("%d %p %s + %ld\n", i, callStack[i], symboName, offset);
}
fprintf(stderr, "A linker snapshot was created at:\n\t%s\n", snapshot->rootDir());
#endif /* __FreeBSD__ */
#endif /* !__FreeBSD__ && !__NetBSD__ && !__OpenBSD__ */
fprintf(stderr, "ld: Assertion failed: (%s), function %s, file %s, line %d.\n", failedexpr, func, file, line);
exit(1);
}

View File

@ -32,6 +32,7 @@
#include <fts.h>
#endif
#include <sys/errno.h>
#include <errno.h>
#include "stuff/bool.h"
#include "stuff/SymLoc.h"
#include "stuff/ofile.h"

View File

@ -3,7 +3,7 @@
set -ex
DIR=`pwd`
PACKAGETMP=`mktemp -d`
PACKAGETMP=`mktemp -d /tmp/XXXXXXXX`
REVHASH=`git rev-parse --short HEAD`
CCTOOLSVER=`cat README.md | grep "Current Version: " | awk '{print $3}'`
@ -23,7 +23,7 @@ rm -f package.sh
rm -f .gitignore
popd &>/dev/null
XZ_OPT=-9 tar cJf $DIR/$PACKAGE.tar.xz *
tar -cf - * | xz -9 -c - > $DIR/$PACKAGE.tar.xz
popd &>/dev/null

View File

@ -26,6 +26,7 @@ try "-3.2"
try "-3.3"
try "-3.4"
try "-3.5"
try "-devel"
try "32"
try "33"