From 0b80af1f8eb3ceabc4a7789c50d10eeb08b234cb Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Fri, 21 Nov 2008 10:39:47 -0800 Subject: [PATCH 1/2] Add gcc-init-pragmas branch --- .topdeps | 1 + .topmsg | 9 +++++++++ zfs/lib/libuutil/uu_misc.c | 6 ++++++ zfs/lib/libzfs/libzfs_mount.c | 12 +++++++++++- 4 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 .topdeps create mode 100644 .topmsg diff --git a/.topdeps b/.topdeps new file mode 100644 index 0000000000..1f7391f92b --- /dev/null +++ b/.topdeps @@ -0,0 +1 @@ +master diff --git a/.topmsg b/.topmsg new file mode 100644 index 0000000000..704245f5be --- /dev/null +++ b/.topmsg @@ -0,0 +1,9 @@ +From: Brian Behlendorf +Subject: [PATCH] gcc-init-pragmas + +Use constructor attribute on non-Solaris platforms. + +The #pragma init/fini ->__attribute__((constructor/destructor)) +conversions, these should go upstream. + +Signed-off-by: Brian Behlendorf diff --git a/zfs/lib/libuutil/uu_misc.c b/zfs/lib/libuutil/uu_misc.c index 0ead166e70..1411031234 100644 --- a/zfs/lib/libuutil/uu_misc.c +++ b/zfs/lib/libuutil/uu_misc.c @@ -247,7 +247,13 @@ uu_release_child(void) uu_release(); } +#ifdef __GNUC__ +static void +uu_init(void) __attribute__((constructor)); +#else #pragma init(uu_init) +#endif + static void uu_init(void) { diff --git a/zfs/lib/libzfs/libzfs_mount.c b/zfs/lib/libzfs/libzfs_mount.c index 35a2cea7a7..f31a209e7e 100644 --- a/zfs/lib/libzfs/libzfs_mount.c +++ b/zfs/lib/libzfs/libzfs_mount.c @@ -128,7 +128,13 @@ zfs_share_proto_t share_all_proto[] = { PROTO_END }; +#ifdef __GNUC__ +static void +zfs_iscsi_init(void) __attribute__((constructor)); +#else #pragma init(zfs_iscsi_init) +#endif + static void zfs_iscsi_init(void) { @@ -548,8 +554,12 @@ static void (*_sa_update_sharetab_ts)(sa_handle_t); * values to be used later. This is triggered by the runtime loader. * Make sure the correct ISA version is loaded. */ - +#ifdef __GNUC__ +static void +_zfs_init_libshare(void) __attribute__((constructor)); +#else #pragma init(_zfs_init_libshare) +#endif static void _zfs_init_libshare(void) { From ee333817278e7ec160804d383d2848487e4b1b2d Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Fri, 21 Nov 2008 11:19:42 -0800 Subject: [PATCH 2/2] Add linux prefix to .topmsg subject --- .topmsg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.topmsg b/.topmsg index 704245f5be..f2838eaa36 100644 --- a/.topmsg +++ b/.topmsg @@ -1,5 +1,5 @@ From: Brian Behlendorf -Subject: [PATCH] gcc-init-pragmas +Subject: [PATCH] gcc init pragmas Use constructor attribute on non-Solaris platforms.