This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH] Fix localplt check for GNU_IFUNC
- From: Adhemerval Zanella <azanella at linux dot vnet dot ibm dot com>
- To: "GNU C. Library" <libc-alpha at sourceware dot org>
- Date: Sat, 08 Mar 2014 15:39:26 -0300
- Subject: [PATCH] Fix localplt check for GNU_IFUNC
- Authentication-results: sourceware.org; auth=none
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 }