This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix as --gdwarf-2 on Windows i386 PECOFF


The --gdwarf-2 option to as has never worked on PECOFF.  The DWARF-2
.debug_* sections are assumed to be based at zero, something that is
impossible on PE.  Brian Ford added the new secrel32 relocation type to
fix this, but support was never added to gas for assembly debugging.

This patch adds this support by defining TC_DWARF2_EMIT_OFFSET.  It also
adjusts O_secrel to a value and location consistant with other
machine-dependent relocation types.

I've tested that this patch causes correct debugging to be emitted on
i686-pc-mingw32 against a recent mainline GDB.

Aaron W. LaFramboise
2004-10-17  Aaron W. LaFramboise <aaron98wiridge9@aaronwl.com>

	* config/tc-i386.c (O_secrel): Move.
	(tc_pe_dwarf2_emit_offset): New.
	* config/tc-i386.h (O_secrel): Moved to here and value changed
	to O_md1.
	* TC_DWARF2_EMIT_OFFSET: New.

Index: src/gas/config/tc-i386.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-i386.c,v
retrieving revision 1.157
diff -c -3 -p -r1.157 tc-i386.c
*** src/gas/config/tc-i386.c	8 Oct 2004 13:55:04 -0000	1.157
--- src/gas/config/tc-i386.c	18 Oct 2004 04:39:24 -0000
*************** x86_cons (exp, size)
*** 3658,3665 ****
  
  #ifdef TE_PE
  
- #define O_secrel (O_max + 1)
- 
  void
  x86_pe_cons_fix_new (frag, off, len, exp)
       fragS *frag;
--- 3658,3663 ----
*************** i386_elf_section_type (const char *str, 
*** 6360,6362 ****
--- 6358,6371 ----
  
    return -1;
  }
+ 
+ void 
+ tc_pe_dwarf2_emit_offset (symbolS *symbol, unsigned int size)
+ {
+   expressionS expr;
+ 
+   expr.X_op = O_secrel;
+   expr.X_add_symbol = symbol;
+   expr.X_add_number = 0;
+   emit_expr (&expr, size);
+ }  
Index: src/gas/config/tc-i386.h
===================================================================
RCS file: /cvs/src/src/gas/config/tc-i386.h,v
retrieving revision 1.49
diff -c -3 -p -r1.49 tc-i386.h
*** src/gas/config/tc-i386.h	8 Oct 2004 13:55:04 -0000	1.49
--- src/gas/config/tc-i386.h	18 Oct 2004 04:39:26 -0000
*************** extern void tc_x86_frame_initial_instruc
*** 505,508 ****
--- 505,517 ----
  #define md_elf_section_type(str,len) i386_elf_section_type (str, len)
  extern int i386_elf_section_type PARAMS ((const char *, size_t len));
  
+ #ifdef TE_PE
+ 
+ #define O_secrel O_md1
+ 
+ #define TC_DWARF2_EMIT_OFFSET  tc_pe_dwarf2_emit_offset
+ void tc_pe_dwarf2_emit_offset (symbolS *, unsigned int);
+ 
+ #endif /* TE_PE */
+ 
  #endif /* TC_I386 */

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]