Let's systematically use RTL_NOW|RLTD_NODELETE as flags passed to dlopen(), across our codebase. Various distros build with "-z now" anyway, hence it's weird to specify RTLD_LAZY trying to override that (which it doesn't). Hence, let's follow suit, and just do what everybody else does. Also set RTLD_NODELETE, which is apparently what distros will probably end up implying sooner or later anyway. Given that for pretty much all our dlopen() calls we never call dlclose() anyway, let's just set this everywhere too, to make things systematic. This way, the flags we use by default match what distros such as fedora do, there are no surprises, and read-only relocations can be a thing. Fixes: #34537
20 lines
434 B
C
20 lines
434 B
C
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
|
|
|
#include <dlfcn.h>
|
|
#include <stdlib.h>
|
|
|
|
#include "macro.h"
|
|
|
|
int main(int argc, char **argv) {
|
|
void *handles[argc - 1];
|
|
int i;
|
|
|
|
for (i = 0; i < argc - 1; i++)
|
|
assert_se(handles[i] = dlopen(argv[i + 1], RTLD_NOW|RTLD_NODELETE));
|
|
|
|
for (i--; i >= 0; i--)
|
|
assert_se(dlclose(handles[i]) == 0);
|
|
|
|
return EXIT_SUCCESS;
|
|
}
|