Module: Mesa
Branch: main
Commit: 46091832d815cd16551157779426d0954fb999e0
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=46091832d815cd16551157779426d0954fb999e0

Author: David Heidelberg <[email protected]>
Date:   Fri Feb 24 01:00:19 2023 +0100

util/process_test: make the error variable static

Make the `error` variable static to prevent a clash with
the glibc error() function when LTO is used.

Fixes the LTO build.
Otherwise, it'll fail in the linking phase with a conflict:
```
[411/2321] Linking target src/util/process_test
FAILED: src/util/process_test
c++  -o src/util/process_test src/util/process_test.p/tests_process_test.c.o 
-flto -Wl,--as-needed -Wl,--no-undefined -Wl,--fatal-warnings -Wl,--start-group 
src/util/libmesa_util.a src/util/format/libmesa_format.a 
src/util/libmesa_util_sse41.a src/c11/impl/libmesa_util_c11.a 
subprojects/perfetto/libperfetto.a /usr/lib/x86_64-linux-gnu/libz.so -pthread 
-lm -ldl /usr/lib/x86_64-linux-gnu/libunwind.so -Wl,--end-group
mold: error: symbol type mismatch: error
>>> defined in /tmp/process_test.SLc9I6.ltrans0.ltrans.o as STT_OBJECT
>>> defined in /lib/x86_64-linux-gnu/libc.so.6 as STT_FUNC
```

Reviewed-by: Yonggang Luo <[email protected]>
Signed-off-by: David Heidelberg <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21511>

---

 src/util/tests/process_test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/util/tests/process_test.c b/src/util/tests/process_test.c
index 4a7c7cbd4e3..dd4e7bf8c7a 100644
--- a/src/util/tests/process_test.c
+++ b/src/util/tests/process_test.c
@@ -36,7 +36,7 @@
 #define PATH_MAX MAX_PATH
 #endif
 
-bool error = false;
+static bool error = false;
 
 static void
 expect_equal_str(const char *expected, const char *actual, const char *test)

Reply via email to