mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2026-02-25 01:41:11 -05:00
Merge branch 'darwin-test' into 'main'
tests: build on non-ELF platforms See merge request wayland/wayland!304
This commit is contained in:
commit
ae16717484
3 changed files with 22 additions and 2 deletions
|
|
@ -63,6 +63,7 @@ static int fall_back;
|
|||
* __interceptor_ and check at run time if they linked to anything or not.
|
||||
*/
|
||||
|
||||
#ifdef __ELF__
|
||||
#define DECL(ret_type, func, ...) \
|
||||
ret_type __interceptor_ ## func(__VA_ARGS__) __attribute__((weak)); \
|
||||
static ret_type (*real_ ## func)(__VA_ARGS__); \
|
||||
|
|
@ -71,6 +72,14 @@ static int fall_back;
|
|||
#define REAL(func) (__interceptor_ ## func) ? \
|
||||
__interceptor_ ## func : \
|
||||
(__typeof__(&__interceptor_ ## func))dlsym(RTLD_NEXT, #func)
|
||||
#else
|
||||
#define DECL(ret_type, func, ...) \
|
||||
static ret_type (*real_ ## func)(__VA_ARGS__); \
|
||||
static int wrapped_calls_ ## func;
|
||||
|
||||
#define REAL(func) \
|
||||
(__typeof__(real_ ## func))dlsym(RTLD_NEXT, #func)
|
||||
#endif
|
||||
|
||||
DECL(int, socket, int, int, int);
|
||||
DECL(int, fcntl, int, int, ...);
|
||||
|
|
|
|||
|
|
@ -63,7 +63,12 @@ static int timeouts_enabled = 1;
|
|||
/* set to one if the output goes to the terminal */
|
||||
static int is_atty = 0;
|
||||
|
||||
#ifdef __APPLE__
|
||||
extern const struct test __start_test_section __asm("section$start$__RODATA$test_section");
|
||||
extern const struct test __stop_test_section __asm("section$end$__RODATA$test_section");
|
||||
#else
|
||||
extern const struct test __start_test_section, __stop_test_section;
|
||||
#endif
|
||||
|
||||
static const struct test *
|
||||
find_test(const char *name)
|
||||
|
|
|
|||
|
|
@ -37,11 +37,17 @@ struct test {
|
|||
int must_fail;
|
||||
} __attribute__ ((aligned (16)));
|
||||
|
||||
#ifdef __APPLE__
|
||||
#define TEST_SECTION "__RODATA,test_section"
|
||||
#else
|
||||
#define TEST_SECTION "test_section"
|
||||
#endif
|
||||
|
||||
#define TEST(name) \
|
||||
static void name(void); \
|
||||
\
|
||||
const struct test test##name \
|
||||
__attribute__ ((used, section ("test_section"))) = { \
|
||||
__attribute__ ((used, section (TEST_SECTION))) = { \
|
||||
#name, name, 0 \
|
||||
}; \
|
||||
\
|
||||
|
|
@ -51,7 +57,7 @@ struct test {
|
|||
static void name(void); \
|
||||
\
|
||||
const struct test test##name \
|
||||
__attribute__ ((used, section ("test_section"))) = { \
|
||||
__attribute__ ((used, section (TEST_SECTION))) = { \
|
||||
#name, name, 1 \
|
||||
}; \
|
||||
\
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue