public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Set section vma for COFF in BFD gas
@ 2000-06-27 20:46 Mark E.
  0 siblings, 0 replies; 3+ messages in thread
From: Mark E. @ 2000-06-27 20:46 UTC (permalink / raw)
  To: binutils

Here I am again...

BFD gas does not set the section vma like !BFD gas already does for COFF targets. The 
patch below eliminates this difference. I excluded PE-COFF because I have no way to 
know if the change would cause breakage (from what I
I've been reading on the list, it certainly doesn't need any more help in that area).

GAS Changelog:

2000-06-27 Mark Elbrecht <snowball3@bigfoot.com>

	* write.c [BFD_ASSEMBLER && OBJ_COFF && !TE_PE] (set_segment_vma): New.
	Set vma and lma for a segment.
	(write_object_file) [BFD_ASSEMBLER && OBJ_COFF && !TE_PE]: Use it.

(I hope I formatted that correctly.)

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/27 23:30:31
*************** 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_PE)
+ 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_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
*************** write_object_file ()
*** 1479,1484 ****
--- 1496,1508 ----
  #else
    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
    /*


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Set section vma for COFF in BFD gas
@ 2000-06-29 15:52 Nick Clifton
  0 siblings, 0 replies; 3+ messages in thread
From: Nick Clifton @ 2000-06-29 15:52 UTC (permalink / raw)
  To: snowball3; +Cc: binutils

Hi Mark,

: 2000-06-27 Mark Elbrecht <snowball3@bigfoot.com>
: 
: 	* write.c [BFD_ASSEMBLER && OBJ_COFF && !TE_PE] (set_segment_vma): New.
: 	Set vma and lma for a segment.
: 	(write_object_file) [BFD_ASSEMBLER && OBJ_COFF && !TE_PE]: Use it.

Approved & applied.

Cheers
	Nick

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Set section vma for COFF in BFD gas
@ 2000-06-27 17:08 Mark E.
  0 siblings, 0 replies; 3+ messages in thread
From: Mark E. @ 2000-06-27 17:08 UTC (permalink / raw)
  To: binutils

Hello again...

BFD gas does not set the section vma like !BFD gas already does for COFF 
targets. The 
patch below eliminates this difference. I excluded PE-COFF because I have no 
way to 
know if the change would cause breakage (from what I
I've been reading on the list, it certainly doesn't need any more help in that 
area).

GAS Changelog:

2000-06-27 Mark Elbrecht <snowball3@bigfoot.com>

	* write.c [BFD_ASSEMBLER && OBJ_COFF && !TE_PE] (set_segment_vma): New.
	Set vma and lma for a segment.
	(write_object_file) [BFD_ASSEMBLER && OBJ_COFF && !TE_PE]: Use it.

(I hope I formatted that correctly.)

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/27 23:30:31
*************** 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_PE)
+ 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_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
*************** write_object_file ()
*** 1479,1484 ****
--- 1496,1508 ----
  #else
    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
    /*

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2000-06-29 15:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-06-27 20:46 Set section vma for COFF in BFD gas Mark E.
  -- strict thread matches above, loose matches on Subject: below --
2000-06-29 15:52 Nick Clifton
2000-06-27 17:08 Mark E.

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).