FYI: fixup GNU_callsite strings
by Mark Wielaard
Hi,
I messed up the GNU_call_site TAG strings when I added the support. Here
is the trivial fix that I pushed.
Cheers,
Mark
12 years, 11 months
[PATCH] readelf.c: wrong branch prediction
by Marek Polacek
I've been playing with the debugpred and noticed, that every time when
running the eu-readelf -r, e.g., src/readelf -r src/readelf, we get:
readelf.c:1845: wrong=148, correct=0 <==== WARNING
If the prediction should be changed, here's a patch.
2011-05-15 Marek Polacek <mpolacek(a)redhat.com>
* readelf.c (handle_relocs_rela): Correct branch prediction.
--- elfutils/src/readelf.c.mp 2011-05-09 15:01:18.583423977 +0200
+++ elfutils/src/readelf.c 2011-05-15 12:44:50.170209204 +0200
@@ -1841,7 +1841,7 @@ handle_relocs_rela (Ebl *ebl, GElf_Ehdr
printf ("\
%#0*" PRIx64 " %-15s %#0*" PRIx64 " %+6" PRId64 " %s\n",
class == ELFCLASS32 ? 10 : 18, rel->r_offset,
- likely (ebl_reloc_type_check (ebl,
+ unlikely (ebl_reloc_type_check (ebl,
GELF_R_TYPE (rel->r_info)))
/* Avoid the leading R_ which isn't carrying any
information. */
12 years, 11 months
[PATCH] xmalloc.c: add unlikely ()
by Marek Polacek
Even though this should be handled by the gcc's tree_estimate_probability,
adding the unlikely () to conditions which are almost never true shouldn't
hurt either. Yes, it compiles. OK to apply?
2011-05-14 Marek Polacek <mpolacek(a)redhat.com>
* xmalloc.c (xmalloc, xcalloc, xrealloc): Add unlikely ().
--- elfutils/lib/xmalloc.c.mp 2011-05-14 04:35:36.343212076 +0200
+++ elfutils/lib/xmalloc.c 2011-05-14 04:38:35.313787891 +0200
@@ -1,5 +1,5 @@
/* Convenience functions for allocation.
- Copyright (C) 2006 Red Hat, Inc.
+ Copyright (C) 2006, 2011 Red Hat, Inc.
This file is part of Red Hat elfutils.
Red Hat elfutils is free software; you can redistribute it and/or modify
@@ -47,7 +47,7 @@ xmalloc (n)
void *p;
p = malloc (n);
- if (p == NULL)
+ if (unlikely (p == NULL))
error (EXIT_FAILURE, 0, _("memory exhausted"));
return p;
}
@@ -61,7 +61,7 @@ xcalloc (n, s)
void *p;
p = calloc (n, s);
- if (p == NULL)
+ if (unlikely (p == NULL))
error (EXIT_FAILURE, 0, _("memory exhausted"));
return p;
}
@@ -75,7 +75,7 @@ xrealloc (p, n)
size_t n;
{
p = realloc (p, n);
- if (p == NULL)
+ if (unlikely (p == NULL))
error (EXIT_FAILURE, 0, _("memory exhausted"));
return p;
}
12 years, 11 months
[PATCH] nm.c: Remove unused if/else
by Marek Polacek
FWIW, this removes the always true if and also the never executed else branch.
Maybe that unused branch is there for some particular reason, but if not,
I think it can be removed. Should I apply?
2011-05-10 Marek Polacek <mpolacek(a)redhat.com>
* nm.c (show_symbols_sysv): Remove unused if branch.
--- elfutils/src/nm.c.mp 2011-05-07 18:19:10.355146087 +0200
+++ elfutils/src/nm.c 2011-05-10 22:27:51.838447583 +0200
@@ -762,10 +762,7 @@ show_symbols_sysv (Ebl *ebl, GElf_Word s
int digits = length_map[gelf_getclass (ebl->elf) - 1][radix];
/* We always print this prolog. */
- if (prefix == NULL || 1)
- printf (gettext ("\n\nSymbols from %s:\n\n"), fullname);
- else
- printf (gettext ("\n\nSymbols from %s[%s]:\n\n"), prefix, fname);
+ printf (gettext ("\n\nSymbols from %s:\n\n"), fullname);
/* The header line. */
printf (gettext ("%*s%-*s %-*s Class Type %-*s %*s Section\n\n"),
12 years, 11 months
[PATCH] unstrip.c: Mark function as static
by Marek Polacek
The function `compare_sections_nonrel' most probably should be marked
as static. It is used nowhere else. Tested on x86_64-redhat-linux. OK?
2011-05-07 Marek Polacek <mpolacek(a)redhat.com>
* unstrip.c (compare_sections_nonrel): Mark this function as static.
diff --git a/src/unstrip.c b/src/unstrip.c
index 3283d73..69c3775 100644
--- a/src/unstrip.c
+++ b/src/unstrip.c
@@ -706,7 +706,7 @@ compare_sections_rel (const void *a, const void *b)
return compare_sections (a, b, true);
}
-int
+static int
compare_sections_nonrel (const void *a, const void *b)
{
return compare_sections (a, b, false);
12 years, 11 months
FYI: Merged master into dwarf branch
by Mark Wielaard
Hi,
I merged master into the dwarf branch to get the latest fixes (in
particular the dwarf_child fix for type units) on the branch.
No difficulties, just needed to merge the additional tests in the
Makefile.am file. See commit e88df5.
Cheers,
Mark
12 years, 12 months
[Patch] Add support for printing SDT elf notes.
by Mark Wielaard
Hi,
Another small addition to make it possible to print the new sdt elf
notes that are appearing in more and more binaries these days. The
format is fairly simple to parse and has been added to the appropriate
libebl functions. ebl_object_note_type_name () has been changed to also
take the name of the note as argument, to facilitate printing the type
depending on name.
libebl/
* libebl.h (ebl_object_note_type_name): Add const char *name arg.
* eblhooks.h (object_note_type_name): Likewise.
* eblopenbackend.c (default_object_note_type_name): Likewise.
* eblobjnotetypename.c (ebl_object_note_type_name): Likewise.
And print version if name is "stapsdt".
* eblobjnote.c (ebl_object_note): Add output for "stapsdt" notes.
src/
* readelf.c (handle_notes_data): Call ebl_object_note_type_name
with note name.
Sample output of readelf -n:
Note section [35] '.note.stapsdt' of 708 bytes at offset 0x1c0:
Owner Data size Type
stapsdt 51 Version: 3
PC: 0x2f690, Base: 0x158368, Semaphore: 0
Provider: libc, Name: setjmp, Args: '4@%eax -4@4+4(%esp) 4@%ecx'
stapsdt 44 Version: 3
PC: 0x2f730, Base: 0x158368, Semaphore: 0
Provider: libc, Name: setjmp, Args: '4@%eax -4@$1 4@%ecx'
stapsdt 44 Version: 3
PC: 0x2f772, Base: 0x158368, Semaphore: 0
Provider: libc, Name: setjmp, Args: '4@%edx -4@$0 4@%ecx'
stapsdt 50 Version: 3
PC: 0x2f80e, Base: 0x158368, Semaphore: 0
Provider: libc, Name: longjmp, Args: '4@%eax -4@8(%esp) 4@%edx'
stapsdt 57 Version: 3
PC: 0x2f81a, Base: 0x158368, Semaphore: 0
Provider: libc, Name: longjmp_target, Args: '4@%eax -4@8(%esp) 4@%edx'
stapsdt 51 Version: 3
[...]
Please let me know if you see any issues with the implementation before
I commit it. Patch attached and on the mjw/sdt git branch.
Thanks,
Mark
12 years, 12 months