#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
# Copyright 2015 Igor Kozhukhov <ikozhukhov@gmail.com>
#
FILES= \
lint:
# A number of dynamic executables have their own definitions of interfaces that
# exist in system libraries. To prevent name-space pollution it is desirable
# to demote the interfaces within these executable to locals. However, various
# global in any dynamic object that includes these files. These symbols
# interpose on symbols in libc, or provide call backs for other system
# files that these drivers are configured to include, differ between the
# various compilations environments (platform, 32/64-bit). Therefore, the
# only means of creating a mapfile to demote symbols is to dynamically generate
# the mapfile for a specific compilation environment.
#
# Here, template mapfiles are used to generate a number of compilation specific
# mapfiles. These mapfiles are referenced by components of the build through
# the MAPFILE.NGB macro defined in Makefile.master. These dynamically created
# mapfiles are not delivered into the $ROOT area, and therefore are not
# delivered as packaged components of the OSNet.
# This generic target creates two dynamic executables from an empty "main"
# program. These objects are not executed, but are analyzed to determine the
# global symbols each provides.
#
# The first executable demotes a family of known interfaces to local and allows
# all other symbol definitions to remain global. This executables provides the
# base for discovering all symbol definitions provided by the various
# compilation environments. The second executable demotes all symbols to
# locals. Within both executables, some symbols remain globals (_end, _etext,
# etc.) as the link-editor has special knowledge of these symbols and their
# expected visibility requirements. By inspecting the deferences between the
# global symbols within the two executables, a mapfile can be generated to
# ensure the symbols defined by the compilation environments files remain
# global.
$(ECHO) "# GENERATED FILE - DO NOT EDIT" > $@
$(SED) -e "s/ *# MAP-HEAD//" >> $@
$(SED) -e "s/^< \(.*\)/ \1;/" >> $@
$(SED) -e "s/ *# MAP-TAIL//" >> $@