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

Contents of /trunk/scripts/gen_symbol_header.awk

Parent Directory Parent Directory | Revision Log Revision Log


Revision 198 - (show annotations) (download)
Thu Dec 1 12:01:33 2005 UTC (8 years, 7 months ago) by azarah
File size: 1927 byte(s)
Some comment touch-ups.
1 BEGIN {
2 COUNT = split(ENVIRON["SYMBOLS"], SYMBOLS);
3 }
4
5 {
6 for (x in SYMBOLS) {
7 sym_regex = "^" SYMBOLS[x] "(@|$)"
8 if ($8 ~ sym_regex) {
9 split($8, symbol_array, /@|@@/);
10
11 SYMBOL_LIST[symbol_array[1]] = SYMBOL_LIST[symbol_array[1]] " " $8;
12 }
13 }
14 }
15
16 END {
17 printf("#ifndef __symbols_h\n");
18 printf("#define __symbols_h\n\n");
19
20 # We use the order in SYMBOLS, as some wrappers depends on others ...
21 for (i = 1; i <= COUNT; i++) {
22 sym_index = SYMBOLS[i];
23 split(SYMBOL_LIST[sym_index], sym_full_names);
24
25 for (x in sym_full_names) {
26 split(sym_full_names[x], symbol_array, /@|@@/);
27
28 # Defualt symbol have '@@' and not '@', so name it by
29 # prepending '__' rather than the symbol version so
30 # that we know what the name is in libsandbox.c ...
31 # Also do this for non-versioned libc's ...
32 if (sym_full_names[x] ~ /@@/ || !symbol_array[2]) {
33 sym_real_name = "__" sym_index;
34 } else {
35 sym_real_name = sym_full_names[x];
36 gsub(/@|\./, "_", sym_real_name);
37 }
38
39 printf("#define symname_%s \"%s\"\n", sym_real_name, sym_index);
40
41 # We handle non-versioned libc's by setting symver_*
42 # to NULL ...
43 if (!symbol_array[2])
44 printf("#define symver_%s NULL\n", sym_real_name);
45 else
46 printf("#define symver_%s \"%s\"\n", sym_real_name,
47 symbol_array[2]);
48
49 printf("%s_decl(%s);\n", sym_index, sym_real_name);
50
51 if (symbol_array[2]) {
52 # Only add symbol versions for versioned libc's
53 if (sym_full_names[x] ~ /@@/)
54 printf("default_symbol_version(%s, %s, %s);\n",
55 sym_real_name, sym_index, symbol_array[2]);
56 else
57 printf("symbol_version(%s, %s, %s);\n",
58 sym_real_name, sym_index, symbol_array[2]);
59 } else {
60 # For non-versioned libc's we use strong aliases
61 printf("strong_alias(%s, %s);\n", sym_real_name,
62 sym_index);
63 }
64
65 printf("\n");
66 }
67 }
68
69 printf("#endif /* __symbols_h */\n");
70 }

  ViewVC Help
Powered by ViewVC 1.1.20