/* coff object file format
- Copyright (C) 1989, 90, 91, 92, 93, 94, 95, 96, 97, 98, 1999
+ Copyright (C) 1989, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000
Free Software Foundation, Inc.
This file is part of GAS.
static void obj_coff_tag PARAMS ((int));
static void obj_coff_val PARAMS ((int));
static void obj_coff_type PARAMS ((int));
+static void obj_coff_ident PARAMS ((int));
#ifdef BFD_ASSEMBLER
static void obj_coff_loc PARAMS((int));
#endif
static void
add_lineno (frag, offset, num)
fragS *frag;
- int offset;
+ addressT offset;
int num;
{
struct line_no *new_line =
if (num <= 0)
{
/* Zero is used as an end marker in the file. */
- as_bad (_("Line numbers must be positive integers\n"));
- return;
+ as_warn (_("Line numbers must be positive integers\n"));
+ num = 1;
}
new_line->next = line_nos;
new_line->frag = frag;
add_lineno (frag_now, frag_now_fix (), lineno);
}
+/* Handle the .ident pseudo-op. */
+
+static void
+obj_coff_ident (ignore)
+ int ignore ATTRIBUTE_UNUSED;
+{
+ segT current_seg = now_seg;
+ subsegT current_subseg = now_subseg;
+
+#ifdef TE_PE
+ {
+ segT sec;
+
+ /* We could put it in .comment, but that creates an extra section
+ that shouldn't be loaded into memory, which requires linker
+ changes... For now, until proven otherwise, use .rdata. */
+ sec = subseg_new (".rdata$zzz", 0);
+ bfd_set_section_flags (stdoutput, sec,
+ ((SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_DATA)
+ & bfd_applicable_section_flags (stdoutput)));
+ }
+#else
+ subseg_new (".comment", 0);
+#endif
+
+ stringer (1);
+ subseg_set (current_seg, current_subseg);
+}
+
/*
* def()
*
for (; i > 0; i--)
{
if (lptr->frag)
- lptr->l.u.offset += lptr->frag->fr_address;
+ lptr->l.u.offset += lptr->frag->fr_address / OCTETS_PER_BYTE;
l[i] = lptr->l;
lptr = lptr->next;
}
&& sec != bss_section)
return;
secsym = section_symbol (sec);
+ /* This is an estimate; we'll plug in the real value using
+ SET_SECTION_RELOCS later */
SA_SET_SCN_NRELOC (secsym, nrelocs);
SA_SET_SCN_NLINNO (secsym, nlnno);
}
char *p;
fragS *fragp;
bfd_vma size, n_entries, mask;
+ bfd_vma align_power = (bfd_vma)sec->alignment_power + OCTETS_PER_BYTE_POWER;
/* The COFF back end in BFD requires that all section sizes be
- rounded up to multiples of the corresponding section alignments.
- Seems kinda silly to me, but that's the way it is. */
+ rounded up to multiples of the corresponding section alignments,
+ supposedly because standard COFF has no other way of encoding alignment
+ for sections. If your COFF flavor has a different way of encoding
+ section alignment, then skip this step, as TICOFF does. */
size = bfd_get_section_size_before_reloc (sec);
- mask = ((bfd_vma) 1 << (bfd_vma) sec->alignment_power) - 1;
+ mask = ((bfd_vma) 1 << align_power) - 1;
+#if !defined(TICOFF)
if (size & mask)
{
size = (size + mask) & ~mask;
bfd_set_section_size (stdoutput, sec, size);
}
+#endif
/* If the section size is non-zero, the section symbol needs an aux
entry associated with it, indicating the size. We don't know
all the values yet; coff_frob_symbol will fill them in later. */
+#ifndef TICOFF
if (size != 0
|| sec == text_section
|| sec == data_section
|| sec == bss_section)
+#endif
{
symbolS *secsym = section_symbol (sec);
static void obj_coff_lcomm PARAMS ((int));
static void obj_coff_text PARAMS ((int));
static void obj_coff_data PARAMS ((int));
-static void obj_coff_ident PARAMS ((int));
void obj_coff_section PARAMS ((int));
/* When not using BFD_ASSEMBLER, we permit up to 40 sections.
#endif /* not BFD_ASSEMBLER */
-const pseudo_typeS obj_pseudo_table[] =
+const pseudo_typeS coff_pseudo_table[] =
{
{"def", obj_coff_def, 0},
{"dim", obj_coff_dim, 0},
earlier versions of gas. */
{"bss", obj_coff_bss, 0},
{"weak", obj_coff_weak, 0},
+ {"ident", obj_coff_ident, 0},
#ifndef BFD_ASSEMBLER
{"use", obj_coff_section, 0},
{"text", obj_coff_text, 0},
{"data", obj_coff_data, 0},
{"lcomm", obj_coff_lcomm, 0},
- {"ident", obj_coff_ident, 0},
#else
{"optim", s_ignore, 0}, /* For sun386i cc (?) */
- {"ident", s_ignore, 0}, /* we don't yet handle this. */
#endif
{"version", s_ignore, 0},
{"ABORT", s_abort, 0},
{"sdef", obj_coff_def, 0},
#endif
{NULL, NULL, 0} /* end sentinel */
-}; /* obj_pseudo_table */
+}; /* coff_pseudo_table */
\f
#ifdef BFD_ASSEMBLER
-static void coff_pop_insert PARAMS ((void));
-static int coff_sec_sym_ok_for_reloc PARAMS ((asection *));
-
/* Support for a COFF emulation. */
+static void coff_pop_insert PARAMS ((void));
+
static void
coff_pop_insert ()
{
- pop_insert (obj_pseudo_table);
-}
-
-static int
-coff_sec_sym_ok_for_reloc (sec)
- asection *sec ATTRIBUTE_UNUSED;
-{
- return 0;
+ pop_insert (coff_pseudo_table);
}
const struct format_ops coff_format_ops =
{
bfd_target_coff_flavour,
- 0,
- 1,
+ 0, /* dfl_leading_underscore */
+ 1, /* emit_section_symbols */
coff_frob_symbol,
- 0,
+ 0, /* frob_file */
coff_frob_file_after_relocs,
- 0, 0,
- 0, 0,
- 0,
-#if 0
- obj_generate_asm_lineno,
-#else
- 0,
-#endif
-#if 0
- obj_stab,
-#else
- 0,
-#endif
- coff_sec_sym_ok_for_reloc,
+ 0, /* s_get_size */
+ 0, /* s_set_size */
+ 0, /* s_get_align */
+ 0, /* s_set_align */
+ 0, /* s_get_other */
+ 0, /* s_get_desc */
+ 0, /* copy_symbol_attributes */
+ 0, /* generate_asm_lineno */
+ 0, /* process_stab */
+ 0, /* sec_sym_ok_for_reloc */
coff_pop_insert,
-#if 0
- obj_set_ext,
-#else
- 0,
-#endif
+ 0, /* ecoff_set_ext */
coff_obj_read_begin_hook,
- coff_obj_symbol_new_hook,
+ coff_obj_symbol_new_hook
};
#endif