From f98c52b11f4e679c10bc97047c3f332c4948274b Mon Sep 17 00:00:00 2001
From: Gavriel State <gav@transgaming.com>
Date: Tue, 12 Feb 2002 18:46:14 +0000
Subject: [PATCH] Some older versions of GDB need to have the filename data
 available for each section, so we need to output it again for the data
 section.

---
 tools/winebuild/relay.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/tools/winebuild/relay.c b/tools/winebuild/relay.c
index 145bdfd6052..b944c90d910 100644
--- a/tools/winebuild/relay.c
+++ b/tools/winebuild/relay.c
@@ -1136,6 +1136,8 @@ static void BuildCallFrom32Regs( FILE *outfile )
  */
 void BuildRelays16( FILE *outfile )
 {
+    char buffer[1024];
+
     /* File header */
 
     fprintf( outfile, "/* File generated automatically. Do not edit! */\n\n" );
@@ -1144,7 +1146,6 @@ void BuildRelays16( FILE *outfile )
 #ifdef USE_STABS
     if (output_file_name)
     {
-        char buffer[1024];
         getcwd(buffer, sizeof(buffer));
         fprintf( outfile, "\t.file\t\"%s\"\n", output_file_name );
 
@@ -1197,6 +1198,15 @@ void BuildRelays16( FILE *outfile )
 #ifdef USE_STABS
     fprintf( outfile, "\t.stabs \"\",100,0,0,.Letext\n");
     fprintf( outfile, ".Letext:\n");
+
+    /* Some versions of gdb need to have the filename data for
+       each section, so output it again for the data section. */
+    if (output_file_name)
+    {
+        fprintf( outfile, ".stabs \"%s/\",100,0,0,Data_Start\n", buffer);
+        fprintf( outfile, ".stabs \"%s\",100,0,0,Data_Start\n", output_file_name );
+        fprintf( outfile, "Data_Start:\n\n" );
+    }
 #endif
 
     /* The whole Call16_Ret segment must lie within the .data section */
-- 
GitLab