/* Specialized bits of code needed to support construction and
destruction of file-scope objects in C++ code.
- Copyright (C) 1991-2014 Free Software Foundation, Inc.
+ Copyright (C) 1991-2018 Free Software Foundation, Inc.
Contributed by Ron Guilmette (rfg@monkeys.com).
This file is part of GCC.
#endif
#if defined(TARGET_DL_ITERATE_PHDR) && \
- (defined(__DragonFly__) || defined(__FreeBSD__))
+ (defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__))
#define BSD_DL_ITERATE_PHDR_AVAILABLE
#endif
# define USE_PT_GNU_EH_FRAME
#endif
-#if defined(__LIBGCC_EH_FRAME_SECTION_NAME__) && !defined(USE_PT_GNU_EH_FRAME)
+#ifdef USE_EH_FRAME_REGISTRY_ALWAYS
+# ifndef __LIBGCC_EH_FRAME_SECTION_NAME__
+# error "Can't use explicit exception-frame-registration without __LIBGCC_EH_FRAME_SECTION_NAME__"
+# endif
+#endif
+#if defined(__LIBGCC_EH_FRAME_SECTION_NAME__) && (!defined(USE_PT_GNU_EH_FRAME) || defined(USE_EH_FRAME_REGISTRY_ALWAYS))
# define USE_EH_FRAME_REGISTRY
#endif
#if defined(__LIBGCC_EH_FRAME_SECTION_NAME__) \
TARGET_ATTRIBUTE_WEAK;
extern void __do_global_ctors_1 (void);
-/* Likewise for _Jv_RegisterClasses. */
-extern void _Jv_RegisterClasses (void *) TARGET_ATTRIBUTE_WEAK;
-
/* Likewise for transactional memory clone tables. */
extern void _ITM_registerTMCloneTable (void *, size_t) TARGET_ATTRIBUTE_WEAK;
extern void _ITM_deregisterTMCloneTable (void *) TARGET_ATTRIBUTE_WEAK;
= { };
#endif /* USE_EH_FRAME_REGISTRY */
-#ifdef __LIBGCC_JCR_SECTION_NAME__
-/* Stick a label at the beginning of the java class registration info
- so we can register them properly. */
-STATIC void *__JCR_LIST__[]
- __attribute__ ((used, section(__LIBGCC_JCR_SECTION_NAME__),
- aligned(sizeof(void*))))
- = { };
-#endif /* __LIBGCC_JCR_SECTION_NAME__ */
-
#if USE_TM_CLONE_REGISTRY
STATIC func_ptr __TMC_LIST__[]
__attribute__((used, section(".tm_clone_table"), aligned(sizeof(void*))))
void (*fn) (void *);
#ifdef HAVE_GAS_HIDDEN
- if (__TMC_END__ - __TMC_LIST__ == 0)
+ func_ptr *end = __TMC_END__;
+ // Do not optimize the comparison to false.
+ __asm ("" : "+g" (end));
+ if (__TMC_LIST__ == end)
return;
#else
if (__TMC_LIST__[0] == NULL)
size_t size;
#ifdef HAVE_GAS_HIDDEN
- size = (__TMC_END__ - __TMC_LIST__) / 2;
+ func_ptr *end = __TMC_END__;
+ // Do not optimize the comparison to false.
+ __asm ("" : "+g" (end));
+ size = (end - __TMC_LIST__) / 2;
#else
for (size = 0; __TMC_LIST__[size * 2] != NULL; size++)
continue;
extern func_ptr __DTOR_END__[] __attribute__((visibility ("hidden")));
static size_t dtor_idx;
const size_t max_idx = __DTOR_END__ - __DTOR_LIST__ - 1;
- func_ptr f;
+ func_ptr *dtor_list;
+ __asm ("" : "=g" (dtor_list) : "0" (__DTOR_LIST__));
while (dtor_idx < max_idx)
- {
- f = __DTOR_LIST__[++dtor_idx];
- f ();
- }
+ dtor_list[++dtor_idx] ();
}
#else /* !defined (FINI_ARRAY_SECTION_ASM_OP) */
{
#endif
#if defined(USE_EH_FRAME_REGISTRY) \
- || defined(__LIBGCC_JCR_SECTION_NAME__) \
|| defined(USE_TM_CLONE_REGISTRY)
/* Stick a call to __register_frame_info into the .init section. For some
reason calls with no arguments work more reliably in .init, so stick the
#endif /* CRT_GET_RFIB_DATA */
#endif /* USE_EH_FRAME_REGISTRY */
-#ifdef __LIBGCC_JCR_SECTION_NAME__
- void **jcr_list;
- __asm ("" : "=g" (jcr_list) : "0" (__JCR_LIST__));
- if (__builtin_expect (*jcr_list != NULL, 0))
- {
- void (*register_classes) (void *) = _Jv_RegisterClasses;
- __asm ("" : "+r" (register_classes));
- if (register_classes)
- register_classes (jcr_list);
- }
-#endif /* __LIBGCC_JCR_SECTION_NAME__ */
-
#if USE_TM_CLONE_REGISTRY
register_tm_clones ();
#endif /* USE_TM_CLONE_REGISTRY */
__attribute__ ((__used__, section(".init_array"), aligned(sizeof(func_ptr))))
= { frame_dummy };
#endif /* !defined(__LIBGCC_INIT_SECTION_ASM_OP__) */
-#endif /* USE_EH_FRAME_REGISTRY || __LIBGCC_JCR_SECTION_NAME__ || USE_TM_CLONE_REGISTRY */
+#endif /* USE_EH_FRAME_REGISTRY || USE_TM_CLONE_REGISTRY */
#else /* OBJECT_FORMAT_ELF */
}
#if defined(USE_EH_FRAME_REGISTRY) \
- || defined(__LIBGCC_JCR_SECTION_NAME__) \
|| defined(USE_TM_CLONE_REGISTRY)
/* A helper function for __do_global_ctors, which is in crtend.o. Here
in crtbegin.o, we can reference a couple of symbols not visible there.
__register_frame_info (__EH_FRAME_BEGIN__, &object);
#endif
-#ifdef __LIBGCC_JCR_SECTION_NAME__
- void **jcr_list
- __asm ("" : "=g" (jcr_list) : "0" (__JCR_LIST__));
- if (__builtin_expect (*jcr_list != NULL, 0))
- {
- void (*register_classes) (void *) = _Jv_RegisterClasses;
- __asm ("" : "+r" (register_classes));
- if (register_classes)
- register_classes (jcr_list);
- }
-#endif
-
#if USE_TM_CLONE_REGISTRY
register_tm_clones ();
#endif /* USE_TM_CLONE_REGISTRY */
}
-#endif /* USE_EH_FRAME_REGISTRY || __LIBGCC_JCR_SECTION_NAME__ || USE_TM_CLONE_REGISTRY */
+#endif /* USE_EH_FRAME_REGISTRY || USE_TM_CLONE_REGISTRY */
#else /* ! __LIBGCC_INIT_SECTION_ASM_OP__ && ! HAS_INIT_SECTION */
#error "What are you doing with crtstuff.c, then?"
= { 0 };
#endif /* __LIBGCC_EH_FRAME_SECTION_NAME__ */
-#ifdef __LIBGCC_JCR_SECTION_NAME__
-/* Null terminate the .jcr section array. */
-STATIC void *__JCR_END__[1]
- __attribute__ ((used, section(__LIBGCC_JCR_SECTION_NAME__),
- aligned(sizeof(void *))))
- = { 0 };
-#endif /* __LIBGCC_JCR_SECTION_NAME__ */
-
#if USE_TM_CLONE_REGISTRY
# ifndef HAVE_GAS_HIDDEN
static
{
func_ptr *p;
#if defined(USE_EH_FRAME_REGISTRY) \
- || defined(__LIBGCC_JCR_SECTION_NAME__) \
|| defined(USE_TM_CLONE_REGISTRY)
__do_global_ctors_1();
#endif