Message-Id: <201506022055.t52KtjYm009133@delorie.com> Date: Tue, 02 Jun 2015 22:43:32 +0200 From: "Juan Manuel Guerrero (juan DOT guerrero AT gmx DOT de)" To: djgpp-announce AT delorie DOT com Subject: ANNOUNCE: release 2 of the DJGPP port of GNU binutils 2.25 uploaded. Content-Type: text/plain; charset=ISO-8859-15; format=flowed Reply-To: djgpp AT delorie DOT com This is a port of GNU binutils 2.25 to MSDOS/DJGPP. The GNU binutils are utilities of use when dealing with binary files, either object files or executables. These tools consist of the linker (ld), the assembler (gas), and the profiler (gprof). There is also a collection of other binary tools, including the disassembler (objdump). These tools make use of a pair of libraries (bfd and opcodes) and a common set of header files. DJGPP specific changes. ======================= - This is an bug fix update. This update provides all DJGPP specific features than presented in the previous release. Please see: http://www.delorie.com/archives/browse.cgi?p=djgpp-announce/2014/12/27/22:55:14 - The previous port has a bug that is not related to any DJGPP specific changes. This bug is a genuine binutils bug and can be reproduced by compiling the original code from binutils-2.25.tar.gz. The bug can be triggered by compiling a simple hello-world program. This program must be compiled using a freshly compiled libc.a from repository using the linker from binutils-2.25. The bug will not be triggered if some old libc.a from djdev204 djdev203 is used. Those libraries and crt0.o have been compiled with some old bug free version of binutils. It becomes impossible to debug the produced binary. If gdb is used to step through the code, the following error message will be displayed: C:\tmp\5>gdb a.exe GNU gdb (GDB) 7.7.1 Copyright (C) 2014 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "--host=i786-pc-msdosdjgpp --target=djgpp". Type "show configuration" for configuration details. For bug reporting instructions, please see: . Find the GDB manual and other documentation resources online at: . For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from a.exe...done. (gdb) b main Breakpoint 1 at 0x1f6a (gdb) r Starting program: c:/tmp/5/a.exe Breakpoint 1, 0x00001f6a in main () (gdb) s Single stepping until exit from function main, which has no line number information. qwertz 0x00004504 in __crt1_startup () (gdb) If the command objdump --dwarf a.exe is issued the following output is produced: a.exe: file format coff-go32-exe Contents of the .debug_aranges section: C:\DJGPP-2.04\BIN/objdump.exe: Warning: Bogus end-of-siblings marker detected at offset b1 in .debug_info section C:\DJGPP-2.04\BIN/objdump.exe: Warning: Bogus end-of-siblings marker detected at offset b2 in .debug_info section C:\DJGPP-2.04\BIN/objdump.exe: Warning: DIE at offset b3 refers to abbreviation number 3986 which does not exist Length: 28 Version: 2 Offset into .debug_info: 0x0 Pointer Size: 4 Segment Size: 0 [snip] Contents of the .debug_info section: Compilation Unit @ offset 0x0: Length: 0x46 (32-bit) Version: 2 Abbrev Offset: 0x0 Pointer Size: 4 <0>: Abbrev Number: 1 (DW_TAG_compile_unit) DW_AT_stmt_list : 0x0 <10> DW_AT_low_pc : 0x1a10 <14> DW_AT_high_pc : 0x1f27 <18> DW_AT_name : crt0.S <1f> DW_AT_comp_dir : c:/djgpp-O0-g2/src/libc/crt0 <3c> DW_AT_producer : GNU AS 2.25 <48> DW_AT_language : 32769 (MIPS assembler) Compilation Unit @ offset 0x4a: Length: 0x19f (32-bit) Version: 2 Abbrev Offset: 0x0 Pointer Size: 4 <0><55>: Abbrev Number: 1 (DW_TAG_compile_unit) <56> DW_AT_stmt_list : 0x20554e47 <5a> DW_AT_low_pc : 0x2e342043 <5e> DW_AT_high_pc : 0x20322e39 <62> DW_AT_name : -fpreprocessed -mtune=pentium -march=pentium -g3 -gdwarf-2 -O0 DW_AT_comp_dir : a.c DW_AT_producer : c:/tmp/5 DW_AT_language : 7984 (Unknown: 1f30) <0>: Abbrev Number: 0 C:\DJGPP-2.04\BIN/objdump.exe: Warning: Bogus end-of-siblings marker detected at offset b1 in .debug_info section C:\DJGPP-2.04\BIN/objdump.exe: Warning: Further warnings about bogus end-of-sibling markers suppressed <-1>: Abbrev Number: 0 <-2>: Abbrev Number: 3986 C:\DJGPP-2.04\BIN/objdump.exe: Warning: DIE at offset b3 refers to abbreviation number 3986 which does not exist Contents of the .debug_abbrev section: [snip] Offset: 0x6e0a Length: 78 DWARF Version: 2 Prologue Length: 58 Minimum Instruction Length: 1 Initial value of 'is_stmt': 1 Line Base: -5 Line Range: 14 Opcode Base: 13 [snip] C:\DJGPP-2.04\BIN/objdump.exe: Warning: Unable to load/parse the .debug_info section, so cannot interpret the .debug_loc section. C:\DJGPP-2.04\BIN/objdump.exe: Warning: Unable to load/parse the .debug_info section, so cannot interpret the .debug_ranges section. Contents of the .debug_macro section: [snip] Please note that I have intentionaly reduced the output of objdump. But I think that everyone can see that the debug info has been corrupted. Again, all this can be reproduced by using a stock DJGPP installation and compiling binutils out-of the-box. This malfunction has no relation to any DJGPP specific changes. Binutils 2.24 seems to work OK. An inspection of the git repository of binutils especialy a comparision between the binutil-2_25-branch/master and the binutil-2_24-branch shows that the function _bfd_coff_generic_relocate_section in bfd/cofflink.c has been modified by the following patch (55bfc9ac025c1c9cd1ad5422829b3dc70f357a79): Autor: Nick Clifton 2014-03-26 17:16:20 Eintragender: Nick Clifton 2014-03-26 17:16:20 Eltern: 318d3177f7d67dac94baa07aab04192fc7bcba49 (Remove VAR_DOMAIN/STRUCT_DOMAIN ambiguity from ada-tasks.c.) Kind: b3fe4307a625457c6953fce27bbbfc4c90e38e9d (Add support for %hi8, %hi16 and %lo16 being used when relocation are necessary.) Zweig: binutils-2_25-branch, master, remotes/origin/binutils-2_25-branch and many more (44) Folgt auf: binu_ss_19990502, readline_4_0 Vorgänger von: binutils-2_25, gdb-7.8-release, gdb-7.9.0-release, hjl/linux/release/2.24.51.0.4 This fixes a problem for 64-bit Cygwin, where building some packages can produce spurious errors about truncated relocations. The relocations are only truncated because they are being made against sections which are going to be discarded so that base address is zero instead of the expected 64-bit base value. * cofflink.c (_bfd_coff_generic_relocate_section): Skip relocations in discarded sections. @@ -3059,6 +3059,11 @@ _bfd_coff_generic_relocate_section (bfd *output_bfd, else { sec = sections[symndx]; + + /* If the output section has been discarded then ignore this reloc. */ + if (sec->output_section->vma == 0) + continue; + val = (sec->output_section->vma + sec->output_offset + sym->n_value); Because I am an DJGPP user and I do not care about 64-bit cygwin I have simple commented out the change and recompiled the sources to produce a working DJGPP port of binutils-2.25. Of course this must fixed in some other way. It should not be that to fix one system another system becomes broken. May be someone with inside in cygwin and djgpp cann give me a hint how to fix this or may be he sends the fix directly to the binutils mailing list. - Because the old port is brocken I have replaced it with this new one. This means that the only way to check if you are using the new port or the old one is by inspection of the time-stamp!!! As usual, all djgpp specific files (build.sh, diffs, README files, etc.) are located in the /djgpp directory. The sources have not been configured so you must change into the /djgpp directory and start build.sh. This will configure the sources and start make. For further information about Binutils please read the info docs and NEWS file. The port consists of the usual four packages that have been compiled using stock djdev203 and that can be downloaded from ftp.delorie.com and mirrors as (time stamp 2015-06-01): GNU binutils 2.25 binary and info format documentation: ftp://ftp.delorie.com/pub/djgpp/current/v2gnu/bnu225b.zip GNU binutils 2.25 bfd, liberty and opcode libraries and headers: ftp://ftp.delorie.com/pub/djgpp/current/v2gnu/bnu225a.zip GNU binutils 2.25 dvi, html, ps and pdf format documentation: ftp://ftp.delorie.com/pub/djgpp/current/v2gnu/bnu225d.zip GNU binutils 2.25 source: ftp://ftp.delorie.com/pub/djgpp/current/v2gnu/bnu225s.zip The binaries and library have been produced a second time using a libc.a version compiled from current repository code and patched with the new malloc code. This package is available at ftp.delorie.com and mirrors as (time stamp 2015-06-10): GNU binutils 2.25 binary and info format documentation: ftp://ftp.delorie.com/pub/djgpp/beta/v2gnu/bnu225.zip GNU binutils 2.25 bfd, liberty and opcode libraries and headers: ftp://ftp.delorie.com/pub/djgpp/beta/v2gnu/bnu225a.zip Send binutils specific bug reports to . Send suggestions and bug reports concerning the DJGPP port to comp.os.msdos.djgpp or . Enjoy. Guerrero, Juan Manuel