diff options
author | wtchang%redhat.com <devnull@localhost> | 2005-04-29 21:02:55 +0000 |
---|---|---|
committer | wtchang%redhat.com <devnull@localhost> | 2005-04-29 21:02:55 +0000 |
commit | 3988085ee4f23e0d9ca720754caaa10ab5a4186a (patch) | |
tree | 18e456b59753736b015d1a39ef39deb0215024af /config | |
parent | 996073ea897c610c8faa093b574838aedcd98641 (diff) | |
download | nspr-hg-3988085ee4f23e0d9ca720754caaa10ab5a4186a.tar.gz |
Bugzilla Bug 273336: Checked in Brian Ryner's patch:
Add support for using gcc's visibility pragma to treat all function and
method declarations as "hidden" unless declared otherwise. Create wrappers
for system headers that cause them to be treated as default-visibility
declarations. This gives a substantial code size and performance win on
compilers that support it. r=darin sr=dbaron.
Modified Files:
configure configure.in config/Makefile.in
config/autoconf.mk.in config/config.mk pr/include/prtypes.h
pr/src/md/unix/uxproces.c pr/tests/sel_spd.c
Added Files:
config/gcc_hidden.h config/make-system-wrappers.pl
config/system-headers
Diffstat (limited to 'config')
-rw-r--r-- | config/Makefile.in | 11 | ||||
-rw-r--r-- | config/autoconf.mk.in | 3 | ||||
-rw-r--r-- | config/config.mk | 8 | ||||
-rw-r--r-- | config/gcc_hidden.h | 2 | ||||
-rw-r--r-- | config/make-system-wrappers.pl | 59 | ||||
-rw-r--r-- | config/system-headers | 168 |
6 files changed, 247 insertions, 4 deletions
diff --git a/config/Makefile.in b/config/Makefile.in index 1b83ffa5..7a1ccbd9 100644 --- a/config/Makefile.in +++ b/config/Makefile.in @@ -46,6 +46,10 @@ include $(MOD_DEPTH)/config/autoconf.mk # Indicate that this directory builds build tools. INTERNAL_TOOLS = 1 +# For sanity's sake, we compile nsinstall without the wrapped system +# headers, so that we can use it to set up the wrapped system headers. +VISIBILITY_FLAGS = + # autoconf.mk must be deleted last (from the top-level directory) # because it is included by every makefile. DIST_GARBAGE = nsprincl.mk nsprincl.sh nspr-config @@ -136,6 +140,13 @@ endef export:: $(TARGETS) rm -f $(dist_bindir)/nspr-config +ifdef WRAP_SYSTEM_INCLUDES +export:: + if test ! -d system_wrappers; then mkdir system_wrappers; fi + $(PERL) $(srcdir)/make-system-wrappers.pl system_wrappers < $(srcdir)/system-headers + $(INSTALL) system_wrappers $(dist_includedir) +endif + $(OBJDIR)/%$(PROG_SUFFIX): $(OBJDIR)/%.$(OBJ_SUFFIX) @$(MAKE_OBJDIR) ifeq ($(MOZ_OS2_TOOLS),VACPP) diff --git a/config/autoconf.mk.in b/config/autoconf.mk.in index 92800154..066832be 100644 --- a/config/autoconf.mk.in +++ b/config/autoconf.mk.in @@ -111,3 +111,6 @@ OBJECT_MODE = @OBJECT_MODE@ ifdef OBJECT_MODE export OBJECT_MODE endif + +VISIBILITY_FLAGS = @VISIBILITY_FLAGS@ +WRAP_SYSTEM_INCLUDES = @WRAP_SYSTEM_INCLUDES@ diff --git a/config/config.mk b/config/config.mk index 697a6015..10ebfdab 100644 --- a/config/config.mk +++ b/config/config.mk @@ -62,10 +62,10 @@ endif NFSPWD = $(MOD_DEPTH)/config/nfspwd -CFLAGS = $(CC_ONLY_FLAGS) $(OPTIMIZER) $(OS_CFLAGS)\ - $(XP_DEFINE) $(DEFINES) $(INCLUDES) $(XCFLAGS) -CCCFLAGS = $(CCC_ONLY_FLAGS) $(OPTIMIZER) $(OS_CFLAGS)\ - $(XP_DEFINE) $(DEFINES) $(INCLUDES) $(XCFLAGS) +CFLAGS = $(VISIBILITY_FLAGS) $(CC_ONLY_FLAGS) $(OPTIMIZER)\ + $(OS_CFLAGS) $(XP_DEFINE) $(DEFINES) $(INCLUDES) $(XCFLAGS) +CCCFLAGS = $(VISIBILITY_FLAGS) $(CCC_ONLY_FLAGS) $(OPTIMIZER)\ + $(OS_CFLAGS) $(XP_DEFINE) $(DEFINES) $(INCLUDES) $(XCFLAGS) # For purify NOMD_CFLAGS = $(CC_ONLY_FLAGS) $(OPTIMIZER) $(NOMD_OS_CFLAGS)\ $(XP_DEFINE) $(DEFINES) $(INCLUDES) $(XCFLAGS) diff --git a/config/gcc_hidden.h b/config/gcc_hidden.h new file mode 100644 index 00000000..58140c15 --- /dev/null +++ b/config/gcc_hidden.h @@ -0,0 +1,2 @@ +/* Begin all files as hidden visibility */ +#pragma GCC visibility push(hidden) diff --git a/config/make-system-wrappers.pl b/config/make-system-wrappers.pl new file mode 100644 index 00000000..31c9af4a --- /dev/null +++ b/config/make-system-wrappers.pl @@ -0,0 +1,59 @@ +#!/usr/bin/perl +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is mozilla.org code. +# +# The Initial Developer of the Original Code is +# IBM Corporation. +# Portions created by the Initial Developer are Copyright (C) 2004 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# Brian Ryner <bryner@brianryner.com> +# +# Alternatively, the contents of this file may be used under the terms of +# either of the GNU General Public License Version 2 or later (the "GPL"), +# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +$output_dir = shift; + +while (<STDIN>) { + chomp; + if (-e "$output_dir/$_") { + next; + } + + if (/(.*)\/[^\/*]/) { + mkdir "$output_dir/$1"; + } + + open OUT, ">$output_dir/$_"; + print OUT "#pragma GCC system_header\n"; # suppress include_next warning + print OUT "#pragma GCC visibility push(default)\n"; + print OUT "#include_next \<$_\>\n"; + print OUT "#pragma GCC visibility pop\n"; + close OUT; +} + diff --git a/config/system-headers b/config/system-headers new file mode 100644 index 00000000..7a2869e7 --- /dev/null +++ b/config/system-headers @@ -0,0 +1,168 @@ +Aliases.h +arpa/inet.h +assert.h +bsd/libc.h +bsd/syscall.h +bstring.h +builtin.h +c_asm.h +CFBundle.h +CFData.h +CFDictionary.h +CFString.h +CFURL.h +CodeFragments.h +commdlg.h +crt_externs.h +crypt.h +ctype.h +descrip.h +Devices.h +direct.h +dirent.h +dlfcn.h +dl.h +DriverServices.h +dvidef.h +errno.h +Errors.h +Events.h +fcntl.h +fibdef.h +files.h +Files.h +float.h +Folders.h +Gestalt.h +getopt.h +grp.h +ia64/sys/inline.h +ifaddrs.h +image.h +ints.h +iodef.h +io.h +iostream.h +kernel/OS.h +lib$routines.h +limits.h +loader.h +locale.h +LowMem.h +MacErrors.h +machine/builtins.h +machine/clock.h +machine/endian.h +machine/inline.h +mach-o/dyld.h +MacTypes.h +Math64.h +math.h +mbstring.h +memory.h +MixedMode.h +model.h +mswsock.h +Multiprocessing.h +mutex.h +netdb.h +net/if.h +netinet/in.h +netinet/in_systm.h +netinet/tcp.h +OpenTptInternet.h +OpenTransport.h +os2.h +OS.h +osreldate.h +OSUtils.h +poll.h +PPCToolbox.h +Processes.h +process.h +pthread.h +pwd.h +QDOffscreen.h +Resources.h +rld_interface.h +rpc/types.h +semaphore.h +setjmp.h +share.h +signal.h +ssdef.h +starlet.h +stat.h +stdarg.h +stddef.h +stdio.h +stdlib.h +string.h +stropts.h +stsdef.h +support/SupportDefs.h +support/TLS.h +synch.h +sys/atomic_op.h +syscall.h +sys/file.h +sys/filio.h +sys/immu.h +sys/ioctl.h +sys/ipc.h +sys/ldr.h +sys/locking.h +sys/lwp.h +sys/mman.h +sys/mpctl.h +sys/param.h +sys/pda.h +sys/poll.h +sys/prctl.h +sys/priv.h +sys/procfs.h +sys/pstat.h +sys/regset.h +sys/resource.h +sys/sched.h +sys/select.h +sys/sem.h +sys/sendfile.h +sys/shm.h +sys/socket.h +sys/stack.h +sys/stat.h +sys/statvfs.h +sys/syscall.h +sys/sysctl.h +sys/sysmp.h +sys/syssgi.h +sys/systeminfo.h +sys/timeb.h +sys/time.h +sys/times.h +sys/types.h +sys/ucontext.h +sys/uio.h +sys/utsname.h +sys/wait.h +task.h +TextUtils.h +thread.h +time.h +Timer.h +types.h +Types.h +ucontext.h +ucx$inetdef.h +ulocks.h +unistd.h +unix.h +unixlib.h +utime.h +wchar.h +winbase.h +win/compobj.h +windef.h +windows.h +winsock.h |