This is the mail archive of the
binutils@sourceware.cygnus.com
mailing list for the binutils project.
Set section vma for COFF in BFD gas [take 2]
- To: binutils at sourceware dot cygnus dot com
- Subject: Set section vma for COFF in BFD gas [take 2]
- From: "Mark E." <snowball3 at bigfoot dot com>
- Date: Wed, 28 Jun 2000 12:31:51 -0400
This version makes the set_section_vma code DJGPP specific and adds a comment that
other COFF targets that desire to work under BFD gas should execute that segment of
code too.
GAS Changelog:
2000-06-27 Mark Elbrecht <snowball3@bigfoot.com>
* write.c [BFD_ASSEMBLER && OBJ_COFF && TE_GO32] (set_segment_vma): New.
Set vma and lma for a segment.
(write_object_file) [BFD_ASSEMBLER && OBJ_COFF && TE_GO32]: Use it.
Index: src/gas/write.c
===================================================================
RCS file: /cvs/src/src/gas/write.c,v
retrieving revision 1.12
diff -c -p -r1.12 write.c
*** write.c 2000/04/03 12:05:31 1.12
--- write.c 2000/06/28 16:28:19
*************** static void remove_subsegs PARAMS ((frch
*** 133,138 ****
--- 133,142 ----
static void relax_and_size_all_segments PARAMS ((void));
#endif
+ #if defined (BFD_ASSEMBLER) && defined (OBJ_COFF) && defined (TE_GO32)
+ static void set_segment_vma PARAMS ((bfd *, asection *, PTR));
+ #endif
+
/*
* fix_new()
*
*************** set_symtab ()
*** 1348,1353 ****
--- 1352,1370 ----
}
#endif
+ #if defined (BFD_ASSEMBLER) && defined (OBJ_COFF) && defined (TE_GO32)
+ 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_GO32 */
+
/* 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
*************** write_object_file ()
*** 1479,1484 ****
--- 1496,1509 ----
#else
relax_and_size_all_segments ();
#endif /* BFD_ASSEMBLER */
+
+ #if defined (BFD_ASSEMBLER) && defined (OBJ_COFF) && defined (TE_GO32)
+ /* Now that the segments have their final sizes, run through the
+ sections and set their vma and lma. !BFD gas sets them, and BFD gas
+ should too. Currently, only DJGPP uses this code, but other
+ COFF targets may need to execute this too. */
+ bfd_map_over_sections (stdoutput, set_segment_vma, (char *) 0);
+ #endif /* BFD_ASSEMBLER && OBJ_COFF && TE_GO32 */
#ifndef BFD_ASSEMBLER
/*