jdk/makefiles/common/Mapfile-vers.gmk
changeset 12317 9670c1610c53
equal deleted inserted replaced
12316:ba6b7a51e226 12317:9670c1610c53
       
     1 #
       
     2 # Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved.
       
     3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       
     4 #
       
     5 # This code is free software; you can redistribute it and/or modify it
       
     6 # under the terms of the GNU General Public License version 2 only, as
       
     7 # published by the Free Software Foundation.  Oracle designates this
       
     8 # particular file as subject to the "Classpath" exception as provided
       
     9 # by Oracle in the LICENSE file that accompanied this code.
       
    10 #
       
    11 # This code is distributed in the hope that it will be useful, but WITHOUT
       
    12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
       
    13 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
       
    14 # version 2 for more details (a copy is included in the LICENSE file that
       
    15 # accompanied this code).
       
    16 #
       
    17 # You should have received a copy of the GNU General Public License version
       
    18 # 2 along with this work; if not, write to the Free Software Foundation,
       
    19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
       
    20 #
       
    21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
       
    22 # or visit www.oracle.com if you need additional information or have any
       
    23 # questions.
       
    24 #
       
    25 
       
    26 #
       
    27 # Makefile for linking with mapfiles.
       
    28 #
       
    29 # NOTE: Not using a mapfile will expose all your extern functions and
       
    30 #	extern data symbols as part of your interface, so unless your
       
    31 #	extern names are safe from being mistaken as names from other
       
    32 #	libraries, you better use a mapfile, or use a unique naming
       
    33 #	convention on all your extern symbols.
       
    34 #
       
    35 # The mapfile will establish versioning by defining the exported interface.
       
    36 #
       
    37 # The mapfile can also force certain .o files or elf sections into the 
       
    38 #   the different segments of the resulting library/program image.
       
    39 #
       
    40 # The macro FILES_m can contain any number of mapfiles.
       
    41 #
       
    42 
       
    43 # Always make sure 'all' is the default rule
       
    44 mapfile_default_rule: all
       
    45 
       
    46 ifeq ($(PLATFORM), solaris)
       
    47 
       
    48 ifeq ($(VARIANT), OPT)
       
    49   # OPT build MUST have a mapfile?
       
    50   ifndef FILES_m
       
    51     FILES_m =        mapfile-vers
       
    52   endif
       
    53   
       
    54   # If we are re-ordering functions in this solaris library, we need to make
       
    55   # sure that -xF is added to the compile lines. This option is critical and
       
    56   # enables the functions to be reordered.
       
    57   ifdef FILES_reorder
       
    58     CFLAGS_OPT   += -xF
       
    59     CXXFLAGS_OPT += -xF
       
    60   endif
       
    61 
       
    62 INIT += $(TEMPDIR)/mapfile-vers
       
    63 
       
    64 $(TEMPDIR)/mapfile-vers : $(FILES_m) $(FILES_reorder)
       
    65 	$(prep-target)
       
    66 	$(CAT) $(FILES_m) > $@
       
    67   ifdef FILES_reorder
       
    68 	$(SED) -e 's=OUTPUTDIR=$(OUTPUTDIR)=' $(FILES_reorder) >> $@
       
    69   endif
       
    70 endif # VARIANT
       
    71 
       
    72 ifndef LDNOMAP
       
    73   LDMAPFLAGS_OPT =  -M$(TEMPDIR)/mapfile-vers
       
    74   LDMAPFLAGS_DBG =  $(FILES_m:%=-M%)
       
    75 endif
       
    76 
       
    77 endif # PLATFORM
       
    78 
       
    79 ifeq ($(PLATFORM), linux)
       
    80 
       
    81 ifeq ($(VARIANT), OPT)
       
    82   # OPT build MUST have a mapfile?
       
    83   ifndef FILES_m
       
    84     FILES_m =        mapfile-vers
       
    85   endif
       
    86 endif # VARIANT
       
    87 
       
    88 ifndef LDNOMAP
       
    89   LDMAPFLAGS_OPT =  $(FILES_m:%=-Xlinker -version-script=%)
       
    90   LDMAPFLAGS_DBG =  $(FILES_m:%=-Xlinker -version-script=%)
       
    91 endif
       
    92 
       
    93 endif # PLATFORM
       
    94   
       
    95 LDFLAGS_OPT +=  $(LDMAPFLAGS_OPT)
       
    96 LDFLAGS_DBG +=  $(LDMAPFLAGS_DBG)
       
    97