]> gcc.gnu.org Git - gcc.git/blame - gcc/mkmap-flat.awk
trans-io.c (set_string): Use fold_build2 and build_int_cst instead of build2 and...
[gcc.git] / gcc / mkmap-flat.awk
CommitLineData
83dad10c
RH
1# Generate a flat list of symbols to export.
2# Contributed by Richard Henderson <rth@cygnus.com>
3#
1322177d 4# This file is part of GCC.
83dad10c 5#
1322177d
LB
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
9# version.
83dad10c 10#
1322177d
LB
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.
83dad10c
RH
15#
16# You should have received a copy of the GNU General Public License
1322177d 17# along with GCC; see the file COPYING. If not, write to the Free
366ccddb
KC
18# Software Foundation, 51 Franklin Street, Fifth Floor, Boston MA
19# 02110-1301, USA.
83dad10c
RH
20
21BEGIN {
22 state = "nm";
7c834753
ZW
23 excluding = 0;
24 if (leading_underscore)
25 prefix = "_";
26 else
27 prefix = "";
83dad10c
RH
28}
29
30# Remove comment and blank lines.
31/^ *#/ || /^ *$/ {
32 next;
33}
34
35# We begin with nm input. Collect the set of symbols that are present
36# so that we can elide undefined symbols.
37
38state == "nm" && /^%%/ {
39 state = "ver";
40 next;
41}
42
43state == "nm" && ($1 == "U" || $2 == "U") {
44 next;
45}
46
47state == "nm" && NF == 3 {
48 def[$3] = 1;
49 next;
50}
51
52state == "nm" {
53 next;
54}
55
56# Now we process a simplified variant of the Solaris symbol version
57# script. We have one symbol per line, no semicolons, simple markers
58# for beginning and ending each section, and %inherit markers for
59# describing version inheritence. A symbol may appear in more than
60# one symbol version, and the last seen takes effect.
7c834753
ZW
61# The magic version name '%exclude' causes all the symbols given that
62# version to be dropped from the output (unless a later version overrides).
83dad10c
RH
63
64NF == 3 && $1 == "%inherit" {
65 next;
66}
67
68NF == 2 && $2 == "{" {
7c834753
ZW
69 if ($1 == "%exclude")
70 excluding = 1;
83dad10c
RH
71 next;
72}
73
74$1 == "}" {
7c834753 75 excluding = 0;
83dad10c
RH
76 next;
77}
78
79{
7c834753
ZW
80 sym = prefix $1;
81 if (excluding)
82 delete export[sym];
83 else
84 export[sym] = 1;
83dad10c
RH
85 next;
86}
87
88END {
89 for (sym in export)
90 if (def[sym])
91 print sym;
92}
This page took 1.77473 seconds and 5 git commands to generate.