https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=801120c1f402f9b0f72b5a231bf9e1cf82614cac

commit 801120c1f402f9b0f72b5a231bf9e1cf82614cac
Author: Corinna Vinschen <[email protected]>
Date:   Fri Aug 27 14:26:42 2021 +0200

    Cygwin: loader script: add DWARF 5 sections
    
    Modern gcc's generate additional DWARF 5 debug sections, which were
    still missing in our Cygwin loader script.  With ld from binutils 2.37,
    this results in diagnostic output when linking the Cygwin DLL...
    
      ld: cygwin0.dll:/4: section below image base
      ld: cygwin0.dll:/20: section below image base
      ld: cygwin0.dll:/36: section below image base
    
    ...and the section addresses given to these sections (.debug_loclists,
    .debug_rnglists, debug_line_str) will be wrong.
    
    Fix this by adding the missing DWARF 5 sections to our linker script
    template cygwin.sc.in.  Add a comment in terms of the deprecated
    DWARF 4 section .debug_types.
    
    Signed-off-by: Corinna Vinschen <[email protected]>
    Signed-off-by: Jon Turney <[email protected]>

Diff:
---
 winsup/cygwin/cygwin.sc.in | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/winsup/cygwin/cygwin.sc.in b/winsup/cygwin/cygwin.sc.in
index 134ae3f76..293d2ab25 100644
--- a/winsup/cygwin/cygwin.sc.in
+++ b/winsup/cygwin/cygwin.sc.in
@@ -178,8 +178,13 @@ SECTIONS
   .debug_typenames ALIGN(__section_alignment__) (NOLOAD) : { 
*(.debug_typenames) }
   .debug_varnames  ALIGN(__section_alignment__) (NOLOAD) : { 
*(.debug_varnames) }
   .debug_macro    ALIGN(__section_alignment__) (NOLOAD) : { *(.debug_macro) }
-  /* DWARF 3. */
+  /* DWARF 3 */
   .debug_ranges   ALIGN(__section_alignment__) (NOLOAD) : { *(.debug_ranges) }
-  /* DWARF 4. */
+  /* DWARF 4, merged back into .debug_info with DWARF 5 */
   .debug_types   ALIGN(__section_alignment__) (NOLOAD) : { *(.debug_types 
.gnu.linkonce.wt.*) }
+  /* DWARF 5 */
+  .debug_loclists ALIGN(__section_alignment__) (NOLOAD) : { *(.debug_loclists) 
}
+  .debug_rnglists ALIGN(__section_alignment__) (NOLOAD) : { *(.debug_rnglists) 
}
+  .debug_line_str ALIGN(__section_alignment__) (NOLOAD) : { *(.debug_line_str) 
}
+
 }

Reply via email to