aboutsummaryrefslogtreecommitdiff
path: root/gas/write.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2000-06-29 22:51:58 +0000
committerNick Clifton <nickc@redhat.com>2000-06-29 22:51:58 +0000
commitdbddefbfe6363a029d205c8118dc822548bcad3f (patch)
tree469107b2dc5698c01ede24625e7c19ed9a807595 /gas/write.c
parentcda43a1d52010f4381e7ce4f056431073c0104c8 (diff)
downloadgdb-dbddefbfe6363a029d205c8118dc822548bcad3f.zip
gdb-dbddefbfe6363a029d205c8118dc822548bcad3f.tar.gz
gdb-dbddefbfe6363a029d205c8118dc822548bcad3f.tar.bz2
Set vma and lma for segment when using the BFD_ASSEMBLER for COFF format files.
Diffstat (limited to 'gas/write.c')
-rw-r--r--gas/write.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/gas/write.c b/gas/write.c
index 5a5c45b..1f11f35 100644
--- a/gas/write.c
+++ b/gas/write.c
@@ -132,6 +132,9 @@ static void cvt_frag_to_fill PARAMS ((object_headers *, segT, fragS *));
static void remove_subsegs PARAMS ((frchainS *, int, fragS **, fragS **));
static void relax_and_size_all_segments PARAMS ((void));
#endif
+#if defined (BFD_ASSEMBLER) && defined (OBJ_COFF) && !defined (TE_PE)
+static void set_segment_vma PARAMS ((bfd *, asection *, PTR));
+#endif
/*
* fix_new()
@@ -1348,6 +1351,20 @@ set_symtab ()
}
#endif
+#if defined (BFD_ASSEMBLER) && defined (OBJ_COFF) && !defined (TE_PE)
+static void
+set_segment_vma (abfd, sec, xxx)
+ bfd *abfd;
+ asection *sec;
+ PTR xxx ATTRIBUTE_UNUSED;
+{
+ static bfd_vma addr = 0;
+
+ bfd_set_section_vma (abfd, sec, addr);
+ addr += bfd_section_size (abfd, sec);
+}
+#endif /* BFD_ASSEMBLER && OBJ_COFF && !TE_PE */
+
/* Finish the subsegments. After every sub-segment, we fake an
".align ...". This conforms to BSD4.2 brane-damage. We then fake
".fill 0" because that is the kind of frag that requires least
@@ -1480,6 +1497,13 @@ write_object_file ()
relax_and_size_all_segments ();
#endif /* BFD_ASSEMBLER */
+#if defined (BFD_ASSEMBLER) && defined (OBJ_COFF) && !defined (TE_PE)
+ /* Now that the segments have their final sizes, run through the
+ sections and set their vma and lma. The !BFD_ASSEMBLER case takes
+ care of this in write_object_file in config/obj-coff.c. */
+ bfd_map_over_sections (stdoutput, set_segment_vma, (char *) 0);
+#endif
+
#ifndef BFD_ASSEMBLER
/*
*