Files
TheRock/debug-tools/rocgdb/source/ld/testsuite/ld-shared/sh1.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

151 lines
2.5 KiB
C

/* This is part of the shared library ld test. This file becomes part
of a shared library. */
/* This variable is supplied by the main program. */
extern int mainvar;
/* This variable is defined in the shared library, and overridden by
the main program. */
#ifndef XCOFF_TEST
int overriddenvar = -1;
#endif
/* This variable is defined in the shared library. */
int shlibvar1 = 3;
/* This variable is defined by another object in the shared library. */
extern int shlibvar2;
/* These functions return the values of the above variables as seen in
the shared library. */
int
shlib_mainvar ()
{
return mainvar;
}
#ifndef XCOFF_TEST
int
shlib_overriddenvar ()
{
return overriddenvar;
}
#endif
int
shlib_shlibvar1 ()
{
return shlibvar1;
}
int
shlib_shlibvar2 ()
{
return shlibvar2;
}
/* This function calls a function defined by another object in the
shared library. */
extern int shlib_shlibcalled ();
int
shlib_shlibcall ()
{
return shlib_shlibcalled ();
}
#ifndef XCOFF_TEST
/* This function calls a function defined in this object in the shared
library. The main program will override the called function. */
extern int shlib_overriddencall2 ();
int
shlib_shlibcall2 ()
{
return shlib_overriddencall2 ();
}
#endif
/* This function calls a function defined by the main program. */
extern int main_called ();
int
shlib_maincall ()
{
return main_called ();
}
/* This function is passed a function pointer to shlib_mainvar. It
confirms that the pointer compares equally. */
int
shlib_checkfunptr1 (p)
int (*p) ();
{
return p == shlib_shlibvar1;
}
/* This function is passed a function pointer to main_called. It
confirms that the pointer compares equally. */
int
shlib_checkfunptr2 (p)
int (*p) ();
{
return p == main_called;
}
/* This function returns a pointer to shlib_mainvar. */
int
(*shlib_getfunptr1 ()) ()
{
return shlib_shlibvar1;
}
/* This function returns a pointer to main_called. */
int
(*shlib_getfunptr2 ()) ()
{
return main_called;
}
/* This function makes sure that constant data and local functions
work. */
#ifndef __STDC__
#define const
#endif
static int i = 6;
static const char *str = "Hello, world\n";
int
shlib_check ()
{
const char *s1, *s2;
if (i != 6)
return 0;
/* To isolate the test, don't rely on any external functions, such
as strcmp. */
s1 = "Hello, world\n";
s2 = str;
while (*s1 != '\0')
if (*s1++ != *s2++)
return 0;
if (*s2 != '\0')
return 0;
if (shlib_shlibvar1 () != 3)
return 0;
return 1;
}