diff options
author | rearnsha <rearnsha@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-12-13 14:24:03 +0000 |
---|---|---|
committer | rearnsha <rearnsha@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-12-13 14:24:03 +0000 |
commit | 2f9e77d1f405a800f0a14731c4173eb64b0e0020 (patch) | |
tree | d02bbfaf0f7f2c12f79276ee2bd6883b939f8502 /gcc/config/netbsd.h | |
parent | c0b8fbcb3a7f78d469285f2eef724af331bb3dfa (diff) | |
download | gcc-2f9e77d1f405a800f0a14731c4173eb64b0e0020.tar.gz |
* collect2.c (COLLECT_SHARED_INIT_FUNC)
(COLLECT_SHARD_FINI_FUNC): Define default values.
(write_c_file_stat): Use them to call construtor and destructor
functions in shared libraries.
* doc/tm.texi (COLLECT_SHARED_INIT_FUNC)
(COLLECT_SHARD_FINI_FUNC): Document them.
* config/netbsd.h (COLLECT_SHARED_INIT_FUNC)
(COLLECT_SHARD_FINI_FUNC): Define.
* config/netbsd.h (LINK_SPEC): Don't pull in estart if creating a
shared library. Pass -shared through to the linker.
* config/arm/netbsd.h (LINK_SPEC): Likewise.
* config/arm/t-netbsd (TARGET_LIBGCC2_CFLAGS): Add -fpic.
(SHLIB_EXT, SHLIB_NAME, SHLIB_SONAME, SHLIB_OBJS, SHLIB_LINK)
(SHLIB_INSTALL): Define.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@47975 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config/netbsd.h')
-rw-r--r-- | gcc/config/netbsd.h | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/gcc/config/netbsd.h b/gcc/config/netbsd.h index b76e747c50c..35e671baacb 100644 --- a/gcc/config/netbsd.h +++ b/gcc/config/netbsd.h @@ -54,11 +54,26 @@ #define LIB_SPEC "%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}" /* Provide a LINK_SPEC appropriate for NetBSD. Here we provide support - for the special GCC options -static, -assert, and -nostdlib. */ + for the special GCC options -shared, -static, -assert, and -nostdlib. */ #undef LINK_SPEC #define LINK_SPEC \ - "%{!nostdlib:%{!r*:%{!e*:-e start}}} -dc -dp %{R*} %{static:-Bstatic} %{assert*}" + "%{!shared:%{!nostdlib:%{!r*:%{!e*:-e start}}} -dc -dp %{R*} %{static:-Bstatic}} %{shared} %{assert*}" + +/* When building shared libraries, the initialization and finalization + functions for the library are .init and .fini respectively. */ + +#define COLLECT_SHARED_INIT_FUNC(STREAM,FUNC) \ + do { \ + fprintf ((STREAM), "void __init() __asm__ (\".init\");"); \ + fprintf ((STREAM), "void __init() {\n\t%s();\n}\n", (FUNC)); \ + } while (0); + +#define COLLECT_SHARED_FINI_FUNC(STREAM,FUNC) \ + do { \ + fprintf ((STREAM), "void __fini() __asm__ (\".fini\");"); \ + fprintf ((STREAM), "void __fini() {\n\t%s();\n}\n", (FUNC)); \ + } while (0); /* This defines which switch letters take arguments. */ #undef SWITCH_TAKES_ARG |