aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/gen_symbol_version_map.awk')
-rw-r--r--scripts/gen_symbol_version_map.awk49
1 files changed, 45 insertions, 4 deletions
diff --git a/scripts/gen_symbol_version_map.awk b/scripts/gen_symbol_version_map.awk
index d13efaf..c236d67 100644
--- a/scripts/gen_symbol_version_map.awk
+++ b/scripts/gen_symbol_version_map.awk
@@ -9,7 +9,7 @@ BEGIN {
nextfile;
for (x in SYMBOLS) {
- sym_regex = "^" SYMBOLS[x] "(@|$)"
+ sym_regex = "^" SYMBOLS[x] "(@|$)";
if ($8 ~ sym_regex) {
split($8, symbol_array, /@|@@/);
@@ -27,8 +27,8 @@ BEGIN {
ADD = 1;
# Check that we do not add duplicates
- for (x in PROCESSED_SYMBOLS) {
- if (x == $8) {
+ for (y in PROCESSED_SYMBOLS) {
+ if (y == $8) {
ADD = 0;
break;
}
@@ -39,6 +39,37 @@ BEGIN {
PROCESSED_SYMBOLS[$8] = $8;
}
}
+
+ sym_regex = "^__" SYMBOLS[x] "(@|$)";
+ if (($5 == "WEAK") && ($8 ~ sym_regex)) {
+ split($8, symbol_array, /@|@@/);
+
+ # Don't add local symbols of versioned libc's
+ if (VERSIONED_LIBC && !symbol_array[2])
+ continue;
+
+ # Handle non-versioned libc's like uClibc ...
+ if (!symbol_array[2])
+ symbol_array[2] = "";
+
+ # We have a versioned libc
+ if (symbol_array[2] && !VERSIONED_LIBC)
+ VERSIONED_LIBC = 1;
+
+ ADD = 1;
+ # Check that we do not add duplicates
+ for (y in PROCESSED_SYMBOLS) {
+ if (y == $8) {
+ ADD = 0;
+ break;
+ }
+ }
+
+ if (ADD) {
+ WEAK_SYMBOLS[symbol_array[2]] = WEAK_SYMBOLS[symbol_array[2]] " " symbol_array[1];
+ PROCESSED_SYMBOLS[$8] = $8;
+ }
+ }
}
}
@@ -71,8 +102,18 @@ END {
split(SYMBOL_LIST[sym_version], sym_names);
- for (x in sym_names)
+ for (x in sym_names) {
printf(" %s;\n", sym_names[x]);
+
+ split(WEAK_SYMBOLS[sym_version], sym_weak_names);
+
+ for (y in sym_weak_names) {
+ # Add weak symbols for libc's like glibc that
+ # have them
+ if (sym_weak_names[y] == "__" sym_names[x])
+ printf(" %s;\n", sym_weak_names[y]);
+ }
+ }
if (!old_sym_version) {
printf(" local:\n");