1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/make/common/Mapfile-vers.gmk Sat Dec 01 00:00:00 2007 +0000 1.3 @@ -0,0 +1,98 @@ 1.4 +# 1.5 +# Copyright 1998-2005 Sun Microsystems, Inc. All Rights Reserved. 1.6 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.7 +# 1.8 +# This code is free software; you can redistribute it and/or modify it 1.9 +# under the terms of the GNU General Public License version 2 only, as 1.10 +# published by the Free Software Foundation. Sun designates this 1.11 +# particular file as subject to the "Classpath" exception as provided 1.12 +# by Sun in the LICENSE file that accompanied this code. 1.13 +# 1.14 +# This code is distributed in the hope that it will be useful, but WITHOUT 1.15 +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1.16 +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1.17 +# version 2 for more details (a copy is included in the LICENSE file that 1.18 +# accompanied this code). 1.19 +# 1.20 +# You should have received a copy of the GNU General Public License version 1.21 +# 2 along with this work; if not, write to the Free Software Foundation, 1.22 +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1.23 +# 1.24 +# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 1.25 +# CA 95054 USA or visit www.sun.com if you need additional information or 1.26 +# have any questions. 1.27 +# 1.28 + 1.29 +# 1.30 +# Makefile for linking with mapfiles. 1.31 +# 1.32 +# NOTE: Not using a mapfile will expose all your extern functions and 1.33 +# extern data symbols as part of your interface, so unless your 1.34 +# extern names are safe from being mistaken as names from other 1.35 +# libraries, you better use a mapfile, or use a unique naming 1.36 +# convention on all your extern symbols. 1.37 +# 1.38 +# The mapfile will establish versioning by defining the exported interface. 1.39 +# 1.40 +# The mapfile can also force certain .o files or elf sections into the 1.41 +# the different segments of the resulting library/program image. 1.42 +# 1.43 +# The macro FILES_m can contain any number of mapfiles. 1.44 +# 1.45 + 1.46 +# Always make sure 'all' is the default rule 1.47 +mapfile_default_rule: all 1.48 + 1.49 +ifeq ($(PLATFORM), solaris) 1.50 + 1.51 +ifeq ($(VARIANT), OPT) 1.52 + # OPT build MUST have a mapfile? 1.53 + ifndef FILES_m 1.54 + FILES_m = mapfile-vers 1.55 + endif 1.56 + 1.57 + # If we are re-ordering functions in this solaris library, we need to make 1.58 + # sure that -xF is added to the compile lines. This option is critical and 1.59 + # enables the functions to be reordered. 1.60 + ifdef FILES_reorder 1.61 + CFLAGS_OPT += -xF 1.62 + CXXFLAGS_OPT += -xF 1.63 + endif 1.64 + 1.65 +INIT += $(TEMPDIR)/mapfile-vers 1.66 + 1.67 +$(TEMPDIR)/mapfile-vers : $(FILES_m) $(FILES_reorder) 1.68 + $(prep-target) 1.69 + $(CAT) $(FILES_m) > $@ 1.70 + ifdef FILES_reorder 1.71 + $(SED) -e 's=OUTPUTDIR=$(OUTPUTDIR)=' $(FILES_reorder) >> $@ 1.72 + endif 1.73 +endif # VARIANT 1.74 + 1.75 +ifndef LDNOMAP 1.76 + LDMAPFLAGS_OPT = -M$(TEMPDIR)/mapfile-vers 1.77 + LDMAPFLAGS_DBG = $(FILES_m:%=-M%) 1.78 +endif 1.79 + 1.80 +endif # PLATFORM 1.81 + 1.82 + 1.83 +ifeq ($(PLATFORM), linux) 1.84 + 1.85 +ifeq ($(VARIANT), OPT) 1.86 + # OPT build MUST have a mapfile? 1.87 + ifndef FILES_m 1.88 + FILES_m = mapfile-vers 1.89 + endif 1.90 +endif # VARIANT 1.91 + 1.92 +ifndef LDNOMAP 1.93 + LDMAPFLAGS_OPT = $(FILES_m:%=-Xlinker -version-script=%) 1.94 + LDMAPFLAGS_DBG = $(FILES_m:%=-Xlinker -version-script=%) 1.95 +endif 1.96 + 1.97 +endif # PLATFORM 1.98 + 1.99 +LDFLAGS_OPT += $(LDMAPFLAGS_OPT) 1.100 +LDFLAGS_DBG += $(LDMAPFLAGS_DBG) 1.101 +