1 # Generate an ELF symbol version map a-la Solaris and GNU ld.
2 # Contributed by Richard Henderson <rth@cygnus.com>
4 # This file is part of GCC.
6 # GCC is free software; you can redistribute it and/or modify it under
7 # the terms of the GNU General Public License as published by the Free
8 # Software Foundation; either version 2, or (at your option) any later
11 # GCC is distributed in the hope that it will be useful, but WITHOUT
12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
14 # License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with GCC; see the file COPYING. If not, write to the Free
18 # Software Foundation, 59 Temple Place - Suite 330, Boston MA
24 if (leading_underscore
)
30 # Remove comment and blank lines.
35 # We begin with nm input. Collect the set of symbols that are present
36 # so that we can not emit them into the final version script -- Solaris
37 # complains at us if we do.
39 state ==
"nm" && /^
%%/ {
44 state ==
"nm" && ($
1 ==
"U" || $
2 ==
"U") {
48 state ==
"nm" && NF ==
3 {
58 # Now we process a simplified variant of the Solaris symbol version
59 # script. We have one symbol per line, no semicolons, simple markers
60 # for beginning and ending each section, and %inherit markers for
61 # describing version inheritence. A symbol may appear in more than
62 # one symbol version, and the last seen takes effect.
63 # The magic version name '%exclude' causes all the symbols given that
64 # version to be dropped from the output (unless a later version overrides).
66 NF ==
3 && $
1 ==
"%inherit" {
71 NF ==
2 && $
2 ==
"{" {
85 if (thislib
!= "%exclude")
95 print "No symbols seen -- broken or mis-installed nm?" | "cat 1>&2";
102 function output
(lib
) {
107 output
(inherit
[lib
]);
111 if ((ver
[sym
] == lib
) && (sym in def
))
115 printf("%s {\n", lib
);
116 printf(" global:\n");
119 printf("\t%s;\n", sym
);
125 if (inherit
[l
] == lib
)
126 inherit
[l
] = inherit
[lib
];
128 else if (inherit
[lib
])
129 printf("} %s;\n", inherit
[lib
]);
131 printf ("\n local:\n\t*;\n};\n");