Files
TheRock/compiler/amd-llvm/compiler-rt/test/profile/Inputs/instrprof-dlopen-dlclose-main.c
T
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

87 lines
2.2 KiB
C

#include <dlfcn.h>
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[]) {
dlerror();
void *f1_handle = dlopen("func.shared", RTLD_LAZY | RTLD_GLOBAL);
if (f1_handle == NULL) {
fprintf(stderr, "unable to open 'func.shared': %s\n", dlerror());
return EXIT_FAILURE;
}
void (*func)(void) = (void (*)(void))dlsym(f1_handle, "func");
if (func == NULL) {
fprintf(stderr, "unable to lookup symbol 'func': %s\n", dlerror());
return EXIT_FAILURE;
}
dlerror();
void *f2_handle = dlopen("func2.shared", RTLD_LAZY | RTLD_GLOBAL);
if (f2_handle == NULL) {
fprintf(stderr, "unable to open 'func2.shared': %s\n", dlerror());
return EXIT_FAILURE;
}
void (*func2)(void) = (void (*)(void))dlsym(f2_handle, "func2");
if (func2 == NULL) {
fprintf(stderr, "unable to lookup symbol 'func2': %s\n", dlerror());
return EXIT_FAILURE;
}
func2();
#ifdef USE_LIB3
void *f3_handle = dlopen("func3.shared", RTLD_LAZY | RTLD_GLOBAL);
if (f3_handle == NULL) {
fprintf(stderr, "unable to open 'func3.shared': %s\n", dlerror());
return EXIT_FAILURE;
}
void (*func3)(void) = (void (*)(void))dlsym(f3_handle, "func3");
if (func3 == NULL) {
fprintf(stderr, "unable to lookup symbol 'func3': %s\n", dlerror());
return EXIT_FAILURE;
}
func3();
#endif
dlerror();
void (*gcov_reset1)() = (void (*)())dlsym(f1_handle, "__gcov_reset");
if (gcov_reset1 == NULL) {
fprintf(stderr, "unable to find __gcov_reset in func.shared': %s\n", dlerror());
return EXIT_FAILURE;
}
dlerror();
void (*gcov_reset2)() = (void (*)())dlsym(f2_handle, "__gcov_reset");
if (gcov_reset2 == NULL) {
fprintf(stderr, "unable to find __gcov_reset in func2.shared': %s\n", dlerror());
return EXIT_FAILURE;
}
if (gcov_reset1 == gcov_reset2) {
fprintf(stderr, "Same __gcov_reset found in func.shared and func2.shared\n");
return EXIT_FAILURE;
}
dlerror();
if (dlclose(f2_handle) != 0) {
fprintf(stderr, "unable to close 'func2.shared': %s\n", dlerror());
return EXIT_FAILURE;
}
func();
int g1 = 0;
int g2 = 0;
int n = 10;
if (n % 5 == 0)
g1++;
else
g2++;
return EXIT_SUCCESS;
}