From 75c0fb3644a43da6299660799d6c7ebbbe6fc4b7 Mon Sep 17 00:00:00 2001 From: Yuqian Yang Date: Sat, 8 Feb 2025 21:29:31 +0800 Subject: Port abseil to GNU/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//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 --- absl/log/log_modifier_methods_test.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'absl/log/log_modifier_methods_test.cc') diff --git a/absl/log/log_modifier_methods_test.cc b/absl/log/log_modifier_methods_test.cc index 4ccde404..9b6a7ec8 100644 --- a/absl/log/log_modifier_methods_test.cc +++ b/absl/log/log_modifier_methods_test.cc @@ -180,7 +180,8 @@ TEST(TailCallsModifiesTest, WithPerror) { test_sink, Send(AllOf(TextMessage(AnyOf(Eq("hello world: Bad file number [9]"), Eq("hello world: Bad file descriptor [9]"), - Eq("hello world: Bad file descriptor [8]"))), + Eq("hello world: Bad file descriptor [8]"), + Eq("hello world: Bad file descriptor [1073741833]"))), ENCODED_MESSAGE(HasValues(ElementsAre( EqualsProto(R"pb(literal: "hello world")pb"), EqualsProto(R"pb(literal: ": ")pb"), @@ -188,7 +189,8 @@ TEST(TailCallsModifiesTest, WithPerror) { EqualsProto(R"pb(str: "Bad file descriptor")pb")), EqualsProto(R"pb(literal: " [")pb"), AnyOf(EqualsProto(R"pb(str: "8")pb"), - EqualsProto(R"pb(str: "9")pb")), + EqualsProto(R"pb(str: "9")pb"), + EqualsProto(R"pb(str: "1073741833")pb")), EqualsProto(R"pb(literal: "]")pb"))))))); test_sink.StartCapturingLogs(); -- cgit v1.2.3