From: Michal M. <ak...@ja...> - 2012-08-10 12:31:51
|
Hello, I'm trying to get elftoolchain to work on Bitrig, an OpenBSD fork. Elftoolchain compiles after applying the attached patch, but strip seems to have a bug. Here is the difference between a binary stripped with gnu strip, and elftoolchain strip: $ diff dump.elf dump.gnu 73,77c73,77 < p_offset: 120128 < p_vaddr: 0x81d540 < p_paddr: 0x81d540 < p_filesz: 0 < p_memsz: 0 --- > p_offset: 119216 > p_vaddr: 0x71d1b0 > p_paddr: 0x71d1b0 > p_filesz: 912 > p_memsz: 912 83,87c83,87 < p_offset: 119216 < p_vaddr: 0x71d1b0 < p_paddr: 0x71d1b0 < p_filesz: 912 < p_memsz: 10504 --- > p_offset: 120128 > p_vaddr: 0x81d540 > p_paddr: 0x81d540 > p_filesz: 0 > p_memsz: 9592 - two sections are swapped, and their p_memsz are wrong. This results in a segfault. After stripping the binary a second time there is another difference: $ diff dump.elf dump.elfelf 74,75c74,75 < p_vaddr: 0x81d540 < p_paddr: 0x81d540 --- > p_vaddr: 0x71d540 > p_paddr: 0x71d540 - running this binary results in an Abort trap. The same applies to OpenBSD. -- Michal Mazurek |