Page MenuHomeFreeBSD

D31057.id91810.diff
No OneTemporary

D31057.id91810.diff

Index: lib/clang/include/llvm/Config/config.h
===================================================================
--- lib/clang/include/llvm/Config/config.h
+++ lib/clang/include/llvm/Config/config.h
@@ -125,28 +125,42 @@
#define HAVE_PTHREAD_SETNAME_NP 1
/* Define to 1 if you have the <link.h> header file. */
+#if __has_include(<link.h>)
#define HAVE_LINK_H 1
+#else
+#define HAVE_LINK_H 0
+#endif
/* Define to 1 if you have the `lseek64' function. */
/* #undef HAVE_LSEEK64 */
/* Define to 1 if you have the <mach/mach.h> header file. */
-/* #undef HAVE_MACH_MACH_H */
+#if __has_include(<mach/mach.h>)
+#define HAVE_MACH_MACH_H 1
+#endif
/* Define to 1 if you have the `mallctl' function. */
+#ifdef __FreeBSD__
#define HAVE_MALLCTL 1
+#endif
/* Define to 1 if you have the `mallinfo' function. */
/* #undef HAVE_MALLINFO */
/* Define to 1 if you have the <malloc/malloc.h> header file. */
-/* #undef HAVE_MALLOC_MALLOC_H */
+#if __has_include(<malloc/malloc.h>)
+#define HAVE_MALLOC_MALLOC_H 1
+#endif
/* Define to 1 if you have the `malloc_zone_statistics' function. */
-/* #undef HAVE_MALLOC_ZONE_STATISTICS */
+#ifdef __APPLE__
+#define HAVE_MALLOC_ZONE_STATISTICS 1
+#endif
/* Define to 1 if you have the `posix_fallocate' function. */
+#ifdef __FreeBSD__
#define HAVE_POSIX_FALLOCATE 1
+#endif
/* Define to 1 if you have the `posix_spawn' function. */
#define HAVE_POSIX_SPAWN 1
Index: lib/clang/libllvmminimal/Makefile
===================================================================
--- lib/clang/libllvmminimal/Makefile
+++ lib/clang/libllvmminimal/Makefile
@@ -80,5 +80,9 @@
SRCS+= TableGen/TGParser.cpp
SRCS+= TableGen/TableGenBackend.cpp
+.ifdef BOOTSTRAPPING
+CFLAGS+=-D_WANT_REAL_HOST_SYSCTL_H
+.endif
+
.include "../llvm.build.mk"
.include <bsd.lib.mk>
Index: lib/clang/llvm.build.mk
===================================================================
--- lib/clang/llvm.build.mk
+++ lib/clang/llvm.build.mk
@@ -100,12 +100,20 @@
CFLAGS+= -ffunction-sections
CFLAGS+= -fdata-sections
+.include <bsd.linker.mk>
+.if ${LINKER_TYPE} != "mac"
LDFLAGS+= -Wl,--gc-sections
+.endif
CXXSTD?= c++14
CXXFLAGS+= -fno-exceptions
CXXFLAGS+= -fno-rtti
+.if !defined(BOOTSTRAPPING)
CXXFLAGS.clang+= -stdlib=libc++
+.endif
+.if defined(BOOTSTRAPPING) && ${.MAKE.OS} == "Linux"
+LIBADD+= dl
+.endif
.if ${MACHINE_ARCH:Mmips64}
STATIC_CFLAGS+= -mxgot
Index: lib/libc/db/db/db.c
===================================================================
--- lib/libc/db/db/db.c
+++ lib/libc/db/db/db.c
@@ -55,20 +55,26 @@
{
#define DB_FLAGS (DB_LOCK | DB_SHMEM | DB_TXN)
-#define USE_OPEN_FLAGS \
- (O_CREAT | O_EXCL | O_EXLOCK | O_NOFOLLOW | O_NONBLOCK | \
- O_RDONLY | O_RDWR | O_SHLOCK | O_SYNC | O_TRUNC | O_CLOEXEC)
+ const int use_open_flags = O_CREAT | O_EXCL | O_NOFOLLOW | O_NONBLOCK |
+ O_RDONLY | O_RDWR | O_SYNC | O_TRUNC |
+#ifdef O_EXLOCK
+ O_EXLOCK |
+#endif
+#ifdef O_SHLOCK
+ O_SHLOCK |
+#endif
+ O_CLOEXEC;
- if ((flags & ~(USE_OPEN_FLAGS | DB_FLAGS)) == 0)
+ if ((flags & ~(use_open_flags | DB_FLAGS)) == 0)
switch (type) {
case DB_BTREE:
- return (__bt_open(fname, flags & USE_OPEN_FLAGS,
+ return (__bt_open(fname, flags & use_open_flags,
mode, openinfo, flags & DB_FLAGS));
case DB_HASH:
- return (__hash_open(fname, flags & USE_OPEN_FLAGS,
+ return (__hash_open(fname, flags & use_open_flags,
mode, openinfo, flags & DB_FLAGS));
case DB_RECNO:
- return (__rec_open(fname, flags & USE_OPEN_FLAGS,
+ return (__rec_open(fname, flags & use_open_flags,
mode, openinfo, flags & DB_FLAGS));
}
errno = EINVAL;
Index: tools/build/cross-build/include/common/sys/sysctl.h
===================================================================
--- tools/build/cross-build/include/common/sys/sysctl.h
+++ tools/build/cross-build/include/common/sys/sysctl.h
@@ -37,6 +37,9 @@
*/
#pragma once
+#ifdef _WANT_REAL_HOST_SYSCTL_H
+#include_next <sys/sysctl.h>
+#else
#include <sys/types.h>
#define sysctlbyname __freebsd_sysctlbyname
@@ -44,3 +47,4 @@
int sysctl(const int *, u_int, void *, size_t *, const void *, size_t);
int sysctlbyname(const char *, void *, size_t *, const void *, size_t);
+#endif
Index: tools/build/cross-build/include/linux/fcntl.h
===================================================================
--- tools/build/cross-build/include/linux/fcntl.h
+++ tools/build/cross-build/include/linux/fcntl.h
@@ -1,7 +1,7 @@
/*-
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright 2018-2020 Alex Richardson <arichardson@FreeBSD.org>
+ * Copyright 2018-2021 Alex Richardson <arichardson@FreeBSD.org>
*
* This software was developed by SRI International and the University of
* Cambridge Computer Laboratory (Department of Computer Science and
@@ -12,6 +12,9 @@
* Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237)
* ("CTSRD"), as part of the DARPA CRASH research programme.
*
+ * This work was supported by Innovate UK project 105694, "Digital Security by
+ * Design (DSbD) Technology Platform Prototype".
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -37,29 +40,9 @@
*/
#pragma once
-
/* <bits/fcntl.h> includes <bits/stat.h> which contains a member __unused */
#include "__unused_workaround_start.h"
#include_next <fcntl.h>
#include "__unused_workaround_end.h"
-#ifdef __unused_undefd
-#undef __unused_undefd
-#define __unused __attribute__((unused))
-#endif
-
#include <sys/file.h>
-
-#ifndef O_EXLOCK
-#define O_EXLOCK (1 << 30)
-#endif
-#ifndef O_SHLOCK
-#define O_SHLOCK (1 << 31)
-#endif
-
-#undef open
-#define open(path, flags, ...) ({ \
- int __fd = (open)(path, flags, ##__VA_ARGS__); \
- if (flags & O_EXLOCK) flock(__fd, LOCK_EX); \
- if (flags & O_SHLOCK) flock(__fd, LOCK_SH); \
- __fd; })
Index: usr.bin/clang/llvm.prog.mk
===================================================================
--- usr.bin/clang/llvm.prog.mk
+++ usr.bin/clang/llvm.prog.mk
@@ -22,8 +22,12 @@
PACKAGE= clang
+.if !defined(BOOTSTRAPPING) || ${.MAKE.OS} == "FreeBSD"
LIBADD+= execinfo
LIBADD+= ncursesw
+.else
+LDADD+= -lncurses
+.endif
LIBADD+= pthread
.include <bsd.prog.mk>

File Metadata

Mime Type
text/plain
Expires
Sat, May 16, 11:24 PM (2 h, 32 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
33133660
Default Alt Text
D31057.id91810.diff (6 KB)

Event Timeline