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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libgcc/] [mkmap-flat.awk] - Blame information for rev 779

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

Line No. Rev Author Line
1 734 jeremybenn
# Generate a flat list of symbols to export.
2
#       Copyright (C) 2007, 2008, 2009, 2011  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
# Options:
22
#   "-v leading_underscore=1" : Symbols in map need leading underscore.
23
#   "-v osf_export=1"         : Create -input file for Tru64 UNIX linker
24
#                               instead of map file.
25
#   "-v pe_dll=1"             : Create .DEF file for Windows PECOFF
26
#                               DLL link instead of map file.
27
 
28
BEGIN {
29
  state = "nm";
30
  excluding = 0;
31
  if (leading_underscore)
32
    prefix = "_";
33
  else
34
    prefix = "";
35
}
36
 
37
# Remove comment and blank lines.
38
/^ *#/ || /^ *$/ {
39
  next;
40
}
41
 
42
# We begin with nm input.  Collect the set of symbols that are present
43
# so that we can elide undefined symbols.
44
 
45
state == "nm" && /^%%/ {
46
  state = "ver";
47
  next;
48
}
49
 
50
state == "nm" && ($1 == "U" || $2 == "U") {
51
  next;
52
}
53
 
54
state == "nm" && NF == 3 {
55
  def[$3] = 1;
56
  next;
57
}
58
 
59
state == "nm" {
60
  next;
61
}
62
 
63
# Now we process a simplified variant of the Solaris symbol version
64
# script.  We have one symbol per line, no semicolons, simple markers
65
# for beginning and ending each section, and %inherit markers for
66
# describing version inheritance.  A symbol may appear in more than
67
# one symbol version, and the last seen takes effect.
68
# The magic version name '%exclude' causes all the symbols given that
69
# version to be dropped from the output (unless a later version overrides).
70
 
71
NF == 3 && $1 == "%inherit" {
72
  next;
73
}
74
 
75
NF == 2 && $2 == "{" {
76
  if ($1 == "%exclude")
77
    excluding = 1;
78
  next;
79
}
80
 
81
$1 == "}" {
82
  excluding = 0;
83
  next;
84
}
85
 
86
{
87
  sym = prefix $1;
88
  if (excluding)
89
    delete export[sym];
90
  else
91
    export[sym] = 1;
92
  next;
93
}
94
 
95
END {
96
 
97
  if (pe_dll) {
98
    print "LIBRARY " pe_dll;
99
    print "EXPORTS";
100
  }
101
 
102
  for (sym in export)
103
    if (def[sym] || (pe_dll && def["_" sym])) {
104
      if (!osf_export)
105
        print sym;
106
      else
107
        print "-exported_symbol " sym;
108
    }
109
}

powered by: WebSVN 2.1.0

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