OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [mkmap-symver.awk] - Blame information for rev 154

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 38 julius
# Generate an ELF symbol version map a-la Solaris and GNU ld.
2
#       Copyright (C) 2007  Free Software Foundation, Inc.
3
#       Contributed by Richard Henderson <rth@cygnus.com>
4
#
5
# This file is part of GCC.
6
#
7
# GCC is free software; you can redistribute it and/or modify it under
8
# the terms of the GNU General Public License as published by the Free
9
# Software Foundation; either version 3, or (at your option) any later
10
# version.
11
#
12
# GCC is distributed in the hope that it will be useful, but WITHOUT
13
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14
# or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
15
# License for more details.
16
#
17
# You should have received a copy of the GNU General Public License
18
# along with GCC; see the file COPYING3.  If not see
19
# <http://www.gnu.org/licenses/>.
20
 
21
BEGIN {
22
  state = "nm";
23
  sawsymbol = 0;
24
  if (leading_underscore)
25
    prefix = "_";
26
  else
27
    prefix = "";
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 not emit them into the final version script -- Solaris
37
# complains at us if we do.
38
 
39
state == "nm" && /^%%/ {
40
  state = "ver";
41
  next;
42
}
43
 
44
state == "nm" && ($1 == "U" || $2 == "U") {
45
  next;
46
}
47
 
48
state == "nm" && NF == 3 {
49
  def[$3] = 1;
50
  sawsymbol = 1;
51
  next;
52
}
53
 
54
state == "nm" {
55
  next;
56
}
57
 
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).
65
 
66
NF == 3 && $1 == "%inherit" {
67
  inherit[$2] = $3;
68
  next;
69
}
70
 
71
NF == 2 && $2 == "{" {
72
  if ($1 != "%exclude")
73
    libs[$1] = 1;
74
  thislib = $1;
75
  next;
76
}
77
 
78
$1 == "}" {
79
  thislib = "";
80
  next;
81
}
82
 
83
{
84
  sym = prefix $1;
85
  if (thislib != "%exclude")
86
    ver[sym] = thislib;
87
  else
88
    delete ver[sym];
89
  next;
90
}
91
 
92
END {
93
  if (!sawsymbol)
94
    {
95
      print "No symbols seen -- broken or mis-installed nm?" | "cat 1>&2";
96
      exit 1;
97
    }
98
  for (l in libs)
99
    output(l);
100
}
101
 
102
function output(lib) {
103
  if (done[lib])
104
    return;
105
  done[lib] = 1;
106
  if (inherit[lib])
107
    output(inherit[lib]);
108
 
109
  empty=1
110
  for (sym in ver)
111
    if ((ver[sym] == lib) && (sym in def))
112
      {
113
        if (empty)
114
          {
115
            printf("%s {\n", lib);
116
            printf("  global:\n");
117
            empty = 0;
118
          }
119
        printf("\t%s;\n", sym);
120
      }
121
 
122
  if (empty)
123
    {
124
      for (l in libs)
125
        if (inherit[l] == lib)
126
          inherit[l] = inherit[lib];
127
    }
128
  else if (inherit[lib])
129
    printf("} %s;\n", inherit[lib]);
130
  else
131
    printf ("\n  local:\n\t*;\n};\n");
132
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.