aboutsummaryrefslogtreecommitdiff
path: root/absl/debugging/internal/stack_consumption.h
diff options
context:
space:
mode:
authorYuqian Yang <crupest@crupest.life>2025-02-08 21:29:31 +0800
committerYuqian Yang <crupest@crupest.life>2025-02-09 20:48:22 +0800
commit75c0fb3644a43da6299660799d6c7ebbbe6fc4b7 (patch)
tree8aa14cd42d9b8d2a028836918e588c394bbc400a /absl/debugging/internal/stack_consumption.h
parent87ca79e3186203c8277d9ebc6292f0054cfa1c2f (diff)
downloadabseil-hurd.tar.gz
abseil-hurd.tar.bz2
abseil-hurd.zip
Port abseil to GNU/Hurd.hurd
abseil has failed to build on GNU/Hurd for a long time. Now let's make it work! :) Note that `__GNU__` is the macro for detecting GNU/Hurd. And `__MACH__` is also defined there besides on Apple platform. They are both "mach" but with different implementation and platform details. Here are the works, * Mark platform features (not) supported by GNU/Hurd. * Supports `mmap` and `write`. * Not supports `vdso`. It's specific to Linux. * Not supports `ELF_SYMBOLIZE` for now. GNU/Hurd uses ELF as the binary format. But symbolizing in abseil relies on reading object file path from `/proc/self/task/<pid>/maps` (Linux specific) or `/proc/self/maps`. GNU/Hurd does have the latter. However, due to its micro-kernel design, it's currently unable to get the file path info there. * Disable stack consumption measurement. The problem behind it is that GNU/Hurd uses a very different way to implement signal handling. Due to compiler behavior, it is impossible to get a stable, valid and reliable statictic data. In my test environment, it's 96 bytes (< 100) for current codes. * GNU/Hurd uses different errno and messages than Linux. So related things are adjusted accordingly. * Fix a misuse of `__MACH__`, which should actually be `__APPLE__`. * Fix a missing including of `signal.h` for using `SIGABRT`. Otherwise compilation will fail with undefined symbol error on GNU/Hurd. Signed-off-by: Yuqian Yang <crupest@crupest.life>
Diffstat (limited to 'absl/debugging/internal/stack_consumption.h')
-rw-r--r--absl/debugging/internal/stack_consumption.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/absl/debugging/internal/stack_consumption.h b/absl/debugging/internal/stack_consumption.h
index f41b64c3..88f296af 100644
--- a/absl/debugging/internal/stack_consumption.h
+++ b/absl/debugging/internal/stack_consumption.h
@@ -24,8 +24,8 @@
// Use this feature test macro to detect its availability.
#ifdef ABSL_INTERNAL_HAVE_DEBUGGING_STACK_CONSUMPTION
#error ABSL_INTERNAL_HAVE_DEBUGGING_STACK_CONSUMPTION cannot be set directly
-#elif !defined(__APPLE__) && !defined(_WIN32) && \
- (defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || \
+#elif !defined(__APPLE__) && !defined(_WIN32) && !defined(__GNU__) && \
+ (defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || \
defined(__aarch64__) || defined(__riscv))
#define ABSL_INTERNAL_HAVE_DEBUGGING_STACK_CONSUMPTION 1