RHEL5 and Fedora 11 were not building due to the GNU attributes stuff,
cope with that using a define we know is not present in both RHEL5 and
Fedora 11 to #ifdef those parts. Ugly, but _ELFUTILS_PREREQ, i.e.
elfutils/version.h is not present in RHEL5 either.
Reported-by: Jon Stanley <jstanley@fedoraproject.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
More work is needed to use this information in dwarves_fprintf.c.
Reported-by: Josh Stone <jistone@redhat.com>
Reported-at: https://bugzilla.redhat.com/show_bug.cgi?id=654471
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Needed because it uses S_ISDIR. In the past this header probably was
being indirectly included. Noticed while building on RHEL6 Beta.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
To print all the function prototypes.
Based-on-patch-by: Rakesh Pandit <rakesh.pandit@gmail.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
- "-s section 0" doesn't really read the same as "-s section0"
- "--help" is something we should allow
- usage should say "scncopy" not "pjoc"
Signed-off-by: Peter Jones <pjones@redhat.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This adds scncopy, which is like objcopy with some differences:
- it doesn't try to update section contents, but does try to
update program headers and such to correctly reflect the section
contents.
- it doesn't necessarily try to create a binary eu-elflint will like.
If you don't copy a required section, it won't make it for you.
TODO:
- Make it possible to copy sections to an already existant binary.
- Make phdrs only copy if they're needed, and/or modify old phdrs to
point to new sections
- Make sure nothing is missing from fixup_dynamic()
Signed-off-by: Peter Jones <pjones@redhat.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
currently mandriva has a packaging script which checks for uneeded linking in
package built files. For dwarves, it displays:
Warning: unused libraries in /usr/lib64/libdwarves_reorganize.so.1.0.0: libdw.so.1
libelf.so.1
libz.so.1
Warning: unused libraries in /usr/lib64/libdwarves_emit.so.1.0.0: libdw.so.1
libelf.so.1
libz.so.1
Warning: unused libraries in /usr/bin/ctracer: libz.so.1
libdw.so.1
Warning: unused libraries in /usr/bin/syscse: libdw.so.1
libelf.so.1
libz.so.1
Warning: unused libraries in /usr/bin/pglobal: libdw.so.1
libelf.so.1
libz.so.1
Warning: unused libraries in /usr/bin/pdwtags: libdw.so.1
libelf.so.1
libz.so.1
Warning: unused libraries in /usr/bin/prefcnt: libdw.so.1
libelf.so.1
libz.so.1
Warning: unused libraries in /usr/bin/pfunct: libz.so.1
libdw.so.1
Warning: unused libraries in /usr/bin/pahole: libz.so.1
libdw.so.1
libelf.so.1
Warning: unused libraries in /usr/bin/dtagnames: libdw.so.1
libelf.so.1
libz.so.1
Warning: unused libraries in /usr/bin/codiff: libdw.so.1
libelf.so.1
libz.so.1
The patch below fixes the issue (removing uneeded specified libraries and using
LINK_INTERFACE_LIBRARIES property, see
http://www.cmake.org/Wiki/CMake_FAQ#Why_are_libraries_linked_to_my_shared_library_included_when_something_links_to_it.3F)
Signed-off-by: Herton Ronaldo Krzesinski <herton@mandriva.com.br>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
So make it a :4 u8 to combine with the previous bitfield. This field is
also seldom used so no expected perf hit.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Since we have two bytes after it in a hole, use them for vtable_entry,
hell knows if there isn't any crazy code with that many vtable
entries...
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
As we had 14 bits hole, so use them as bools, each taking one byte
but generating better/shorter code.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Description by Mark Wielaard:
Its a more compact expression of struct field offsets. Jakub already
backported it to the 4.4 gcc in rawhide.
http://gcc.gnu.org/ml/gcc-patches/2009-07/msg00437.html It simply means
that when you try to get the field offset based on a
DW_AT_data_member_location you would check dwarf_whatform() of the
attribute to see if it is a simple constant or a location expression
block/ptr.
Suggested-by: Mark Wielaard <mjw@redhat.com>
Reported-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
When dwarf_lowpc failed we were not initializing ->size, so garbage was
being left there and thing like 'pfunct --sizes' were producing
senseless results.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
As it is corrupting the obstack and it will be deleted completely at
cu__delete time anyway. Stick a FIXME tho, as it is good to completely
understand and fix this eventually.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
[acme@doppio pahole]$ pahole -F ctf /media/tb/debuginfo/usr/lib/debug/usr/bin/greycstoration4integration.debug > /tmp/bla
<ERROR(tag__size:837): detected type loop: type=572, tag=const_type>
<ERROR(tag__size:837): detected type loop: type=572, tag=const_type>
[acme@doppio pahole]$
These type loops are problems in the CTF encoding, that should be fixed, but
should not cause the core code to segfault on an infinite recursion.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
C++ is not properly supported in CTF anyway... And this was
causing a bug, so don't encode DW_TAG_inheritance entries.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
I.e.:
[acme@doppio pahole]$ cat tests/jengelh@medozas.de/const_const.c
struct x {
const char *const s;
} y;
int main(void)
{
return !y.s;
}
[acme@doppio pahole]$ pahole tests/jengelh@medozas.de/const_const
struct x {
char const * const s; /* 0 8 */
/* size: 8, cachelines: 1, members: 1 */
/* last cacheline: 8 bytes */
};
[acme@doppio pahole]$
One more reason to devote some time to RTT, i.e. Round Trip Testing, where
pahole will be used to regenerate the source code, then feed the result to
gcc -g, run again, use codiff, that should produce no diff.
Reported-by: Jan Engelhardt <jengelh@medozas.de>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
That asks dwarf_fprintf to always use "struct" in places where it would
use "class", because CTF doesn't have the "class" concept, so for
'regtest diffctf' sake, we use this.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
For now --encode_ctf/-Z only encodes the tags in the first object file
(CU) in a multi-obj/CU file, so for regtest sake, for now, introduce
this option.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>