[PATCH] Fix localplt check for GNU_IFUNC
Adhemerval Zanella
azanella@linux.vnet.ibm.com
Sat Mar 8 18:39:00 GMT 2014
While reviewing the strncat optimization for powerpc64 I noted in the
disassembled object that a call to strlen (bl strlen) generates a PLT
call to strlen (since now strlen is an IFUNC for powerpc64). Strangely
it was not being caught by check-localplt testcase.
GNU_IFUNC are shown by readelf in 'Relocation section' value as (symbol)
instead of expected hexadecimal value. This causes the check-localplt
script to igore potential PLT stub begin generated by wrong IFUNC usage.
This patch changes the localplt script to emit such PLT cases.
Checked on PPC64 and X86_64.
--
2014-03-03 Adhemerval Zanella <azanella@linux.vnet.ibm.com>
* scripts/localplt.awk: Do not ignore IFUNC relocation while parsing
relocation sections.
---
diff --git a/scripts/localplt.awk b/scripts/localplt.awk
index 2265b02..5e38073 100644
--- a/scripts/localplt.awk
+++ b/scripts/localplt.awk
@@ -32,9 +32,15 @@ $1 == "Offset" && $2 == "Info" { in_relocs = 1; next }
NF == 0 { in_relocs = 0 }
in_relocs && relocs_offset == jmprel_offset && NF >= 5 {
- symval = strtonum("0x" $4);
- if (symval != 0)
+ # Relocations against GNU_IFUNC symbols are not shown as an hexadecimal
+ # value, but rather as the resolver symbol name between ().
+ if ($4 ~ /\(.*\)/) {
print whatfile, $5
+ } else {
+ symval = strtonum("0x" $4);
+ if (symval != 0)
+ print whatfile, $5
+ }
}
in_relocs { next }
More information about the Libc-alpha
mailing list