File ltrace.ppc32-c-option.patch of Package ltrace
bug 201272 - LTC24809
without the patch:
olaf@papaya:~> ltrace -c ./test32
% time seconds usecs/call calls function
------ ----------- ----------- --------- --------------------
100.00 0.000058 58 1 __gmon_start__
------ ----------- ----------- --------- --------------------
100.00 0.000058 1 total
olaf@papaya:~> ltrace64 -c ./test64
% time seconds usecs/call calls function
------ ----------- ----------- --------- --------------------
100.00 0.000067 67 1 getcwd
------ ----------- ----------- --------- --------------------
100.00 0.000067 1 total
with the patch:
olaf@papaya:~> ltrace -c ./test32
% time seconds usecs/call calls function
------ ----------- ----------- --------- --------------------
100.00 0.000062 62 1 getcwd
------ ----------- ----------- --------- --------------------
100.00 0.000062 1 total
olaf@papaya:~> ltrace64 -c ./test64
% time seconds usecs/call calls function
------ ----------- ----------- --------- --------------------
100.00 0.000065 65 1 getcwd
------ ----------- ----------- --------- --------------------
100.00 0.000065 1 total
---
elf.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
--- a/elf.c
+++ b/elf.c
@@ -523,10 +523,17 @@ struct library_symbol *read_elf(struct p
name = lte->dynstr + sym.st_name;
if (in_load_libraries(name, lte)) {
- addr = arch_plt_sym_val(lte, i, &rela);
- add_library_symbol(addr, name, &library_symbols,
- (PLTS_ARE_EXECUTABLE(lte)
- ? LS_TOPLT_EXEC : LS_TOPLT_POINT),
+ enum toplt pltt;
+ if (lte->ehdr.e_machine == EM_PPC) {
+ addr = sym.st_value;
+ pltt = LS_TOPLT_EXEC;
+ }
+ else {
+ addr = arch_plt_sym_val(lte, i, &rela);
+ pltt = (PLTS_ARE_EXECUTABLE(lte)
+ ? LS_TOPLT_EXEC : LS_TOPLT_POINT);
+ }
+ add_library_symbol(addr, name, &library_symbols, pltt,
ELF64_ST_BIND(sym.st_info) == STB_WEAK);
if (!lib_tail)
lib_tail = &(library_symbols->next);