aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/gen_symbol_header.awk57
-rw-r--r--scripts/gen_symbol_version_map.awk49
2 files changed, 99 insertions, 7 deletions
diff --git a/scripts/gen_symbol_header.awk b/scripts/gen_symbol_header.awk
index f87d891..6c14c92 100644
--- a/scripts/gen_symbol_header.awk
+++ b/scripts/gen_symbol_header.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, /@|@@/);
@@ -23,8 +23,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;
}
@@ -35,6 +35,33 @@ 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;
+
+ # 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[SYMBOLS[x]] = WEAK_SYMBOLS[SYMBOLS[x]] " " $8;
+ PROCESSED_SYMBOLS[$8] = $8;
+ }
+ }
}
}
@@ -86,6 +113,30 @@ END {
printf("strong_alias(%s, %s);\n", sym_real_name,
sym_index);
}
+
+ if (WEAK_SYMBOLS[sym_index]) {
+ split(WEAK_SYMBOLS[sym_index], sym_weak_full);
+
+ for (y in sym_weak_full) {
+ split(sym_weak_full[y], sym_weak_array, /@|@@/);
+
+ # Make sure for unversioned libc's that the
+ # variable is valid ...
+ if (!symbol_array[2])
+ symbol_array[2] = "";
+ if (!sym_weak_array[2])
+ sym_weak_array[2] = "";
+
+ # Add weak symbols for libc's like glibc that
+ # have them
+ if ((sym_weak_array[1] == "__" sym_index) &&
+ (sym_weak_array[2] == symbol_array[2])) {
+ printf("weak_alias(%s, %s);\n",
+ sym_real_name,
+ "__" sym_index);
+ }
+ }
+ }
printf("\n");
}
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");