X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=tests%2Fregression%2Fust%2Fust-dl%2Fprog.c;h=e4288928fad5235245086f8f47087bcb4eb2ab3c;hb=c9e313bc594f40a86eed237dce222c0fc99c957f;hp=e8e4b2641a1c6a0437c0e94ca6933eda741e30fc;hpb=d8ed06afceb2d0517633814f7f2a04f69ac71da6;p=lttng-tools.git diff --git a/tests/regression/ust/ust-dl/prog.c b/tests/regression/ust/ust-dl/prog.c index e8e4b2641..e4288928f 100644 --- a/tests/regression/ust/ust-dl/prog.c +++ b/tests/regression/ust/ust-dl/prog.c @@ -1,19 +1,32 @@ +/* + * Copyright (C) 2016 Antoine Busque + * + * SPDX-License-Identifier: GPL-2.0-only + * + */ + /* _GNU_SOURCE is defined by config.h */ #include #include -#include #include #include +#include + /* * libfoo has a direct dependency on libbar. * libbar has a direct dependency on libzzz. * This test is therefore a mix of dlopen/dlclose and dlmopen/dlclose of * libfoo, and of its direct dependencies. */ -int main(int argc, char **argv) +int main(void) { - void *h0, *h1, *h2, *h3, *h4; + void *h0, *h2, *h3, *h4; + +#ifdef HAVE_DLMOPEN + void *h1; +#endif + char *error; int (*foo)(void); @@ -21,10 +34,14 @@ int main(int argc, char **argv) if (!h0) { goto get_error; } + +#ifdef HAVE_DLMOPEN h1 = dlmopen(LM_ID_BASE, "libfoo.so", RTLD_LAZY); if (!h1) { goto get_error; } +#endif + h2 = dlopen("libzzz.so", RTLD_LAZY); if (!h2) { goto get_error; @@ -38,7 +55,7 @@ int main(int argc, char **argv) goto get_error; } - foo = dlsym(h1, "foo"); + foo = dlsym(h3, "foo"); error = dlerror(); if (error != NULL) { goto error; @@ -49,9 +66,13 @@ int main(int argc, char **argv) if (dlclose(h0)) { goto get_error; } + +#ifdef HAVE_DLMOPEN if (dlclose(h1)) { goto get_error; } +#endif + if (dlclose(h2)) { goto get_error; }