aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/os
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/os')
-rw-r--r--xorg-server/os/Makefile.am17
-rw-r--r--xorg-server/os/log.c9
-rw-r--r--xorg-server/os/utils.c2
3 files changed, 23 insertions, 5 deletions
diff --git a/xorg-server/os/Makefile.am b/xorg-server/os/Makefile.am
index 66a4a0f75..3e4f2c591 100644
--- a/xorg-server/os/Makefile.am
+++ b/xorg-server/os/Makefile.am
@@ -1,11 +1,19 @@
-noinst_LTLIBRARIES = libos.la
+noinst_LTLIBRARIES = libos.la liblog.la
AM_CFLAGS = $(DIX_CFLAGS) $(SHA1_CFLAGS)
SECURERPC_SRCS = rpcauth.c
XDMCP_SRCS = xdmcp.c
STRLCAT_SRCS = strlcat.c strlcpy.c
-XORG_SRCS = log.c
+
+# Build a convenience library liblog.la that will be added into
+# libos.la. The split is done so that log.c can be built with
+# different compiler options.
+liblog_la_SOURCES = log.c
+# Add flags needed for proper backtraces of functions marked with GCC
+# __attribute__((noreturn)). Currently those flags are needed for
+# FatalError and AbortServer in log.c.
+liblog_la_CFLAGS = $(AM_CFLAGS) $(ARM_BACKTRACE_CFLAGS)
libos_la_SOURCES = \
WaitFor.c \
@@ -24,9 +32,8 @@ libos_la_SOURCES = \
xdmauth.c \
xsha1.c \
xstrans.c \
- xprintf.c \
- $(XORG_SRCS)
-libos_la_LIBADD = @SHA1_LIBS@ $(DLOPEN_LIBS)
+ xprintf.c
+libos_la_LIBADD = @SHA1_LIBS@ $(DLOPEN_LIBS) liblog.la
if SECURE_RPC
libos_la_SOURCES += $(SECURERPC_SRCS)
diff --git a/xorg-server/os/log.c b/xorg-server/os/log.c
index 6e9b183b8..68d9ca80e 100644
--- a/xorg-server/os/log.c
+++ b/xorg-server/os/log.c
@@ -123,6 +123,12 @@ static char *saveBuffer = NULL;
static int bufferSize = 0, bufferUnused = 0, bufferPos = 0;
static Bool needBuffer = TRUE;
+#ifdef __APPLE__
+static char __crashreporter_info_buff__[4096] = {0};
+static const char *__crashreporter_info__ = &__crashreporter_info_buff__[0];
+asm (".desc __crashreporter_info__, 0x10");
+#endif
+
/* Prefix strings for log messages. */
#ifndef X_UNKNOWN_STRING
#define X_UNKNOWN_STRING "(\?\?)"
@@ -534,6 +540,9 @@ FatalError(const char *f, ...)
ErrorF("\nFatal server error:\n");
va_start(args, f);
+#ifdef __APPLE__
+ (void)vsnprintf(__crashreporter_info_buff__, sizeof(__crashreporter_info_buff__), f, args);
+#endif
VErrorF(f, args);
va_end(args);
ErrorF("\n");
diff --git a/xorg-server/os/utils.c b/xorg-server/os/utils.c
index 97a920990..c413fb272 100644
--- a/xorg-server/os/utils.c
+++ b/xorg-server/os/utils.c
@@ -1328,7 +1328,9 @@ OsReleaseSignals (void)
void
OsAbort (void)
{
+#ifndef __APPLE__
OsBlockSignals();
+#endif
abort();
}