Comment 28 for bug 1567219

Revision history for this message
In , Ivo Raisr (ivosh-d) wrote :

Thank you for providing the patches.

I get the same compilation problem on Solaris
because Elf32/64_Chdr come from the VKI interface.

I think the problem lies here in coregrind/m_debuginfo/readelf.c:
============================
+#if !defined(Elf32_Chdr)
+ typedef struct {
+ Elf32_Word ch_type;
+ Elf32_Word ch_size;
+ Elf32_Word ch_addralign;
+ } Elf32_Chdr;
+#endif
...
============================

However it is incorrect to assume that a typedef can be checked via #if defined().
Morever, such definitions should be placed in the corresponding vki-* header files
(if really necessary).
After removing Elf32_Chdr, Elf64_Chdr, SHF_COMPRESSED and ELFCOMPRESS_ZLIB from
readelf.c, the patches compile fine and regression testing went ok on Solaris.

It would be also nice if a simple test is provided. Ideally the configure would check if the
corresponding command line option is supported and has an effect. Then it would enable/disable the test based on its availability.

Definitions of MINIZ_LITTLE_ENDIAN and MINIZ_HAS_64BIT_REGISTERS (possibly others) need to be consistent across the board. Currently these are set in image.c and tinfl.c itself, based on different criteria. Stick to those in image.c.

Also placing tinfl.c directly into coregrind is not appropriate. If m_debuginfo is the only
consumer than tinfl.c needs to be moved there. If not, then pub_core_tinfl.h needs to present
a proper Valgrind interface usable and understandable by other parts of the core, not the tinfl.c mess.