diff options
author | Philip Guenther <guenther@cvs.openbsd.org> | 2017-01-21 00:45:14 +0000 |
---|---|---|
committer | Philip Guenther <guenther@cvs.openbsd.org> | 2017-01-21 00:45:14 +0000 |
commit | f370ab815975aacbfcd4d51557fcae1a622bb182 (patch) | |
tree | 57fac42275d09ddec1117a0fc6f9ad21c23ffe3f /lib/csu/crtend.c | |
parent | c518e1a36d9df98ac82734768d27244af276ba2d (diff) |
Declare the symbols that label the .ctors, .dtors, .eh_frame, and .jcr
sections as extern hidden arrays of indefinite size, so that the compiler
(well, clang) doesn't believe it knows the exact contents and thus optimize
things into infinite loops. Actually set the symbols to be in the sections
and insert the leading and trailing values via __asm().
Problem pointed out by patrick@
testing and ok kettenis@
Diffstat (limited to 'lib/csu/crtend.c')
-rw-r--r-- | lib/csu/crtend.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/lib/csu/crtend.c b/lib/csu/crtend.c index 6d2ea472a74..566fa0652d6 100644 --- a/lib/csu/crtend.c +++ b/lib/csu/crtend.c @@ -1,20 +1,14 @@ -/* $OpenBSD: crtend.c,v 1.11 2015/04/04 18:05:05 guenther Exp $ */ +/* $OpenBSD: crtend.c,v 1.12 2017/01/21 00:45:13 guenther Exp $ */ /* $NetBSD: crtend.c,v 1.1 1996/09/12 16:59:04 cgd Exp $ */ #include <sys/types.h> #include "md_init.h" #include "extern.h" -static init_f __CTOR_LIST__[1] - __used __attribute__((section(".ctors"))) = { (void *)0 }; /* XXX */ -static init_f __DTOR_LIST__[1] - __used __attribute__((section(".dtors"))) = { (void *)0 }; /* XXX */ - -static const int __EH_FRAME_END__[] - __used __attribute__((section(".eh_frame"), aligned(4))) = { 0 }; - -static void * __JCR_END__[] - __used __attribute__((section(".jcr"), aligned(sizeof(void*)))) = { 0 }; +MD_DATA_SECTION_FLAGS_VALUE(".ctors", "aw", 0); +MD_DATA_SECTION_FLAGS_VALUE(".dtors", "aw", 0); +MD_DATA_SECTION_FLAGS_VALUE(".eh_frame", "a", 0); +MD_DATA_SECTION_FLAGS_VALUE(".jcr", "aw", 0); MD_SECTION_EPILOGUE(".init"); MD_SECTION_EPILOGUE(".fini"); |