aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Schlemmer <azarah@gentoo.org>2005-12-05 08:13:19 +0000
committerMartin Schlemmer <azarah@gentoo.org>2005-12-05 08:13:19 +0000
commite4105c76a843423e4aa50a91db71d39d6881e5aa (patch)
tree9c1ea50f1475a1824dfe573e70bcef5debe9f359 /scripts
parentStop processing when we get to the '.symtab' section. (diff)
downloadsandbox-e4105c76a843423e4aa50a91db71d39d6881e5aa.tar.gz
sandbox-e4105c76a843423e4aa50a91db71d39d6881e5aa.tar.bz2
sandbox-e4105c76a843423e4aa50a91db71d39d6881e5aa.zip
Also add weak symbols.
Signed-off-by: Martin Schlemmer <azarah@gentoo.org>
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");