#include "gdb-stabs.h"
#include "stabsread.h"
#include "complaints.h"
+#include "target.h"
struct coff_symfile_info {
file_ptr min_lineno_offset; /* Where in file lowest line#s are */
/* FIXME: should use mst_abs, and not relocate, if absolute. */
enum minimal_symbol_type ms_type;
- int sec = cs_to_section (cs, objfile);
- tmpaddr = cs->c_value;
- if (cs->c_sclass != C_STAT)
- tmpaddr += ANOFFSET (section_offsets, sec);
- switch (sec)
+ int sec;
+
+ if (cs->c_secnum == N_UNDEF)
{
- case SECT_OFF_TEXT:
- case SECT_OFF_RODATA:
- ms_type = cs->c_sclass == C_STAT ? mst_file_text : mst_text;
- break;
- case SECT_OFF_DATA:
- ms_type = cs->c_sclass == C_STAT ? mst_file_data : mst_data;
- break;
- case SECT_OFF_BSS:
+ /* This is a common symbol. See if the target
+ environment knows where it has been relocated to. */
+ CORE_ADDR reladdr;
+ if (target_lookup_symbol (cs->c_name, &reladdr))
+ {
+ /* Error in lookup; ignore symbol. */
+ break;
+ }
+ tmpaddr = reladdr;
+ /* The address has already been relocated; make sure that
+ objfile_relocate doesn't relocate it again. */
+ sec = -2;
ms_type = cs->c_sclass == C_STAT ? mst_file_bss : mst_bss;
- break;
- default:
- ms_type = mst_unknown;
- break;
}
+ else
+ {
+ sec = cs_to_section (cs, objfile);
+ tmpaddr = cs->c_value;
+ if (cs->c_sclass != C_STAT)
+ tmpaddr += ANOFFSET (section_offsets, sec);
- record_minimal_symbol (cs->c_name, tmpaddr, ms_type, objfile);
- }
+ switch (sec)
+ {
+ case SECT_OFF_TEXT:
+ case SECT_OFF_RODATA:
+ ms_type =
+ cs->c_sclass == C_STAT ? mst_file_text : mst_text;
+ break;
+ case SECT_OFF_DATA:
+ ms_type =
+ cs->c_sclass == C_STAT ? mst_file_data : mst_data;
+ break;
+ case SECT_OFF_BSS:
+ ms_type =
+ cs->c_sclass == C_STAT ? mst_file_bss : mst_bss;
+ break;
+ default:
+ ms_type = mst_unknown;
+ break;
+ }
+ }
- if (SDB_TYPE (cs->c_type))
- process_coff_symbol (cs, &main_aux, section_offsets, objfile);
+ if (cs->c_name[0] != '@' /* Skip tdesc symbols */)
+ prim_record_minimal_symbol_and_info
+ (obsavestring (cs->c_name, strlen (cs->c_name),
+ &objfile->symbol_obstack),
+ tmpaddr,
+ ms_type,
+ NULL,
+ sec,
+ objfile);
+
+ if (SDB_TYPE (cs->c_type))
+ {
+ struct symbol *sym;
+ sym = process_coff_symbol
+ (cs, &main_aux, section_offsets, objfile);
+ SYMBOL_VALUE (sym) = tmpaddr;
+ SYMBOL_SECTION (sym) = sec;
+ }
+ }
break;
case C_FCN: