mkmap-flat.awk revision 90075
190075Sobrien# Generate a flat list of symbols to export. 290075Sobrien# Contributed by Richard Henderson <rth@cygnus.com> 390075Sobrien# 490075Sobrien# This file is part of GCC. 590075Sobrien# 690075Sobrien# GCC is free software; you can redistribute it and/or modify it under 790075Sobrien# the terms of the GNU General Public License as published by the Free 890075Sobrien# Software Foundation; either version 2, or (at your option) any later 990075Sobrien# version. 1090075Sobrien# 1190075Sobrien# GCC is distributed in the hope that it will be useful, but WITHOUT 1290075Sobrien# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 1390075Sobrien# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public 1490075Sobrien# License for more details. 1590075Sobrien# 1690075Sobrien# You should have received a copy of the GNU General Public License 1790075Sobrien# along with GCC; see the file COPYING. If not, write to the Free 1890075Sobrien# Software Foundation, 59 Temple Place - Suite 330, Boston MA 1990075Sobrien# 02111-1307, USA. 2090075Sobrien 2190075SobrienBEGIN { 2290075Sobrien state = "nm"; 2390075Sobrien} 2490075Sobrien 2590075Sobrien# Remove comment and blank lines. 2690075Sobrien/^ *#/ || /^ *$/ { 2790075Sobrien next; 2890075Sobrien} 2990075Sobrien 3090075Sobrien# We begin with nm input. Collect the set of symbols that are present 3190075Sobrien# so that we can elide undefined symbols. 3290075Sobrien 3390075Sobrienstate == "nm" && /^%%/ { 3490075Sobrien state = "ver"; 3590075Sobrien next; 3690075Sobrien} 3790075Sobrien 3890075Sobrienstate == "nm" && ($1 == "U" || $2 == "U") { 3990075Sobrien next; 4090075Sobrien} 4190075Sobrien 4290075Sobrienstate == "nm" && NF == 3 { 4390075Sobrien def[$3] = 1; 4490075Sobrien next; 4590075Sobrien} 4690075Sobrien 4790075Sobrienstate == "nm" { 4890075Sobrien next; 4990075Sobrien} 5090075Sobrien 5190075Sobrien# Now we process a simplified variant of the Solaris symbol version 5290075Sobrien# script. We have one symbol per line, no semicolons, simple markers 5390075Sobrien# for beginning and ending each section, and %inherit markers for 5490075Sobrien# describing version inheritence. A symbol may appear in more than 5590075Sobrien# one symbol version, and the last seen takes effect. 5690075Sobrien 5790075SobrienNF == 3 && $1 == "%inherit" { 5890075Sobrien next; 5990075Sobrien} 6090075Sobrien 6190075SobrienNF == 2 && $2 == "{" { 6290075Sobrien next; 6390075Sobrien} 6490075Sobrien 6590075Sobrien$1 == "}" { 6690075Sobrien next; 6790075Sobrien} 6890075Sobrien 6990075Sobrien{ 7090075Sobrien export[$1] = 1; 7190075Sobrien next; 7290075Sobrien} 7390075Sobrien 7490075SobrienEND { 7590075Sobrien for (sym in export) 7690075Sobrien if (def[sym]) 7790075Sobrien print sym; 7890075Sobrien} 79