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
178 lines
5.6 KiB
C
178 lines
5.6 KiB
C
//===-- crtbegin.c - Start of constructors and destructors ----------------===//
|
|
//
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include <stddef.h>
|
|
|
|
#ifndef __has_feature
|
|
# define __has_feature(x) 0
|
|
#endif
|
|
|
|
#if __has_feature(ptrauth_init_fini)
|
|
#include <ptrauth.h>
|
|
#endif
|
|
|
|
__attribute__((visibility("hidden"))) void *__dso_handle = &__dso_handle;
|
|
|
|
#ifdef EH_USE_FRAME_REGISTRY
|
|
__extension__ static void *const __EH_FRAME_LIST__[]
|
|
__attribute__((section(".eh_frame"), aligned(sizeof(void *)))) = {};
|
|
|
|
extern void __register_frame_info(const void *, void *) __attribute__((weak));
|
|
extern void *__deregister_frame_info(const void *) __attribute__((weak));
|
|
#endif
|
|
|
|
#ifndef CRT_HAS_INITFINI_ARRAY
|
|
typedef void (*fp)(void);
|
|
|
|
static fp __CTOR_LIST__[]
|
|
__attribute__((section(".ctors"), aligned(sizeof(fp)))) = {(fp)-1};
|
|
extern fp __CTOR_LIST_END__[];
|
|
#endif
|
|
|
|
extern void __cxa_finalize(void *) __attribute__((weak));
|
|
|
|
static void __attribute__((used)) __do_init(void) {
|
|
static _Bool __initialized;
|
|
if (__builtin_expect(__initialized, 0))
|
|
return;
|
|
__initialized = 1;
|
|
|
|
#ifdef EH_USE_FRAME_REGISTRY
|
|
static struct { void *p[8]; } __object;
|
|
if (__register_frame_info)
|
|
__register_frame_info(__EH_FRAME_LIST__, &__object);
|
|
#endif
|
|
#ifndef CRT_HAS_INITFINI_ARRAY
|
|
const size_t n = __CTOR_LIST_END__ - __CTOR_LIST__ - 1;
|
|
for (size_t i = n; i >= 1; i--) __CTOR_LIST__[i]();
|
|
#endif
|
|
}
|
|
|
|
#ifdef CRT_HAS_INITFINI_ARRAY
|
|
# if __has_feature(ptrauth_init_fini)
|
|
__attribute__((section(".init_array"),
|
|
used)) static void *__ptrauth_init_fini_pointer __init =
|
|
__do_init;
|
|
# elif __has_feature(ptrauth_calls)
|
|
# ifdef __aarch64__
|
|
// If ptrauth_init_fini feature is not present, compiler emits raw unsigned
|
|
// pointers in .init_array. Use inline assembly to avoid implicit signing of
|
|
// __do_init function pointer with ptrauth_calls enabled.
|
|
__asm__(".pushsection .init_array,\"aw\",@init_array\n\t"
|
|
".xword __do_init\n\t"
|
|
".popsection");
|
|
# else
|
|
# error "ptrauth_calls is only supported for AArch64"
|
|
# endif
|
|
# else
|
|
__attribute__((section(".init_array"),
|
|
used)) static void (*__init)(void) = __do_init;
|
|
# endif
|
|
#elif defined(__i386__) || defined(__x86_64__)
|
|
__asm__(".pushsection .init,\"ax\",@progbits\n\t"
|
|
"call __do_init\n\t"
|
|
".popsection");
|
|
#elif defined(__riscv)
|
|
__asm__(".pushsection .init,\"ax\",%progbits\n\t"
|
|
"call __do_init\n\t"
|
|
".popsection");
|
|
#elif defined(__arm__) || defined(__aarch64__)
|
|
__asm__(".pushsection .init,\"ax\",%progbits\n\t"
|
|
"bl __do_init\n\t"
|
|
".popsection");
|
|
#elif defined(__mips__)
|
|
__asm__(".pushsection .init,\"ax\",@progbits\n\t"
|
|
"jal __do_init\n\t"
|
|
".popsection");
|
|
#elif defined(__powerpc__) || defined(__powerpc64__)
|
|
__asm__(".pushsection .init,\"ax\",@progbits\n\t"
|
|
"bl __do_init\n\t"
|
|
"nop\n\t"
|
|
".popsection");
|
|
#elif defined(__sparc__)
|
|
__asm__(".pushsection .init,\"ax\",@progbits\n\t"
|
|
"call __do_init\n\t"
|
|
".popsection");
|
|
#else
|
|
#error "crtbegin without .init_fini array unimplemented for this architecture"
|
|
#endif // CRT_HAS_INITFINI_ARRAY
|
|
|
|
#ifndef CRT_HAS_INITFINI_ARRAY
|
|
static fp __DTOR_LIST__[]
|
|
__attribute__((section(".dtors"), aligned(sizeof(fp)))) = {(fp)-1};
|
|
extern fp __DTOR_LIST_END__[];
|
|
#endif
|
|
|
|
static void __attribute__((used)) __do_fini(void) {
|
|
static _Bool __finalized;
|
|
if (__builtin_expect(__finalized, 0))
|
|
return;
|
|
__finalized = 1;
|
|
|
|
if (__cxa_finalize)
|
|
__cxa_finalize(__dso_handle);
|
|
|
|
#ifndef CRT_HAS_INITFINI_ARRAY
|
|
const size_t n = __DTOR_LIST_END__ - __DTOR_LIST__ - 1;
|
|
for (size_t i = 1; i <= n; i++) __DTOR_LIST__[i]();
|
|
#endif
|
|
#ifdef EH_USE_FRAME_REGISTRY
|
|
if (__deregister_frame_info)
|
|
__deregister_frame_info(__EH_FRAME_LIST__);
|
|
#endif
|
|
}
|
|
|
|
#ifdef CRT_HAS_INITFINI_ARRAY
|
|
# if __has_feature(ptrauth_init_fini)
|
|
__attribute__((section(".fini_array"),
|
|
used)) static void *__ptrauth_init_fini_pointer __fini =
|
|
__do_fini;
|
|
# elif __has_feature(ptrauth_calls)
|
|
# ifdef __aarch64__
|
|
// If ptrauth_init_fini feature is not present, compiler emits raw unsigned
|
|
// pointers in .fini_array. Use inline assembly to avoid implicit signing of
|
|
// __do_fini function pointer with ptrauth_calls enabled.
|
|
__asm__(".pushsection .fini_array,\"aw\",@fini_array\n\t"
|
|
".xword __do_fini\n\t"
|
|
".popsection");
|
|
# else
|
|
# error "ptrauth_calls is only supported for AArch64"
|
|
# endif
|
|
# else
|
|
__attribute__((section(".fini_array"),
|
|
used)) static void (*__fini)(void) = __do_fini;
|
|
# endif
|
|
#elif defined(__i386__) || defined(__x86_64__)
|
|
__asm__(".pushsection .fini,\"ax\",@progbits\n\t"
|
|
"call __do_fini\n\t"
|
|
".popsection");
|
|
#elif defined(__arm__) || defined(__aarch64__)
|
|
__asm__(".pushsection .fini,\"ax\",%progbits\n\t"
|
|
"bl __do_fini\n\t"
|
|
".popsection");
|
|
#elif defined(__mips__)
|
|
__asm__(".pushsection .fini,\"ax\",@progbits\n\t"
|
|
"jal __do_fini\n\t"
|
|
".popsection");
|
|
#elif defined(__powerpc__) || defined(__powerpc64__)
|
|
__asm__(".pushsection .fini,\"ax\",@progbits\n\t"
|
|
"bl __do_fini\n\t"
|
|
"nop\n\t"
|
|
".popsection");
|
|
#elif defined(__riscv)
|
|
__asm__(".pushsection .fini,\"ax\",@progbits\n\t"
|
|
"call __do_fini\n\t"
|
|
".popsection");
|
|
#elif defined(__sparc__)
|
|
__asm__(".pushsection .fini,\"ax\",@progbits\n\t"
|
|
"call __do_fini\n\t"
|
|
".popsection");
|
|
#else
|
|
#error "crtbegin without .init_fini array unimplemented for this architecture"
|
|
#endif // CRT_HAS_INIT_FINI_ARRAY
|