/[path-sandbox]/trunk/scripts/gen_symbol_version_map.awk
Gentoo

Contents of /trunk/scripts/gen_symbol_version_map.awk

Parent Directory Parent Directory | Revision Log Revision Log


Revision 213 - (show annotations) (download)
Mon Dec 5 07:17:51 2005 UTC (8 years, 8 months ago) by azarah
File size: 1803 byte(s)
Stop processing when we get to the '.symtab' section.
1 BEGIN {
2 split(ENVIRON["SYMBOLS"], SYMBOLS);
3 }
4
5 {
6 # Unstripped libc's have '.symtab' section as well, and
7 # we should stop processing when we hit that
8 if ($0 ~ "Symbol table '.symtab'")
9 nextfile;
10
11 for (x in SYMBOLS) {
12 sym_regex = "^" SYMBOLS[x] "(@|$)"
13 if ($8 ~ sym_regex) {
14 split($8, symbol_array, /@|@@/);
15
16 # Don't add local symbols of versioned libc's
17 if (VERSIONED_LIBC && !symbol_array[2])
18 continue;
19
20 # Handle non-versioned libc's like uClibc ...
21 if (!symbol_array[2])
22 symbol_array[2] = "";
23
24 # We have a versioned libc
25 if (symbol_array[2] && !VERSIONED_LIBC)
26 VERSIONED_LIBC = 1;
27
28 ADD = 1;
29 # Check that we do not add duplicates
30 for (x in PROCESSED_SYMBOLS) {
31 if (x == $8) {
32 ADD = 0;
33 break;
34 }
35 }
36
37 if (ADD) {
38 SYMBOL_LIST[symbol_array[2]] = SYMBOL_LIST[symbol_array[2]] " " symbol_array[1];
39 PROCESSED_SYMBOLS[$8] = $8;
40 }
41 }
42 }
43 }
44
45 END {
46 for (sym_version in SYMBOL_LIST) {
47 if (sym_version)
48 VERSIONS = VERSIONS " " sym_version;
49 }
50
51 # We need the symbol versions sorted alphabetically ...
52 if (VERSIONS) {
53 split(VERSIONS, VERSION_LIST);
54 COUNT = asort(VERSION_LIST);
55 } else {
56 # Handle non-versioned libc's like uClibc ...
57 COUNT = 1;
58 }
59
60 for (i = 1; i <= COUNT; i++) {
61 if (VERSION_LIST[i]) {
62 sym_version = VERSION_LIST[i];
63 printf("%s {\n", sym_version);
64 } else {
65 # Handle non-versioned libc's like uClibc ...
66 sym_version = "";
67 printf("{\n");
68 }
69
70 printf(" global:\n");
71
72 split(SYMBOL_LIST[sym_version], sym_names);
73
74 for (x in sym_names)
75 printf(" %s;\n", sym_names[x]);
76
77 if (!old_sym_version) {
78 printf(" local:\n");
79 printf(" *;\n");
80 printf("};\n");
81 } else {
82 printf("} %s;\n", old_sym_version);
83 }
84
85 old_sym_version = sym_version;
86 }
87 }

  ViewVC Help
Powered by ViewVC 1.1.20