This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
fix pr4303
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: binutils at sourceware dot org
- Date: Wed, 3 Oct 2007 21:02:35 +0930
- Subject: fix pr4303
Setting all symbols created by .stab directives to BSF_DEBUGGING
stops various hackery in other parts of the aout code. In particular,
the aout symbol type is preserved.
PR 4303
* stabs.c (aout_process_stab): Set BSF_DEBUGGING.
Index: gas/stabs.c
===================================================================
RCS file: /cvs/src/src/gas/stabs.c,v
retrieving revision 1.29
diff -u -p -r1.29 stabs.c
--- gas/stabs.c 24 Aug 2007 21:49:55 -0000 1.29
+++ gas/stabs.c 3 Oct 2007 11:06:44 -0000
@@ -164,6 +164,8 @@ aout_process_stab (what, string, type, o
symbol_append (symbol, symbol_lastP, &symbol_rootP, &symbol_lastP);
+ symbol_get_bfdsym (symbol)->flags |= BSF_DEBUGGING;
+
S_SET_TYPE (symbol, type);
S_SET_OTHER (symbol, other);
S_SET_DESC (symbol, desc);
The following patch, which I don't intend to commit, sets the correct
bfd section from the symbol type. The idea being to make N_TEXT and
N_DATA and similar symbol values relative to their sections. However,
N_SET* symbols needed some further adjustments and I ran out of
enthusiasm.
Index: gas/stabs.c
===================================================================
RCS file: /cvs/src/src/gas/stabs.c,v
retrieving revision 1.29
diff -u -p -r1.29 stabs.c
--- gas/stabs.c 24 Aug 2007 21:49:55 -0000 1.29
+++ gas/stabs.c 3 Oct 2007 09:43:08 -0000
@@ -132,6 +132,9 @@ get_stab_string_offset (const char *stri
#define OBJ_PROCESS_STAB(SEG,W,S,T,O,D) aout_process_stab(W,S,T,O,D)
#endif
+#undef NO_RELOC
+#include "aout/aout64.h"
+
/* Here instead of obj-aout.c because other formats use it too. */
void
aout_process_stab (what, string, type, other, desc)
@@ -164,6 +167,62 @@ aout_process_stab (what, string, type, o
symbol_append (symbol, symbol_lastP, &symbol_rootP, &symbol_lastP);
+ if ((type & ~(N_TYPE | N_EXT)) == 0)
+ {
+ asection *s;
+
+ switch (type & (N_TYPE | N_EXT))
+ {
+ case N_WEAKU:
+ case N_UNDF:
+ case N_UNDF | N_EXT:
+ s = &bfd_und_section;
+ break;
+ case N_WARNING:
+ case N_WEAKA:
+ case N_SETA:
+ case N_SETA | N_EXT:
+ case N_ABS:
+ case N_ABS | N_EXT:
+ default:
+ s = &bfd_abs_section;
+ break;
+ case N_WEAKT:
+ case N_SETT:
+ case N_SETT | N_EXT:
+ case N_FN:
+ case N_FN_SEQ:
+ case N_TEXT:
+ case N_TEXT | N_EXT:
+ s = obj_textsec (stdoutput);
+ break;
+ case N_WEAKD:
+ case N_SETD:
+ case N_SETD | N_EXT:
+ case N_SETV:
+ case N_SETV | N_EXT:
+ case N_DATA:
+ case N_DATA | N_EXT:
+ s = obj_datasec (stdoutput);
+ break;
+ case N_WEAKB:
+ case N_SETB:
+ case N_SETB | N_EXT:
+ case N_BSS:
+ case N_BSS | N_EXT:
+ s = obj_bsssec (stdoutput);
+ break;
+ case N_INDR:
+ case N_INDR | N_EXT:
+ s = &bfd_ind_section;
+ break;
+ case N_COMM:
+ case N_COMM | N_EXT:
+ s = &bfd_com_section;
+ break;
+ }
+ S_SET_SEGMENT (symbol, s);
+ }
symbol_get_bfdsym (symbol)->flags |= BSF_DEBUGGING;
S_SET_TYPE (symbol, type);
--
Alan Modra
Australia Development Lab, IBM