Created
March 10, 2024 21:23
-
-
Save chenrui333/9d50b548115ead84522b5205edb7fec9 to your computer and use it in GitHub Desktop.
libxkbcommon-1.6.0-build-patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/test/xvfb-wrapper.c b/test/xvfb-wrapper.c | |
index 38d159b..2f19e24 100644 | |
--- a/test/xvfb-wrapper.c | |
+++ b/test/xvfb-wrapper.c | |
@@ -133,25 +133,25 @@ err_display_fd: | |
return ret; | |
} | |
-/* All X11_TEST functions are in the test_functions_section ELF section. | |
+/* All X11_TEST functions are in the test_func ELF section. | |
* __start and __stop point to the start and end of that section. See the | |
* __attribute__(section) documentation. | |
*/ | |
-extern const struct test_function __start_test_functions_section, __stop_test_functions_section; | |
+extern const struct test_function __start_test_func, __stop_test_func; | |
int | |
x11_tests_run() | |
{ | |
size_t count = 1; /* For NULL-terminated entry */ | |
- for (const struct test_function *t = &__start_test_functions_section; | |
- t < &__stop_test_functions_section; | |
+ for (const struct test_function *t = &__start_test_func; | |
+ t < &__stop_test_func; | |
t++) | |
count++; | |
int rc; | |
- for (const struct test_function *t = &__start_test_functions_section; | |
- t < &__stop_test_functions_section; | |
+ for (const struct test_function *t = &__start_test_func; | |
+ t < &__stop_test_func; | |
t++) { | |
fprintf(stderr, "Running test: %s from %s\n", t->name, t->file); | |
rc = xvfb_wrapper(t->func); | |
diff --git a/test/xvfb-wrapper.h b/test/xvfb-wrapper.h | |
index 222fa3e..bd75e09 100644 | |
--- a/test/xvfb-wrapper.h | |
+++ b/test/xvfb-wrapper.h | |
@@ -28,11 +28,17 @@ struct test_function { | |
* loop over in x11_tests_run() to extract the tests. This removes the | |
* need of manually adding the tests to a suite or listing them somewhere. | |
*/ | |
+ | |
+#if defined(__APPLE__) && defined(__MACH__) | |
+#define FORCE_USED_SECTION __attribute__((used)) __attribute__((section("__TEXT,test_func"))) | |
+#else | |
+#define FORCE_USED_SECTION __attribute__((used)) __attribute__((section("test_func"))) | |
+#endif | |
+ | |
#define X11_TEST(_func) \ | |
static int _func(char* display); \ | |
static const struct test_function _test_##_func \ | |
-__attribute__((used)) \ | |
-__attribute__((section("test_functions_section"))) = { \ | |
+FORCE_USED_SECTION = { \ | |
.name = #_func, \ | |
.func = _func, \ | |
.file = __FILE__, \ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment