brintos

brintos / llvm-project-archived public Read only

0
0
Text · 983 B · 89065fd Raw
28 lines · cpp
1//===-- Implementation file of __libc_init_array --------------------------===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//8 9#include "startup/baremetal/init.h"10 11#include "src/__support/macros/config.h"12#include <stddef.h>13 14namespace LIBC_NAMESPACE_DECL {15 16using InitCallback = void(void);17 18extern "C" void __libc_init_array(void) {19  size_t preinit_array_size = __preinit_array_end - __preinit_array_start;20  for (size_t i = 0; i < preinit_array_size; ++i)21    reinterpret_cast<InitCallback *>(__preinit_array_start[i])();22  size_t init_array_size = __init_array_end - __init_array_start;23  for (size_t i = 0; i < init_array_size; ++i)24    reinterpret_cast<InitCallback *>(__init_array_start[i])();25}26 27} // namespace LIBC_NAMESPACE_DECL28