6 # You may not use this file except in compliance with the License.
7 #
8 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 # or http://www.opensolaris.org/os/licensing.
10 # See the License for the specific language governing permissions
11 # and limitations under the License.
12 #
13 # When distributing Covered Code, include this CDDL HEADER in each
14 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 # If applicable, add the following below this CDDL HEADER, with the
16 # fields enclosed by brackets "[]" replaced with your own identifying
17 # information: Portions Copyright [yyyy] [name of copyright owner]
18 #
19 # CDDL HEADER END
20 #
21
22 #
23 # Copyright 2007 Sun Microsystems, Inc. All rights reserved.
24 # Use is subject to license terms.
25 #
26 # ident "%Z%%M% %I% %E% SMI"
27 #
28
29 include $(SRC)/Makefile.master
30
31 FILES= \
32 $(MACH)_cc_map.noexeglobs \
33 $(MACH)_gcc_map.noexeglobs
34
35 $(BUILD64)FILES += \
36 $(MACH64)_cc_map.noexeglobs \
37 $(MACH64)_gcc_map.noexeglobs
38
39 SYMS1= syms.1
40 SYMS2= syms.2
41 MAIN1= main.1
42 MAIN2= main.2
43
44 TEMPLATE1= map.noexeglobs.1.template
45 TEMPLATE2= map.noexeglobs.2.template
46
47 all install: $(FILES)
81 $(MACH64)_gcc_map.noexeglobs := LINK = $(LINK64.c)
82
83 # This generic target creates two dynamic executables from an empty "main"
84 # program. These objects are not executed, but are analyzed to determine the
85 # global symbols each provides.
86 #
87 # The first executable demotes a family of known interfaces to local and allows
88 # all other symbol definitions to remain global. This executables provides the
89 # base for discovering all symbol definitions provided by the various
90 # compilation environments. The second executable demotes all symbols to
91 # locals. Within both executables, some symbols remain globals (_end, _etext,
92 # etc.) as the link-editor has special knowledge of these symbols and their
93 # expected visibility requirements. By inspecting the deferences between the
94 # global symbols within the two executables, a mapfile can be generated to
95 # ensure the symbols defined by the compilation environments files remain
96 # global.
97
98 %map.noexeglobs:main.c $(TEMPLATE1) $(TEMPLATE2)
99 $(LINK) -o $(MAIN1) -M$(TEMPLATE1) main.c
100 $(ELFDUMP) -s -N.dynsym $(MAIN1) | $(EGREP) "WEAK|GLOB" | \
101 $(GREP) -v UNDEF | $(NAWK) '{print $$9 }' | $(SORT) > $(SYMS1)
102 $(LINK) -o $(MAIN2) -M$(TEMPLATE2) main.c
103 $(ELFDUMP) -s -N.dynsym $(MAIN2) | $(EGREP) "WEAK|GLOB" | \
104 $(GREP) -v UNDEF | $(NAWK) '{print $$9 }' | $(SORT) > $(SYMS2)
105 $(ECHO) "# GENERATED FILE - DO NOT EDIT" > $@
106 $(GREP) MAP-HEAD $(TEMPLATE2) | \
107 $(SED) -e "s/ *# MAP-HEAD//" >> $@
108 $(DIFF) $(SYMS1) $(SYMS2) | $(GREP) "^<" | \
109 $(SED) -e "s/^< \(.*\)/ \1;/" >> $@
110 $(GREP) MAP-TAIL $(TEMPLATE2) | \
111 $(SED) -e "s/ *# MAP-TAIL//" >> $@
112 $(RM) $(SYMS1) $(SYMS2) $(MAIN1) $(MAIN2)
|
6 # You may not use this file except in compliance with the License.
7 #
8 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 # or http://www.opensolaris.org/os/licensing.
10 # See the License for the specific language governing permissions
11 # and limitations under the License.
12 #
13 # When distributing Covered Code, include this CDDL HEADER in each
14 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 # If applicable, add the following below this CDDL HEADER, with the
16 # fields enclosed by brackets "[]" replaced with your own identifying
17 # information: Portions Copyright [yyyy] [name of copyright owner]
18 #
19 # CDDL HEADER END
20 #
21
22 #
23 # Copyright 2007 Sun Microsystems, Inc. All rights reserved.
24 # Use is subject to license terms.
25 #
26
27 include $(SRC)/Makefile.master
28
29 FILES= \
30 $(MACH)_cc_map.noexeglobs \
31 $(MACH)_gcc_map.noexeglobs
32
33 $(BUILD64)FILES += \
34 $(MACH64)_cc_map.noexeglobs \
35 $(MACH64)_gcc_map.noexeglobs
36
37 SYMS1= syms.1
38 SYMS2= syms.2
39 MAIN1= main.1
40 MAIN2= main.2
41
42 TEMPLATE1= map.noexeglobs.1.template
43 TEMPLATE2= map.noexeglobs.2.template
44
45 all install: $(FILES)
79 $(MACH64)_gcc_map.noexeglobs := LINK = $(LINK64.c)
80
81 # This generic target creates two dynamic executables from an empty "main"
82 # program. These objects are not executed, but are analyzed to determine the
83 # global symbols each provides.
84 #
85 # The first executable demotes a family of known interfaces to local and allows
86 # all other symbol definitions to remain global. This executables provides the
87 # base for discovering all symbol definitions provided by the various
88 # compilation environments. The second executable demotes all symbols to
89 # locals. Within both executables, some symbols remain globals (_end, _etext,
90 # etc.) as the link-editor has special knowledge of these symbols and their
91 # expected visibility requirements. By inspecting the deferences between the
92 # global symbols within the two executables, a mapfile can be generated to
93 # ensure the symbols defined by the compilation environments files remain
94 # global.
95
96 %map.noexeglobs:main.c $(TEMPLATE1) $(TEMPLATE2)
97 $(LINK) -o $(MAIN1) -M$(TEMPLATE1) main.c
98 $(ELFDUMP) -s -N.dynsym $(MAIN1) | $(EGREP) "WEAK|GLOB" | \
99 $(GREP) -v UNDEF | $(AWK) '{print $$9 }' | $(SORT) > $(SYMS1)
100 $(LINK) -o $(MAIN2) -M$(TEMPLATE2) main.c
101 $(ELFDUMP) -s -N.dynsym $(MAIN2) | $(EGREP) "WEAK|GLOB" | \
102 $(GREP) -v UNDEF | $(AWK) '{print $$9 }' | $(SORT) > $(SYMS2)
103 $(ECHO) "# GENERATED FILE - DO NOT EDIT" > $@
104 $(GREP) MAP-HEAD $(TEMPLATE2) | \
105 $(SED) -e "s/ *# MAP-HEAD//" >> $@
106 $(DIFF) $(SYMS1) $(SYMS2) | $(GREP) "^<" | \
107 $(SED) -e "s/^< \(.*\)/ \1;/" >> $@
108 $(GREP) MAP-TAIL $(TEMPLATE2) | \
109 $(SED) -e "s/ *# MAP-TAIL//" >> $@
110 $(RM) $(SYMS1) $(SYMS2) $(MAIN1) $(MAIN2)
|