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

Diff of /trunk/scripts/gen_symbol_header.awk

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 387 Revision 388
34 if (y == $NF) { 34 if (y == $NF) {
35 ADD = 0; 35 ADD = 0;
36 break; 36 break;
37 } 37 }
38 } 38 }
39 39
40 if (ADD) { 40 if (ADD) {
41 SYMBOL_LIST[symbol_array[1]] = SYMBOL_LIST[symbol_array[1]] " " $NF; 41 SYMBOL_LIST[symbol_array[1]] = SYMBOL_LIST[symbol_array[1]] " " $NF;
42 PROCESSED_SYMBOLS[$NF] = $NF; 42 PROCESSED_SYMBOLS[$NF] = $NF;
43 } 43 }
44 } 44 }
45 45
46 sym_regex = "^__" SYMBOLS[x] "(@@|$)"; 46 sym_regex = "^__" SYMBOLS[x] "(@@|$)";
47 if (($5 == "WEAK") && ($NF ~ sym_regex)) { 47 if (($5 == "WEAK") && ($NF ~ sym_regex)) {
48 split($NF, symbol_array, /@@/); 48 split($NF, symbol_array, /@@/);
49 49
50 # Don't add local symbols of versioned libc's 50 # Don't add local symbols of versioned libc's
51 if (VERSIONED_LIBC && !symbol_array[2]) 51 if (VERSIONED_LIBC && !symbol_array[2])
52 continue; 52 continue;
53 53
54 # Blacklist __getcwd on FreeBSD 54 # Blacklist __getcwd on FreeBSD
66 if (y == $NF) { 66 if (y == $NF) {
67 ADD = 0; 67 ADD = 0;
68 break; 68 break;
69 } 69 }
70 } 70 }
71 71
72 if (ADD) { 72 if (ADD) {
73 WEAK_SYMBOLS[SYMBOLS[x]] = WEAK_SYMBOLS[SYMBOLS[x]] " " $NF; 73 WEAK_SYMBOLS[SYMBOLS[x]] = WEAK_SYMBOLS[SYMBOLS[x]] " " $NF;
74 PROCESSED_SYMBOLS[$NF] = $NF; 74 PROCESSED_SYMBOLS[$NF] = $NF;
75 } 75 }
76 } 76 }
83 83
84 # We use the order in SYMBOLS, as some wrappers depends on others ... 84 # We use the order in SYMBOLS, as some wrappers depends on others ...
85 for (i = 1; i <= COUNT; i++) { 85 for (i = 1; i <= COUNT; i++) {
86 sym_index = SYMBOLS[i]; 86 sym_index = SYMBOLS[i];
87 split(SYMBOL_LIST[sym_index], sym_full_names); 87 split(SYMBOL_LIST[sym_index], sym_full_names);
88 88
89 for (x in sym_full_names) { 89 for (x in sym_full_names) {
90 split(sym_full_names[x], symbol_array, /@|@@/); 90 split(sym_full_names[x], symbol_array, /@|@@/);
91 91
92 # Defualt symbol have '@@' and not '@', so name it by 92 # Defualt symbol have '@@' and not '@', so name it by
93 # prepending '__' rather than the symbol version so 93 # prepending '__' rather than the symbol version so
94 # that we know what the name is in libsandbox.c ... 94 # that we know what the name is in libsandbox.c ...
95 # Also do this for non-versioned libc's ... 95 # Also do this for non-versioned libc's ...
96 if (sym_full_names[x] ~ /@@/ || !symbol_array[2]) { 96 if (sym_full_names[x] ~ /@@/ || !symbol_array[2]) {
97 sym_real_name = sym_index "_DEFAULT"; 97 sym_real_name = sym_index "_DEFAULT";
98 } else { 98 } else {
99 sym_real_name = sym_full_names[x]; 99 sym_real_name = sym_full_names[x];
100 gsub(/@|\./, "_", sym_real_name); 100 gsub(/@|\./, "_", sym_real_name);
101 } 101 }
102 102
103 printf("#define symname_%s \"%s\"\n", sym_real_name, sym_index); 103 printf("#define symname_%s \"%s\"\n", sym_real_name, sym_index);
104 104
105 # We handle non-versioned libc's by setting symver_* 105 # We handle non-versioned libc's by setting symver_*
106 # to NULL ... 106 # to NULL ...
107 if (!symbol_array[2]) 107 if (!symbol_array[2])
108 printf("#define symver_%s NULL\n", sym_real_name); 108 printf("#define symver_%s NULL\n", sym_real_name);
109 else 109 else
110 printf("#define symver_%s \"%s\"\n", sym_real_name, 110 printf("#define symver_%s \"%s\"\n", sym_real_name,
111 symbol_array[2]); 111 symbol_array[2]);
112 112
113 printf("#define EXTERN_NAME %s\n", sym_index); 113 printf("#define EXTERN_NAME %s\n", sym_index);
114 printf("#define WRAPPER_NAME %s\n", sym_real_name); 114 printf("#define WRAPPER_NAME %s\n", sym_real_name);
115 printf("#define WRAPPER_TRUE_NAME true_%s\n", sym_real_name); 115 printf("#define WRAPPER_TRUE_NAME true_%s\n", sym_real_name);
116 printf("#define WRAPPER_SYMNAME symname_%s\n", sym_real_name); 116 printf("#define WRAPPER_SYMNAME symname_%s\n", sym_real_name);
117 printf("#define WRAPPER_SYMVER symver_%s\n", sym_real_name); 117 printf("#define WRAPPER_SYMVER symver_%s\n", sym_real_name);
119 printf("#undef EXTERN_NAME\n"); 119 printf("#undef EXTERN_NAME\n");
120 printf("#undef WRAPPER_NAME\n"); 120 printf("#undef WRAPPER_NAME\n");
121 printf("#undef WRAPPER_TRUE_NAME\n"); 121 printf("#undef WRAPPER_TRUE_NAME\n");
122 printf("#undef WRAPPER_SYMNAME\n"); 122 printf("#undef WRAPPER_SYMNAME\n");
123 printf("#undef WRAPPER_SYMVER\n"); 123 printf("#undef WRAPPER_SYMVER\n");
124 124
125 if (symbol_array[2]) { 125 if (symbol_array[2]) {
126 # Only add symbol versions for versioned libc's 126 # Only add symbol versions for versioned libc's
127 if (sym_full_names[x] ~ /@@/) 127 if (sym_full_names[x] ~ /@@/)
128 printf("default_symbol_version(%s, %s, %s);\n", 128 printf("default_symbol_version(%s, %s, %s);\n",
129 sym_real_name, sym_index, symbol_array[2]); 129 sym_real_name, sym_index, symbol_array[2]);
136 sym_index); 136 sym_index);
137 } 137 }
138 138
139 if (WEAK_SYMBOLS[sym_index]) { 139 if (WEAK_SYMBOLS[sym_index]) {
140 split(WEAK_SYMBOLS[sym_index], sym_weak_full); 140 split(WEAK_SYMBOLS[sym_index], sym_weak_full);
141 141
142 for (y in sym_weak_full) { 142 for (y in sym_weak_full) {
143 split(sym_weak_full[y], sym_weak_array, /@@/); 143 split(sym_weak_full[y], sym_weak_array, /@@/);
144 144
145 # Add weak symbols for libc's like glibc that 145 # Add weak symbols for libc's like glibc that
146 # have them 146 # have them
148 printf("weak_alias(%s, %s);\n", 148 printf("weak_alias(%s, %s);\n",
149 sym_real_name, 149 sym_real_name,
150 sym_weak_array[1]); 150 sym_weak_array[1]);
151 } 151 }
152 } 152 }
153 153
154 printf("\n"); 154 printf("\n");
155 } 155 }
156 } 156 }
157 157
158 printf("#endif /* __symbols_h */\n"); 158 printf("#endif /* __symbols_h */\n");

Legend:
Removed from v.387  
changed lines
  Added in v.388

  ViewVC Help
Powered by ViewVC 1.1.20