On Wed, 2015-08-05 at 17:55 +0200, Kai Wasserbäch wrote: > So, if I've understood you correctly, you want an ELF dump of a Mesa build > linked against libelfg0 and one linked against libelf1. You can find the > generated files in the attached Tar archive. Please note, that the run with > libelf1 only produced two dumps before segfaulting.
That seems to confirm that the generation is the same (at least for the first two files). I was hoping to find a difference between parsing some of these files with an old/new libelf. So I wrote a little program that is just the parsing as radeon_elf_read () does. But found no difference. Maybe I am not testing against the right versions though (they are my local builds). Could you compile the following with: gcc -g -lelf -o elfrel elfrel.c and then run it against all these ELF files with the bad libelf like for i in 794488_elfs/libelf*/dump.elf.*; do ./elfrel $i; done For me the output looks like: file: 794488_elfs/libelf1/dump.elf.EL5kJT Nothing found file: 794488_elfs/libelf1/dump.elf.J4EnbO symbols: 5 1: not global or undefined 2: not global or undefined 3: not global or undefined 4: not global or undefined 5: 0 relocations: 2 0: 10, SCRATCH_RSRC_DWORD1 1: 2c, SCRATCH_RSRC_DWORD0 file: 794488_elfs/libelfg0/dump.elf.7NnBvc Nothing found file: 794488_elfs/libelfg0/dump.elf.ahPsJJ symbols: 5 1: not global or undefined 2: not global or undefined 3: not global or undefined 4: not global or undefined 5: 0 relocations: 2 0: 10, SCRATCH_RSRC_DWORD1 1: 2c, SCRATCH_RSRC_DWORD0 file: 794488_elfs/libelfg0/dump.elf.DYTjdO Nothing found file: 794488_elfs/libelfg0/dump.elf.Lke6Xg Nothing found Hopefully for you the output looks different with the bad (or good) libelf. Then I need to make sure I have the right bad/good version myself. Otherwise I need to dig a bit deeper to understand what is going wrong. Thanks, Mark $ cat elfrel.c #include <gelf.h> #include <stdio.h> #include <string.h> #include <inttypes.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> int main (int argc, char **argv) { elf_version(EV_CURRENT); printf ("file: %s\n", argv[1]); int fd = open (argv[1], O_RDONLY); Elf *elf = elf_begin (fd, ELF_C_READ, NULL); size_t section_str_index; elf_getshdrstrndx(elf, §ion_str_index); size_t reloc_count, symbol_sh_link, symbol_count; Elf_Data *relocs, *symbols; { const char *name; GElf_Shdr section_header; if (gelf_getshdr(section, §ion_header) != §ion_header) { fprintf(stderr, "Failed to read ELF section header\n"); return -1; } name = elf_strptr(elf, section_str_index, section_header.sh_name); if (strncmp(name, ".symtab", 7) == 0) { symbols = elf_getdata(section, NULL); symbol_sh_link = section_header.sh_link; symbol_count = section_header.sh_size / section_header.sh_entsize; } else if (strcmp (name, ".rel.text") == 0) { relocs = elf_getdata(section, NULL); reloc_count = section_header.sh_size / section_header.sh_entsize; } } if (!relocs || !symbols || !reloc_count) { printf("Nothing found\n"); return -1; } printf ("symbols: %zd\n", symbol_count); GElf_Sym symbol; size_t i = 0; while (gelf_getsym (symbols, i++, &symbol)) { if (GELF_ST_BIND(symbol.st_info) != STB_GLOBAL || symbol.st_shndx == 0) { printf ("%zd: not global or undefined\n", i); continue; } printf ("%zd: %" PRIx64 "\n", i, symbol.st_value); } printf ("relocations: %zd\n", reloc_count); for (size_t i = 0; i < reloc_count; i++) { GElf_Sym symbol; GElf_Rel rel; char *symbol_name; gelf_getrel(relocs, i, &rel); gelf_getsym(symbols, GELF_R_SYM(rel.r_info), &symbol); symbol_name = elf_strptr(elf, symbol_sh_link, symbol.st_name); printf ("%zd: %" PRIx64 ", %s\n", i, rel.r_offset, symbol_name); } return 0; } -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org