Date: Sat, 15 Apr 2006 02:30:45 GMT From: John Birrell <jb@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 95300 for review Message-ID: <200604150230.k3F2UjTC012503@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=95300 Change 95300 by jb@jb_freebsd2 on 2006/04/15 02:30:23 Create weak references the FreeBSD way. It looks like gcc on FreeBSD silently ignores #pragma weak. Affected files ... .. //depot/projects/dtrace/src/contrib/opensolaris/cmd/sgs/libelf/common/begin.c#2 edit .. //depot/projects/dtrace/src/contrib/opensolaris/cmd/sgs/libelf/common/cntl.c#2 edit .. //depot/projects/dtrace/src/contrib/opensolaris/cmd/sgs/libelf/common/end.c#2 edit .. //depot/projects/dtrace/src/contrib/opensolaris/cmd/sgs/libelf/common/error.c#3 edit .. //depot/projects/dtrace/src/contrib/opensolaris/cmd/sgs/libelf/common/fill.c#2 edit .. //depot/projects/dtrace/src/contrib/opensolaris/cmd/sgs/libelf/common/flag.c#2 edit .. //depot/projects/dtrace/src/contrib/opensolaris/cmd/sgs/libelf/common/getarhdr.c#2 edit .. //depot/projects/dtrace/src/contrib/opensolaris/cmd/sgs/libelf/common/getarsym.c#2 edit .. //depot/projects/dtrace/src/contrib/opensolaris/cmd/sgs/libelf/common/getbase.c#2 edit .. //depot/projects/dtrace/src/contrib/opensolaris/cmd/sgs/libelf/common/getdata.c#2 edit .. //depot/projects/dtrace/src/contrib/opensolaris/cmd/sgs/libelf/common/getehdr.c#2 edit .. //depot/projects/dtrace/src/contrib/opensolaris/cmd/sgs/libelf/common/getident.c#2 edit .. //depot/projects/dtrace/src/contrib/opensolaris/cmd/sgs/libelf/common/getphdr.c#2 edit .. //depot/projects/dtrace/src/contrib/opensolaris/cmd/sgs/libelf/common/getscn.c#2 edit .. //depot/projects/dtrace/src/contrib/opensolaris/cmd/sgs/libelf/common/getshdr.c#2 edit .. //depot/projects/dtrace/src/contrib/opensolaris/cmd/sgs/libelf/common/hash.c#2 edit .. //depot/projects/dtrace/src/contrib/opensolaris/cmd/sgs/libelf/common/kind.c#2 edit .. //depot/projects/dtrace/src/contrib/opensolaris/cmd/sgs/libelf/common/ndxscn.c#2 edit .. //depot/projects/dtrace/src/contrib/opensolaris/cmd/sgs/libelf/common/newdata.c#2 edit .. //depot/projects/dtrace/src/contrib/opensolaris/cmd/sgs/libelf/common/newphdr.c#2 edit .. //depot/projects/dtrace/src/contrib/opensolaris/cmd/sgs/libelf/common/newscn.c#2 edit .. //depot/projects/dtrace/src/contrib/opensolaris/cmd/sgs/libelf/common/next.c#2 edit .. //depot/projects/dtrace/src/contrib/opensolaris/cmd/sgs/libelf/common/nextscn.c#2 edit .. //depot/projects/dtrace/src/contrib/opensolaris/cmd/sgs/libelf/common/rand.c#2 edit .. //depot/projects/dtrace/src/contrib/opensolaris/cmd/sgs/libelf/common/rawdata.c#2 edit .. //depot/projects/dtrace/src/contrib/opensolaris/cmd/sgs/libelf/common/rawfile.c#2 edit .. //depot/projects/dtrace/src/contrib/opensolaris/cmd/sgs/libelf/common/strptr.c#2 edit .. //depot/projects/dtrace/src/contrib/opensolaris/cmd/sgs/libelf/common/xlate.m4#2 edit Differences ... ==== //depot/projects/dtrace/src/contrib/opensolaris/cmd/sgs/libelf/common/begin.c#2 (text) ==== @@ -32,8 +32,14 @@ #pragma ident "@(#)begin.c 1.17 05/06/08 SMI" /* SVr4.0 1.13 */ +#if defined(sun) #pragma weak elf_begin = _elf_begin #pragma weak elf_memory = _elf_memory +#else +#include <sys/cdefs.h> +__weak_reference(_elf_begin,elf_begin); +__weak_reference(_elf_memory,elf_memory); +#endif #include "syn.h" ==== //depot/projects/dtrace/src/contrib/opensolaris/cmd/sgs/libelf/common/cntl.c#2 (text) ==== @@ -30,8 +30,12 @@ #pragma ident "@(#)cntl.c 1.10 05/06/08 SMI" /* SVr4.0 1.4 */ +#if defined(sun) #pragma weak elf_cntl = _elf_cntl - +#else +#include <sys/cdefs.h> +__weak_reference(_elf_cntl,elf_cntl); +#endif #include "syn.h" #include "libelf.h" ==== //depot/projects/dtrace/src/contrib/opensolaris/cmd/sgs/libelf/common/end.c#2 (text) ==== @@ -31,8 +31,12 @@ #pragma ident "@(#)end.c 1.11 05/06/08 SMI" /* SVr4.0 1.11 */ +#if defined(sun) #pragma weak elf_end = _elf_end - +#else +#include <sys/cdefs.h> +__weak_reference(_elf_end,elf_end); +#endif #include "syn.h" #include <ar.h> ==== //depot/projects/dtrace/src/contrib/opensolaris/cmd/sgs/libelf/common/error.c#3 (text) ==== @@ -27,8 +27,14 @@ #pragma ident "@(#)error.c 1.20 05/06/08 SMI" /* SVr4.0 1.16 */ +#if defined(sun) #pragma weak elf_errmsg = _elf_errmsg #pragma weak elf_errno = _elf_errno +#else +#include <sys/cdefs.h> +__weak_reference(_elf_errmsg,elf_errmsg); +__weak_reference(_elf_errno,elf_errno); +#endif #include "syn.h" #if defined(sun) @@ -64,13 +70,18 @@ NOTE(DATA_READABLE_WITHOUT_LOCK(bufonce)) +#if defined(sun) extern char *_dgettext(const char *, const char *); - +#endif const char * _libelf_msg(Msg mid) { +#ifdef DOODAD return (_dgettext(MSG_ORIG(MSG_SUNW_OST_SGS), MSG_ORIG(mid))); +#else +return NULL; +#endif } @@ -110,7 +121,12 @@ if (keyonce == 0) return (0); +#if defined(sun) (void) thr_getspecific(errkey, (void **)(&rc)); +#else + rc = (intptr_t) pthread_getspecific(errkey); +#endif + return ((int)rc); } @@ -154,7 +170,11 @@ (void) mutex_unlock(&buflock); } +#if defined(sun) (void) thr_getspecific(bufkey, (void **)&buffer); +#else + buffer = (char *) pthread_getspecific(bufkey); +#endif if (!buffer) { if ((buffer = malloc(MAXELFERR)) == 0) ==== //depot/projects/dtrace/src/contrib/opensolaris/cmd/sgs/libelf/common/fill.c#2 (text) ==== @@ -30,7 +30,12 @@ #pragma ident "@(#)fill.c 1.10 05/06/08 SMI" /* SVr4.0 1.2 */ +#if defined(sun) #pragma weak elf_fill = _elf_fill +#else +#include <sys/cdefs.h> +__weak_reference(_elf_fill,elf_fill); +#endif #include <libelf.h> #include "syn.h" ==== //depot/projects/dtrace/src/contrib/opensolaris/cmd/sgs/libelf/common/flag.c#2 (text) ==== @@ -30,13 +30,22 @@ #pragma ident "@(#)flag.c 1.10 05/06/08 SMI" /* SVr4.0 1.6 */ +#if defined(sun) #pragma weak elf_flagdata = _elf_flagdata #pragma weak elf_flagehdr = _elf_flagehdr #pragma weak elf_flagelf = _elf_flagelf #pragma weak elf_flagphdr = _elf_flagphdr #pragma weak elf_flagscn = _elf_flagscn #pragma weak elf_flagshdr = _elf_flagshdr - +#else +#include <sys/cdefs.h> +__weak_reference(_elf_flagdata,elf_flagdata); +__weak_reference(_elf_flagehdr,elf_flagehdr); +__weak_reference(_elf_flagelf,elf_flagelf); +__weak_reference(_elf_flagphdr,elf_flagphdr); +__weak_reference(_elf_flagscn,elf_flagscn); +__weak_reference(_elf_flagshdr,elf_flagshdr); +#endif #include "syn.h" #include "libelf.h" ==== //depot/projects/dtrace/src/contrib/opensolaris/cmd/sgs/libelf/common/getarhdr.c#2 (text) ==== @@ -30,8 +30,12 @@ #pragma ident "@(#)getarhdr.c 1.12 05/06/08 SMI" /* SVr4.0 1.7 */ +#if defined(sun) #pragma weak elf_getarhdr = _elf_getarhdr - +#else +#include <sys/cdefs.h> +__weak_reference(_elf_getarhdr,elf_getarhdr); +#endif #include <ar.h> #include "syn.h" ==== //depot/projects/dtrace/src/contrib/opensolaris/cmd/sgs/libelf/common/getarsym.c#2 (text) ==== @@ -31,8 +31,12 @@ #pragma ident "@(#)getarsym.c 1.14 05/06/08 SMI" /* SVr4.0 1.6 */ +#if defined(sun) #pragma weak elf_getarsym = _elf_getarsym - +#else +#include <sys/cdefs.h> +__weak_reference(_elf_getarsym,elf_getarsym); +#endif #include "syn.h" #include <stdlib.h> ==== //depot/projects/dtrace/src/contrib/opensolaris/cmd/sgs/libelf/common/getbase.c#2 (text) ==== @@ -30,8 +30,12 @@ #pragma ident "@(#)getbase.c 1.9 05/06/08 SMI" /* SVr4.0 1.6 */ +#if defined(sun) #pragma weak elf_getbase = _elf_getbase - +#else +#include <sys/cdefs.h> +__weak_reference(_elf_getbase,elf_getbase); +#endif #include "syn.h" #include "libelf.h" ==== //depot/projects/dtrace/src/contrib/opensolaris/cmd/sgs/libelf/common/getdata.c#2 (text) ==== @@ -31,8 +31,12 @@ #pragma ident "@(#)getdata.c 1.22 06/03/03 SMI" /* SVr4.0 1.16 */ +#if defined(sun) #pragma weak elf_getdata = _elf_getdata - +#else +#include <sys/cdefs.h> +__weak_reference(_elf_getdata,elf_getdata); +#endif #include "syn.h" #include <stdlib.h> ==== //depot/projects/dtrace/src/contrib/opensolaris/cmd/sgs/libelf/common/getehdr.c#2 (text) ==== @@ -32,8 +32,12 @@ #pragma ident "@(#)getehdr.c 1.11 05/06/08 SMI" /* SVr4.0 1.8 */ +#if defined(sun) #pragma weak elf32_getehdr = _elf32_getehdr - +#else +#include <sys/cdefs.h> +__weak_reference(_elf32_getehdr,elf32_getehdr); +#endif #include "syn.h" #include "libelf.h" ==== //depot/projects/dtrace/src/contrib/opensolaris/cmd/sgs/libelf/common/getident.c#2 (text) ==== @@ -29,8 +29,12 @@ #pragma ident "@(#)getident.c 1.9 05/06/08 SMI" /* SVr4.0 1.8 */ +#if defined(sun) #pragma weak elf_getident = _elf_getident - +#else +#include <sys/cdefs.h> +__weak_reference(_elf_getident,elf_getident); +#endif #include "syn.h" #include "libelf.h" ==== //depot/projects/dtrace/src/contrib/opensolaris/cmd/sgs/libelf/common/getphdr.c#2 (text) ==== @@ -31,8 +31,12 @@ #pragma ident "@(#)getphdr.c 1.11 05/06/08 SMI" /* SVr4.0 1.10 */ +#if defined(sun) #pragma weak elf32_getphdr = _elf32_getphdr - +#else +#include <sys/cdefs.h> +__weak_reference(_elf32_getphdr,elf32_getphdr); +#endif #include "syn.h" #include "libelf.h" ==== //depot/projects/dtrace/src/contrib/opensolaris/cmd/sgs/libelf/common/getscn.c#2 (text) ==== @@ -29,8 +29,12 @@ #pragma ident "@(#)getscn.c 1.10 05/06/08 SMI" /* SVr4.0 1.10 */ +#if defined(sun) #pragma weak elf_getscn = _elf_getscn - +#else +#include <sys/cdefs.h> +__weak_reference(_elf_getscn,elf_getscn); +#endif #include "syn.h" #include "libelf.h" ==== //depot/projects/dtrace/src/contrib/opensolaris/cmd/sgs/libelf/common/getshdr.c#2 (text) ==== @@ -29,7 +29,12 @@ #pragma ident "@(#)getshdr.c 1.12 05/06/08 SMI" /* SVr4.0 1.4 */ +#if defined(sun) #pragma weak elf32_getshdr = _elf32_getshdr +#else +#include <sys/cdefs.h> +__weak_reference(_elf32_getshdr,elf32_getshdr); +#endif #include "syn.h" #include "libelf.h" ==== //depot/projects/dtrace/src/contrib/opensolaris/cmd/sgs/libelf/common/hash.c#2 (text) ==== @@ -30,8 +30,12 @@ #pragma ident "@(#)hash.c 1.10 05/06/08 SMI" /* SVr4.0 1.4 */ +#if defined(sun) #pragma weak elf_hash = _elf_hash - +#else +#include <sys/cdefs.h> +__weak_reference(_elf_hash,elf_hash); +#endif #include "syn.h" ==== //depot/projects/dtrace/src/contrib/opensolaris/cmd/sgs/libelf/common/kind.c#2 (text) ==== @@ -30,8 +30,12 @@ #pragma ident "@(#)kind.c 1.9 05/06/08 SMI" /* SVr4.0 1.4 */ +#if defined(sun) #pragma weak elf_kind = _elf_kind - +#else +#include <sys/cdefs.h> +__weak_reference(_elf_kind,elf_kind); +#endif #include "syn.h" #include "libelf.h" ==== //depot/projects/dtrace/src/contrib/opensolaris/cmd/sgs/libelf/common/ndxscn.c#2 (text) ==== @@ -31,8 +31,12 @@ #pragma ident "@(#)ndxscn.c 1.9 05/06/08 SMI" /* SVr4.0 1.2 */ +#if defined(sun) #pragma weak elf_ndxscn = _elf_ndxscn - +#else +#include <sys/cdefs.h> +__weak_reference(_elf_ndxscn,elf_ndxscn); +#endif #include "syn.h" #include "libelf.h" ==== //depot/projects/dtrace/src/contrib/opensolaris/cmd/sgs/libelf/common/newdata.c#2 (text) ==== @@ -31,8 +31,12 @@ #pragma ident "@(#)newdata.c 1.12 05/06/08 SMI" /* SVr4.0 1.2 */ +#if defined(sun) #pragma weak elf_newdata = _elf_newdata - +#else +#include <sys/cdefs.h> +__weak_reference(_elf_newdata,elf_newdata); +#endif #include "syn.h" #include "libelf.h" ==== //depot/projects/dtrace/src/contrib/opensolaris/cmd/sgs/libelf/common/newphdr.c#2 (text) ==== @@ -30,9 +30,14 @@ #pragma ident "@(#)newphdr.c 1.17 05/06/08 SMI" +#if defined(sun) #if !defined(_ELF64) #pragma weak elf32_newphdr = _elf32_newphdr #endif +#else +#include <sys/cdefs.h> +__weak_reference(_elf32_newphdr,elf32_newphdr); +#endif #include "syn.h" #include <stdlib.h> ==== //depot/projects/dtrace/src/contrib/opensolaris/cmd/sgs/libelf/common/newscn.c#2 (text) ==== @@ -30,8 +30,12 @@ #pragma ident "@(#)newscn.c 1.12 05/06/08 SMI" /* SVr4.0 1.4 */ +#if defined(sun) #pragma weak elf_newscn = _elf_newscn - +#else +#include <sys/cdefs.h> +__weak_reference(_elf_newscn,elf_newscn); +#endif #include "syn.h" #include "libelf.h" ==== //depot/projects/dtrace/src/contrib/opensolaris/cmd/sgs/libelf/common/next.c#2 (text) ==== @@ -30,8 +30,12 @@ #pragma ident "@(#)next.c 1.9 05/06/08 SMI" /* SVr4.0 1.5 */ +#if defined(sun) #pragma weak elf_next = _elf_next - +#else +#include <sys/cdefs.h> +__weak_reference(_elf_next,elf_next); +#endif #include "syn.h" #include "libelf.h" ==== //depot/projects/dtrace/src/contrib/opensolaris/cmd/sgs/libelf/common/nextscn.c#2 (text) ==== @@ -31,7 +31,12 @@ #pragma ident "@(#)nextscn.c 1.9 05/06/08 SMI" /* SVr4.0 1.2 */ +#if defined(sun) #pragma weak elf_nextscn = _elf_nextscn +#else +#include <sys/cdefs.h> +__weak_reference(_elf_nextscn,elf_nextscn); +#endif #include "syn.h" #include "libelf.h" ==== //depot/projects/dtrace/src/contrib/opensolaris/cmd/sgs/libelf/common/rand.c#2 (text) ==== @@ -30,8 +30,12 @@ #pragma ident "@(#)rand.c 1.10 05/06/08 SMI" /* SVr4.0 1.2 */ +#if defined(sun) #pragma weak elf_rand = _elf_rand - +#else +#include <sys/cdefs.h> +__weak_reference(_elf_rand,elf_rand); +#endif #include "syn.h" #include "libelf.h" ==== //depot/projects/dtrace/src/contrib/opensolaris/cmd/sgs/libelf/common/rawdata.c#2 (text) ==== @@ -31,8 +31,12 @@ #pragma ident "@(#)rawdata.c 1.12 05/06/08 SMI" /* SVr4.0 1.3 */ +#if defined(sun) #pragma weak elf_rawdata = _elf_rawdata - +#else +#include <sys/cdefs.h> +__weak_reference(_elf_rawdata,elf_rawdata); +#endif #include "syn.h" #include <stdlib.h> ==== //depot/projects/dtrace/src/contrib/opensolaris/cmd/sgs/libelf/common/rawfile.c#2 (text) ==== @@ -31,8 +31,12 @@ #pragma ident "@(#)rawfile.c 1.9 05/06/08 SMI" /* SVr4.0 1.4 */ +#if defined(sun) #pragma weak elf_rawfile = _elf_rawfile - +#else +#include <sys/cdefs.h> +__weak_reference(_elf_rawfile,elf_rawfile); +#endif #include "syn.h" #include "libelf.h" ==== //depot/projects/dtrace/src/contrib/opensolaris/cmd/sgs/libelf/common/strptr.c#2 (text) ==== @@ -30,8 +30,12 @@ #pragma ident "@(#)strptr.c 1.11 05/06/08 SMI" /* SVr4.0 1.6 */ +#if defined(sun) #pragma weak elf_strptr = _elf_strptr - +#else +#include <sys/cdefs.h> +__weak_reference(_elf_strptr,elf_strptr); +#endif #include "syn.h" #include "libelf.h" ==== //depot/projects/dtrace/src/contrib/opensolaris/cmd/sgs/libelf/common/xlate.m4#2 (text) ==== @@ -26,10 +26,18 @@ #pragma ident "@(#)xlate.m4 1.27 06/03/07 SMI" +#if defined(sun) #pragma weak elf32_fsize = _elf32_fsize #pragma weak elf_version = _elf_version #pragma weak elf32_xlatetof = _elf32_xlatetof #pragma weak elf32_xlatetom = _elf32_xlatetom +#else +#include <sys/cdefs.h> +__weak_reference(_elf32_fsize,elf32_fsize); +__weak_reference(_elf_version,elf_version); +__weak_reference(_elf32_xlatetof,elf32_xlatetof); +__weak_reference(_elf32_xlatetom,elf32_xlatetom); +#endif #include "syn.h" #include <memory.h>
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200604150230.k3F2UjTC012503>