From 72189cd2defd70ceb80276539e5fa294dc984851 Mon Sep 17 00:00:00 2001 From: Mark Kettenis Date: Sat, 1 May 2010 11:32:44 +0000 Subject: Sprinkle a few __used markers to prevent gcc4 from throwing away essential bits of code and data. With this change gcc4 builds usable crt*.o on sparc64, other architectures probably need some more love. ok marco@, jsg@ --- lib/csu/crtbegin.c | 10 +++++----- lib/csu/crtbeginS.c | 10 +++++----- lib/csu/crtend.c | 10 +++++----- lib/csu/crtendS.c | 8 ++++---- 4 files changed, 19 insertions(+), 19 deletions(-) (limited to 'lib/csu') diff --git a/lib/csu/crtbegin.c b/lib/csu/crtbegin.c index 64bf618e77c..95878e7db7f 100644 --- a/lib/csu/crtbegin.c +++ b/lib/csu/crtbegin.c @@ -1,4 +1,4 @@ -/* $OpenBSD: crtbegin.c,v 1.13 2009/04/13 20:15:24 kurt Exp $ */ +/* $OpenBSD: crtbegin.c,v 1.14 2010/05/01 11:32:43 kettenis Exp $ */ /* $NetBSD: crtbegin.c,v 1.1 1996/09/12 16:59:03 cgd Exp $ */ /* @@ -89,8 +89,8 @@ static const init_f __CTOR_LIST__[1] static const init_f __DTOR_LIST__[1] __attribute__((section(".dtors"))) = { (void *)-1 }; /* XXX */ -static void __dtors(void); -static void __ctors(void); +static void __dtors(void) __used; +static void __ctors(void) __used; static void __dtors() @@ -119,8 +119,8 @@ __ctors() void __init(void); void __fini(void); -static void __do_init(void); -static void __do_fini(void); +static void __do_init(void) __used; +static void __do_fini(void) __used; MD_SECTION_PROLOGUE(".init", __init); diff --git a/lib/csu/crtbeginS.c b/lib/csu/crtbeginS.c index 80779c626c1..c4572e7591d 100644 --- a/lib/csu/crtbeginS.c +++ b/lib/csu/crtbeginS.c @@ -1,4 +1,4 @@ -/* $OpenBSD: crtbeginS.c,v 1.10 2009/04/13 20:15:24 kurt Exp $ */ +/* $OpenBSD: crtbeginS.c,v 1.11 2010/05/01 11:32:43 kettenis Exp $ */ /* $NetBSD: crtbegin.c,v 1.1 1996/09/12 16:59:03 cgd Exp $ */ /* @@ -78,8 +78,8 @@ static init_f __CTOR_LIST__[1] static init_f __DTOR_LIST__[1] __attribute__((section(".dtors"))) = { (void *)-1 }; /* XXX */ -static void __dtors(void); -static void __ctors(void); +static void __dtors(void) __used; +static void __ctors(void) __used; void __dtors(void) @@ -109,8 +109,8 @@ __ctors(void) } void _init(void); void _fini(void); -static void _do_init(void); -static void _do_fini(void); +static void _do_init(void) __used; +static void _do_fini(void) __used; MD_SECTION_PROLOGUE(".init", _init); diff --git a/lib/csu/crtend.c b/lib/csu/crtend.c index f26b95580ba..6f61be9afa8 100644 --- a/lib/csu/crtend.c +++ b/lib/csu/crtend.c @@ -1,4 +1,4 @@ -/* $OpenBSD: crtend.c,v 1.8 2009/07/14 16:37:31 jsg Exp $ */ +/* $OpenBSD: crtend.c,v 1.9 2010/05/01 11:32:43 kettenis Exp $ */ /* $NetBSD: crtend.c,v 1.1 1996/09/12 16:59:04 cgd Exp $ */ #include @@ -6,16 +6,16 @@ #include "extern.h" static init_f __CTOR_LIST__[1] - __attribute__((section(".ctors"))) = { (void *)0 }; /* XXX */ + __used __attribute__((section(".ctors"))) = { (void *)0 }; /* XXX */ static init_f __DTOR_LIST__[1] - __attribute__((section(".dtors"))) = { (void *)0 }; /* XXX */ + __used __attribute__((section(".dtors"))) = { (void *)0 }; /* XXX */ static const int __EH_FRAME_END__[] -__attribute__((unused, section(".eh_frame"), aligned(4))) = { 0 }; + __used __attribute__((section(".eh_frame"), aligned(4))) = { 0 }; #if (__GNUC__ > 2) static void * __JCR_END__[] -__attribute__((unused, section(".jcr"), aligned(sizeof(void*)))) = { 0 }; + __used __attribute__((section(".jcr"), aligned(sizeof(void*)))) = { 0 }; #endif MD_SECTION_EPILOGUE(".init"); diff --git a/lib/csu/crtendS.c b/lib/csu/crtendS.c index 92493006494..cb41b9fcb49 100644 --- a/lib/csu/crtendS.c +++ b/lib/csu/crtendS.c @@ -1,4 +1,4 @@ -/* $OpenBSD: crtendS.c,v 1.6 2009/04/13 20:15:24 kurt Exp $ */ +/* $OpenBSD: crtendS.c,v 1.7 2010/05/01 11:32:43 kettenis Exp $ */ /* $NetBSD: crtend.c,v 1.1 1997/04/16 19:38:24 thorpej Exp $ */ #include @@ -6,13 +6,13 @@ #include "extern.h" static init_f __CTOR_LIST__[1] - __attribute__((section(".ctors"))) = { (void *)0 }; /* XXX */ + __used __attribute__((section(".ctors"))) = { (void *)0 }; /* XXX */ static init_f __DTOR_LIST__[1] - __attribute__((section(".dtors"))) = { (void *)0 }; /* XXX */ + __used __attribute__((section(".dtors"))) = { (void *)0 }; /* XXX */ #if (__GNUC__ > 2) static void * __JCR_END__[] -__attribute__((unused, section(".jcr"), aligned(sizeof(void*)))) = { 0 }; + __used __attribute__((section(".jcr"), aligned(sizeof(void*)))) = { 0 }; #endif MD_SECTION_EPILOGUE(".init"); -- cgit v1.2.3