public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* bfd_read and bfd_write
@ 2001-09-04 22:20 Alan Modra
  2001-09-05  9:45 ` Andrew Cagney
  2001-09-05 20:13 ` Hans-Peter Nilsson
  0 siblings, 2 replies; 22+ messages in thread
From: Alan Modra @ 2001-09-04 22:20 UTC (permalink / raw)
  To: binutils; +Cc: gdb-patches

I have a (rather large) patch to clean up a few things in bfd that I'd
like to apply in the next day or so, but first thought I'd better give
people fair warning and a chance to object.

One of the changes I've made is to bfd_read, and similarly bfd_write.

 bfd_size_type
-bfd_read (ptr, size, nitems, abfd)
+bfd_read (ptr, size, abfd)
      PTR ptr;
      bfd_size_type size;
-     bfd_size_type nitems;
      bfd *abfd;

Why the change?  Well, in having both "size" and "nitems", you'd expect
bfd_read to behave like fread, but it doesn't.  bfd_read returns
"size * nitems" on success, whereas fread returns "nitems".  Additionally,
many places in bfd swap the "size" and "nitems" args, and technically
we should always have size == 1 since we are operating on files of bytes.
This doesn't really matter as bfd_read does the multiplication and
passes size == 1 down to fread, but we're breaking the fread abstraction.

This change will of course break gdb, for which I have patches, and
any uncontributed ports.

Comments/flames?

Alan

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

* Re: bfd_read and bfd_write
  2001-09-04 22:20 bfd_read and bfd_write Alan Modra
@ 2001-09-05  9:45 ` Andrew Cagney
  2001-09-05 12:21   ` Richard Henderson
  2001-09-05 20:13 ` Hans-Peter Nilsson
  1 sibling, 1 reply; 22+ messages in thread
From: Andrew Cagney @ 2001-09-05  9:45 UTC (permalink / raw)
  To: Alan Modra; +Cc: binutils, gdb-patches

> I have a (rather large) patch to clean up a few things in bfd that I'd
> like to apply in the next day or so, but first thought I'd better give
> people fair warning and a chance to object.
> 
> One of the changes I've made is to bfd_read, and similarly bfd_write.
> 
>  bfd_size_type
> -bfd_read (ptr, size, nitems, abfd)
> +bfd_read (ptr, size, abfd)
>       PTR ptr;
>       bfd_size_type size;
> -     bfd_size_type nitems;
>       bfd *abfd;


rather than change the function signature, why not introduce a new 
interface and then deprecate the old one?


> 


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

* Re: bfd_read and bfd_write
  2001-09-05  9:45 ` Andrew Cagney
@ 2001-09-05 12:21   ` Richard Henderson
  2001-09-05 17:26     ` Andrew Cagney
  0 siblings, 1 reply; 22+ messages in thread
From: Richard Henderson @ 2001-09-05 12:21 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: Alan Modra, binutils, gdb-patches

On Wed, Sep 05, 2001 at 12:45:10PM -0400, Andrew Cagney wrote:
> rather than change the function signature, why not introduce a new 
> interface and then deprecate the old one?

Because then you'll never get rid of the old interface.
BFD already has way too much cruft as it is.


r~

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

* Re: bfd_read and bfd_write
  2001-09-05 12:21   ` Richard Henderson
@ 2001-09-05 17:26     ` Andrew Cagney
  2001-09-05 18:52       ` Alan Modra
  0 siblings, 1 reply; 22+ messages in thread
From: Andrew Cagney @ 2001-09-05 17:26 UTC (permalink / raw)
  To: Richard Henderson; +Cc: Alan Modra, binutils, gdb-patches

> On Wed, Sep 05, 2001 at 12:45:10PM -0400, Andrew Cagney wrote:
> 
>> rather than change the function signature, why not introduce a new 
>> interface and then deprecate the old one?
> 
> 
> Because then you'll never get rid of the old interface.
why not introduce the new _external_ interface, go around eliminating 
all known uses of the old.  once done (new release made?) zap the old 
interface.  a common pratice is to add code to the old interface to 
issue a warning the first time it is called.

alan's basic problem of needing to co-ordinate everything so it can all 
happen at once just goes away.

it also covers the k&r problem - you cant rely on a k&r compiler to 
report parameter mismatches.

andrew


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

* Re: bfd_read and bfd_write
  2001-09-05 17:26     ` Andrew Cagney
@ 2001-09-05 18:52       ` Alan Modra
  2001-09-05 20:03         ` Andrew Cagney
  2001-09-05 23:15         ` bfd_read and bfd_write Andreas Jaeger
  0 siblings, 2 replies; 22+ messages in thread
From: Alan Modra @ 2001-09-05 18:52 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: binutils, gdb-patches

On Wed, Sep 05, 2001 at 08:26:26PM -0400, Andrew Cagney wrote:
> > On Wed, Sep 05, 2001 at 12:45:10PM -0400, Andrew Cagney wrote:
> > 
> >> rather than change the function signature, why not introduce a new 
> >> interface and then deprecate the old one?
> > 
> > 
> > Because then you'll never get rid of the old interface.
> why not introduce the new _external_ interface, go around eliminating 
> all known uses of the old.  once done (new release made?) zap the old 
> interface.  a common pratice is to add code to the old interface to 
> issue a warning the first time it is called.
> 
> alan's basic problem of needing to co-ordinate everything so it can all 
> happen at once just goes away.

I have patches for all of bfd, gas, gdb.  Shouldn't be more than half an
hour checking them all in, unless my net connection breaks or something.
I tend to agree with rth that it's better to break things temporarily
and force use of a new interface than leave compatibility code around,
unless it's a major effort to change over.

Of course, you could force me to leave the old code in by witholding
permission to make the changes to gdb.  :-)

> it also covers the k&r problem - you cant rely on a k&r compiler to 
> report parameter mismatches.

That's the other part of my bfd patchset:  Fixing all the -Wconversion
errors that gcc reports.  I've done 32 bit native, 32 -> 64 bit xcompiles,
with 64 bit native and 64 -> 32 bit xcompiles yet to do.  The last two
cases should catch all the int/long mismatches, the first two catch
int/long vs. bfd_vma/bfd_size_type etc. mismatches.

Alan

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

* Re: bfd_read and bfd_write
  2001-09-05 18:52       ` Alan Modra
@ 2001-09-05 20:03         ` Andrew Cagney
  2001-09-06 10:33           ` Nick Clifton
  2001-09-05 23:15         ` bfd_read and bfd_write Andreas Jaeger
  1 sibling, 1 reply; 22+ messages in thread
From: Andrew Cagney @ 2001-09-05 20:03 UTC (permalink / raw)
  To: Alan Modra; +Cc: binutils, gdb-patches

 > I have patches for all of bfd, gas, gdb.  Shouldn't be more than half an
 > hour checking them all in, unless my net connection breaks or something.
 > I tend to agree with rth that it's better to break things temporarily
 > and force use of a new interface than leave compatibility code around,
 > unless it's a major effort to change over.
 >
 > Of course, you could force me to leave the old code in by witholding
 > permission to make the changes to gdb.   [:-)]

could i suggest taking a step back and deciding what bfd's policy is 
going to be on public / external interfaces.  remember, bfd is a library 
used by more than gdb and the other code immediately to hand.  i don't 
think changing public / external interfaces should be taken lightly (are 
you bumping the shlib version?).

i'd strongly recommend at least changing the function name as well as 
the function signature - that way old code can't pick up the new 
interface.  i'd also prefer to have the old interface around for at 
least a wee bit (allow mix 'n' match) of new bfd, old ... and give the 
change a chance to propogate / settle.  this also guarentees that gdb 
continues to _always_ be buildable.  i'm also some what puzzled as to 
why this all has to be done as a single jumbo patch, three separate 
patches (add new, change, delete old) are surely easier.

if you want, i can also add a check to gdb that ensures that the old 
function isn't used.

enjoy
	andrew

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

* Re: bfd_read and bfd_write
  2001-09-04 22:20 bfd_read and bfd_write Alan Modra
  2001-09-05  9:45 ` Andrew Cagney
@ 2001-09-05 20:13 ` Hans-Peter Nilsson
  2001-09-05 20:30   ` Alan Modra
  2001-09-08 22:42   ` Jim Blandy
  1 sibling, 2 replies; 22+ messages in thread
From: Hans-Peter Nilsson @ 2001-09-05 20:13 UTC (permalink / raw)
  To: Alan Modra; +Cc: binutils, gdb-patches

On Wed, 5 Sep 2001, Alan Modra wrote:
> This change will of course break gdb, for which I have patches, and
> any uncontributed ports.
>
> Comments/flames?

It's a simple, mechanical change that gets rid of a redundant
parameter.  Go wild!

If you go for new names anyway, I suggest bfd_bread and
bfd_bwrite.

brgds, H-P
PS.  Also speaking from having an uncontributed port.

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

* Re: bfd_read and bfd_write
  2001-09-05 20:13 ` Hans-Peter Nilsson
@ 2001-09-05 20:30   ` Alan Modra
  2001-09-08 22:42   ` Jim Blandy
  1 sibling, 0 replies; 22+ messages in thread
From: Alan Modra @ 2001-09-05 20:30 UTC (permalink / raw)
  To: Hans-Peter Nilsson; +Cc: binutils, gdb-patches

On Wed, Sep 05, 2001 at 11:13:32PM -0400, Hans-Peter Nilsson wrote:
> 
> If you go for new names anyway, I suggest bfd_bread and
> bfd_bwrite.

I'll probably go with this idea.  Anyone for bfd_bread and bfd_butter? :-)

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

* Re: bfd_read and bfd_write
  2001-09-05 18:52       ` Alan Modra
  2001-09-05 20:03         ` Andrew Cagney
@ 2001-09-05 23:15         ` Andreas Jaeger
  2001-09-06  0:01           ` Alan Modra
  1 sibling, 1 reply; 22+ messages in thread
From: Andreas Jaeger @ 2001-09-05 23:15 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: binutils, gdb-patches

Alan Modra <amodra@bigpond.net.au> writes:

>> it also covers the k&r problem - you cant rely on a k&r compiler to 
>> report parameter mismatches.
>
> That's the other part of my bfd patchset:  Fixing all the -Wconversion
> errors that gcc reports.  I've done 32 bit native, 32 -> 64 bit xcompiles,
> with 64 bit native and 64 -> 32 bit xcompiles yet to do.  The last two
> cases should catch all the int/long mismatches, the first two catch
> int/long vs. bfd_vma/bfd_size_type etc. mismatches.

Have you done --enable-targets=all --enable-64-bit-bfd builds - and
fixed all those warnings?  Wow!  I'm looking forward to that patch.

In that case we should add -Wconversion to build_warnings.

thanks,
Andreas
-- 
 Andreas Jaeger
  SuSE Labs aj@suse.de
   private aj@arthur.inka.de
    http://www.suse.de/~aj

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

* Re: bfd_read and bfd_write
  2001-09-05 23:15         ` bfd_read and bfd_write Andreas Jaeger
@ 2001-09-06  0:01           ` Alan Modra
  0 siblings, 0 replies; 22+ messages in thread
From: Alan Modra @ 2001-09-06  0:01 UTC (permalink / raw)
  To: Andreas Jaeger; +Cc: Andrew Cagney, binutils, gdb-patches

On Thu, Sep 06, 2001 at 08:15:23AM +0200, Andreas Jaeger wrote:
> Alan Modra <amodra@bigpond.net.au> writes:
> 
> Have you done --enable-targets=all --enable-64-bit-bfd builds - and
> fixed all those warnings?  Wow!  I'm looking forward to that patch.

Yes.

> In that case we should add -Wconversion to build_warnings.

No, because of zillions of warnings courtesy of glibc like:

/usr/include/bits/string2.h: In function `__strsep_g':
/usr/include/bits/string2.h:1171: warning: passing arg 2 of `__strpbrk_c2' with different width due to prototype
/usr/include/bits/string2.h:1171: warning: passing arg 3 of `__strpbrk_c2' with different width due to prototype
/usr/include/bits/string2.h:1171: warning: passing arg 2 of `__strpbrk_c3' with different width due to prototype
/usr/include/bits/string2.h:1171: warning: passing arg 3 of `__strpbrk_c3' with different width due to prototype
/usr/include/bits/string2.h:1171: warning: passing arg 4 of `__strpbrk_c3' with different width due to prototype

Alan

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

* Re: bfd_read and bfd_write
  2001-09-05 20:03         ` Andrew Cagney
@ 2001-09-06 10:33           ` Nick Clifton
       [not found]             ` <20010918192318.R27386@bubble.sa.bigpond.net.au>
  0 siblings, 1 reply; 22+ messages in thread
From: Nick Clifton @ 2001-09-06 10:33 UTC (permalink / raw)
  To: Alan Modra, Andrew Cagney; +Cc: binutils, gdb-patches

Hi Andrew, Hi Alan,

> could i suggest taking a step back and deciding what bfd's policy is
> going to be on public / external interfaces.  remember, bfd is a
> library used by more than gdb and the other code immediately to hand.
> i don't think changing public / external interfaces should be taken
> lightly

I agree.  In this case since we are changing the interface to bfd we
ought to take some time to give other users of the library a chance to
upgrade their software.

I like the idea of adding the new interface, with new function names,
and a warning message being generated if the old interface is used, as
part of the current CVS sources/forthcoming release.  Then in the
release after that, we can remove the old interface.

It takes longer this way I know, but I think that we ought to give
other binary tool developers a chance to change their software.

Cheers
        Nick



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

* Re: bfd_read and bfd_write
  2001-09-05 20:13 ` Hans-Peter Nilsson
  2001-09-05 20:30   ` Alan Modra
@ 2001-09-08 22:42   ` Jim Blandy
  2001-09-09  7:24     ` Hans-Peter Nilsson
  1 sibling, 1 reply; 22+ messages in thread
From: Jim Blandy @ 2001-09-08 22:42 UTC (permalink / raw)
  To: Hans-Peter Nilsson; +Cc: Alan Modra, binutils, gdb-patches

Hans-Peter Nilsson <hp@bitrange.com> writes:
> If you go for new names anyway, I suggest bfd_bread and

... bfd_butter?  bfd_wine and bfd_thou?

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

* Re: bfd_read and bfd_write
  2001-09-08 22:42   ` Jim Blandy
@ 2001-09-09  7:24     ` Hans-Peter Nilsson
  2001-09-10  9:51       ` Ian Lance Taylor
  0 siblings, 1 reply; 22+ messages in thread
From: Hans-Peter Nilsson @ 2001-09-09  7:24 UTC (permalink / raw)
  To: Jim Blandy; +Cc: Alan Modra, binutils, gdb-patches

On 9 Sep 2001, Jim Blandy wrote:
> Hans-Peter Nilsson <hp@bitrange.com> writes:
> > If you go for new names anyway, I suggest bfd_bread and
>
> ... bfd_butter?  bfd_wine and bfd_thou?

If it didn't have a slightly wacky twist, it wouldn't be a good
name. :-)  I still don't get the original BFD one, though.

brgds, H-P

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

* Re: bfd_read and bfd_write
  2001-09-09  7:24     ` Hans-Peter Nilsson
@ 2001-09-10  9:51       ` Ian Lance Taylor
  2001-09-10 17:56         ` Hans-Peter Nilsson
  0 siblings, 1 reply; 22+ messages in thread
From: Ian Lance Taylor @ 2001-09-10  9:51 UTC (permalink / raw)
  To: Hans-Peter Nilsson; +Cc: Jim Blandy, Alan Modra, binutils, gdb-patches

Hans-Peter Nilsson <hp@bitrange.com> writes:

> On 9 Sep 2001, Jim Blandy wrote:
> > Hans-Peter Nilsson <hp@bitrange.com> writes:
> > > If you go for new names anyway, I suggest bfd_bread and
> >
> > ... bfd_butter?  bfd_wine and bfd_thou?
> 
> If it didn't have a slightly wacky twist, it wouldn't be a good
> name. :-)  I still don't get the original BFD one, though.

Which original BFD one?

Ian

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

* Re: bfd_read and bfd_write
  2001-09-10  9:51       ` Ian Lance Taylor
@ 2001-09-10 17:56         ` Hans-Peter Nilsson
  2001-09-10 18:04           ` Ian Lance Taylor
  0 siblings, 1 reply; 22+ messages in thread
From: Hans-Peter Nilsson @ 2001-09-10 17:56 UTC (permalink / raw)
  To: Ian Lance Taylor; +Cc: Jim Blandy, Alan Modra, binutils, gdb-patches

On 10 Sep 2001, Ian Lance Taylor wrote:
> Hans-Peter Nilsson <hp@bitrange.com> writes:
> > If it didn't have a slightly wacky twist, it wouldn't be a good
> > name. :-)  I still don't get the original BFD one, though.
>
> Which original BFD one?

That BFD (also) alludes to something other than Binary File
Descriptor, because of this passage from bfd/doc/bfd.texinfo,
node History:
"The name came from a conversation David Wallace was having with
 Richard Stallman about the library: RMS said that it would be
 quite hard---David said ``BFD''.  Stallman was right, but the
 name stuck."
Me not native speaker.  Could it be as profane as "big f..ng deal"?

brgds, H-P

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

* Re: bfd_read and bfd_write
  2001-09-10 17:56         ` Hans-Peter Nilsson
@ 2001-09-10 18:04           ` Ian Lance Taylor
  0 siblings, 0 replies; 22+ messages in thread
From: Ian Lance Taylor @ 2001-09-10 18:04 UTC (permalink / raw)
  To: Hans-Peter Nilsson; +Cc: Jim Blandy, Alan Modra, binutils, gdb-patches

Hans-Peter Nilsson <hp@bitrange.com> writes:

> On 10 Sep 2001, Ian Lance Taylor wrote:
> > Hans-Peter Nilsson <hp@bitrange.com> writes:
> > > If it didn't have a slightly wacky twist, it wouldn't be a good
> > > name. :-)  I still don't get the original BFD one, though.
> >
> > Which original BFD one?
> 
> That BFD (also) alludes to something other than Binary File
> Descriptor, because of this passage from bfd/doc/bfd.texinfo,
> node History:
> "The name came from a conversation David Wallace was having with
>  Richard Stallman about the library: RMS said that it would be
>  quite hard---David said ``BFD''.  Stallman was right, but the
>  name stuck."
> Me not native speaker.  Could it be as profane as "big f..ng deal"?

It could be and it is.

Ian

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

* include/* changes for the bfd/ cleanup
       [not found]             ` <20010918192318.R27386@bubble.sa.bigpond.net.au>
@ 2001-09-18  2:58               ` Alan Modra
  2001-09-18  3:03               ` bfd/doc " Alan Modra
                                 ` (3 subsequent siblings)
  4 siblings, 0 replies; 22+ messages in thread
From: Alan Modra @ 2001-09-18  2:58 UTC (permalink / raw)
  To: binutils

At least here I don't need to compress the diff. :-)

include/ChangeLog
	* objalloc.h (OBJALLOC_ALIGN): Define using offsetof.

include/aout/ChangeLog
	* aout64.h: Formatting fixes.
	(N_TXTADDR): Evaluate to a bfd_vma.
	(N_DATADDR): Avoid negative unsigned warning.
	* hp300hpux.h: Formatting fixes.
	(N_DATADDR): As above.

include/coff/ChangeLog
	* external.h (GET_LINENO_LNNO): Use H_GET_32/16.
	(PUT_LINENO_LNNO): Use H_PUT_32/16.
	* m88k.h (GET_LNSZ_SIZE, GET_LNSZ_LNNO, GET_SCN_NRELOC,
	GET_SCN_NLINNO): Use H_GET_32.
	(PUT_LNSZ_LNNO, PUT_LNSZ_SIZE, PUT_SCN_NRELOC, PUT_SCN_NLINNO):
	Use H_PUT_32.
	* ti.h: Formatting fixes.  Make use of H_GET_* and H_PUT_* throughout.
	* xcoff.h: White space changes.

include/elf/ChangeLog
	* internal.h (elf_internal_rela): Make r_addend a bfd_vma.

-- 
Alan Modra

Index: include/objalloc.h
===================================================================
RCS file: /cvs/src/src/include/objalloc.h,v
retrieving revision 1.1.1.1
diff -u -p -w -r1.1.1.1 objalloc.h
--- objalloc.h	1999/05/03 07:29:02	1.1.1.1
+++ objalloc.h	2001/09/17 09:28:54
@@ -56,12 +56,11 @@ struct objalloc_align { char x; double d
 #ifndef offsetof
 #include <stddef.h>
 #endif
-#define OBJALLOC_ALIGN \
-  ((ptrdiff_t) ((char *) &((struct objalloc_align *) 0)->d - (char *) 0))
-#else
-#define OBJALLOC_ALIGN \
-  ((long) ((char *) &((struct objalloc_align *) 0)->d - (char *) 0))
 #endif
+#ifndef offsetof
+#define offsetof(TYPE, MEMBER) ((unsigned long) &((TYPE *)0)->MEMBER)
+#endif
+#define OBJALLOC_ALIGN offsetof (struct objalloc_align, d)
 
 /* Create an objalloc structure.  Returns NULL if malloc fails.  */
 
Index: include/aout/aout64.h
===================================================================
RCS file: /cvs/src/src/include/aout/aout64.h,v
retrieving revision 1.4
diff -u -p -w -r1.4 aout64.h
--- aout64.h	2001/03/14 02:27:43	1.4
+++ aout64.h	2001/09/17 09:28:54
@@ -131,7 +131,8 @@ struct external_exec 
 /* This macro is only relevant for ZMAGIC files; QMAGIC always has the header
    in the text.  */
 #ifndef N_HEADER_IN_TEXT
-#define N_HEADER_IN_TEXT(x) (((x).a_entry & (TARGET_PAGE_SIZE-1)) >= EXEC_BYTES_SIZE)
+#define N_HEADER_IN_TEXT(x) \
+  (((x).a_entry & (TARGET_PAGE_SIZE-1)) >= EXEC_BYTES_SIZE)
 #endif
 
 /* Sun shared libraries, not linux.  This macro is only relevant for ZMAGIC
@@ -153,13 +154,15 @@ struct external_exec 
 #define N_TXTADDR(x) \
     (/* The address of a QMAGIC file is always one page in, */ \
      /* with the header in the text.  */ \
-     N_IS_QMAGIC (x) ? TARGET_PAGE_SIZE + EXEC_BYTES_SIZE : \
-     N_MAGIC(x) != ZMAGIC ? 0 :	/* object file or NMAGIC */\
-     N_SHARED_LIB(x) ? 0 :	\
-     N_HEADER_IN_TEXT(x)  ?	\
-	    TEXT_START_ADDR + EXEC_BYTES_SIZE :	/* no padding */\
-	    TEXT_START_ADDR			/* a page of padding */\
-    )
+     N_IS_QMAGIC (x)							\
+     ? (bfd_vma) TARGET_PAGE_SIZE + EXEC_BYTES_SIZE			\
+     : (N_MAGIC (x) != ZMAGIC						\
+	? (bfd_vma) 0	/* object file or NMAGIC */			\
+	: (N_SHARED_LIB (x)						\
+	   ? (bfd_vma) 0						\
+	   : (N_HEADER_IN_TEXT (x)					\
+	      ? (bfd_vma) TEXT_START_ADDR + EXEC_BYTES_SIZE		\
+	      : (bfd_vma) TEXT_START_ADDR))))
 #endif
 
 /* If N_HEADER_IN_TEXT is not true for ZMAGIC, there is some padding
@@ -179,12 +182,13 @@ struct external_exec 
 #ifndef N_TXTOFF
 #define N_TXTOFF(x)	\
     (/* For {O,N,Q}MAGIC, no padding.  */ \
-     N_MAGIC(x) != ZMAGIC ? EXEC_BYTES_SIZE : \
-     N_SHARED_LIB(x) ? 0 : \
-     N_HEADER_IN_TEXT(x) ?	\
-	    EXEC_BYTES_SIZE :			/* no padding */\
-	    ZMAGIC_DISK_BLOCK_SIZE		/* a page of padding */\
-    )
+     N_MAGIC (x) != ZMAGIC						\
+     ? EXEC_BYTES_SIZE							\
+     : (N_SHARED_LIB (x)						\
+	? 0								\
+	: (N_HEADER_IN_TEXT (x)						\
+	   ? EXEC_BYTES_SIZE		/* no padding */		\
+	   : ZMAGIC_DISK_BLOCK_SIZE	/* a page of padding */)))
 #endif
 /* Size of the text section.  It's always as stated, except that we
    offset it to `undo' the adjustment to N_TXTADDR and N_TXTOFF
@@ -194,20 +198,23 @@ struct external_exec 
 #ifndef N_TXTSIZE
 #define	N_TXTSIZE(x) \
     (/* For QMAGIC, we don't consider the header part of the text section.  */\
-     N_IS_QMAGIC (x) ? (x).a_text - EXEC_BYTES_SIZE : \
-     (N_MAGIC(x) != ZMAGIC || N_SHARED_LIB(x)) ? (x).a_text : \
-     N_HEADER_IN_TEXT(x)  ?	\
-	    (x).a_text - EXEC_BYTES_SIZE:	/* no padding */\
-	    (x).a_text				/* a page of padding */\
-    )
+   N_IS_QMAGIC (x)							\
+   ? (x).a_text - EXEC_BYTES_SIZE					\
+   : ((N_MAGIC (x) != ZMAGIC || N_SHARED_LIB (x))			\
+      ? (x).a_text							\
+      : (N_HEADER_IN_TEXT (x)						\
+	 ? (x).a_text - EXEC_BYTES_SIZE	/* no padding */		\
+	 : (x).a_text			/* a page of padding */ )))
 #endif
 /* The address of the data segment in virtual memory.
    It is the text segment address, plus text segment size, rounded
    up to a N_SEGSIZE boundary for pure or pageable files. */
 #ifndef N_DATADDR
 #define N_DATADDR(x) \
-    (N_MAGIC(x)==OMAGIC? (N_TXTADDR(x)+N_TXTSIZE(x)) \
-     :  (N_SEGSIZE(x) + ((N_TXTADDR(x)+N_TXTSIZE(x)-1) & ~(N_SEGSIZE(x)-1))))
+  (N_MAGIC (x) == OMAGIC						\
+   ? (N_TXTADDR (x) + N_TXTSIZE (x))					\
+   : (N_SEGSIZE (x) + ((N_TXTADDR (x) + N_TXTSIZE (x) - 1)		\
+		       & ~ (bfd_vma) (N_SEGSIZE (x) - 1))))
 #endif
 /* The address of the BSS segment -- immediately after the data segment.  */
 
@@ -228,10 +235,8 @@ struct external_exec 
    for NMAGIC.  */
 
 #ifndef N_DATOFF
-#define N_DATOFF(x) \
- (N_TXTOFF(x) + N_TXTSIZE(x))
+#define N_DATOFF(x)	( N_TXTOFF (x) + N_TXTSIZE (x) )
 #endif
-
 #ifndef N_TRELOFF
 #define N_TRELOFF(x)	( N_DATOFF(x) + (x).a_data )
 #endif
Index: include/aout/hp300hpux.h
===================================================================
RCS file: /cvs/src/src/include/aout/hp300hpux.h,v
retrieving revision 1.3
diff -u -p -w -r1.3 hp300hpux.h
--- hp300hpux.h	2001/03/18 02:56:20	1.3
+++ hp300hpux.h	2001/09/17 09:28:54
@@ -73,13 +73,13 @@ struct hp300hpux_header_extension
 #define N_BADMAG(x) ((_N_BADMAG (x)) || (_N_BADMACH (x)))
 
 #define N_DATADDR(x) \
-    ((N_MAGIC(x)==OMAGIC || N_MAGIC(x)==HPUX_DOT_O_MAGIC) ? \
-        (N_TXTADDR(x)+N_TXTSIZE(x)) \
-     :  (N_SEGSIZE(x) + ((N_TXTADDR(x)+N_TXTSIZE(x)-1) & ~(N_SEGSIZE(x)-1))))
+  ((N_MAGIC (x) == OMAGIC || N_MAGIC (x) == HPUX_DOT_O_MAGIC)		\
+   ? (N_TXTADDR (x) + N_TXTSIZE (x))					\
+   : (N_SEGSIZE (x) + ((N_TXTADDR (x) + N_TXTSIZE (x) - 1)		\
+		       & ~ (bfd_vma) (N_SEGSIZE (x) - 1))))
 
 #define _N_BADMACH(x)                                                   \
-(((N_MACHTYPE (x)) != HP9000S200_ID) &&                                 \
- ((N_MACHTYPE (x)) != HP98x6_ID))
+  (((N_MACHTYPE (x)) != HP9000S200_ID) && ((N_MACHTYPE (x)) != HP98x6_ID))
 
 #define _N_BADMAG(x)	  (N_MAGIC(x) != HPUX_DOT_O_MAGIC \
                         && N_MAGIC(x) != OMAGIC		\
Index: include/coff/external.h
===================================================================
RCS file: /cvs/src/src/include/coff/external.h,v
retrieving revision 1.2
diff -u -p -w -r1.2 external.h
--- external.h	2001/03/24 00:45:11	1.2
+++ external.h	2001/09/17 09:28:54
@@ -113,12 +113,12 @@ struct external_lineno
 #define	LINESZ	(4 + L_LNNO_SIZE)
 
 #if L_LNNO_SIZE == 4
-#define GET_LINENO_LNNO(abfd, ext)      bfd_h_get_32 (abfd,      (bfd_byte *) (ext->l_lnno));
-#define PUT_LINENO_LNNO(abfd, val, ext) bfd_h_put_32 (abfd, val, (bfd_byte *) (ext->l_lnno));
+#define GET_LINENO_LNNO H_GET_32
+#define PUT_LINENO_LNNO H_PUT_32
 #endif
 #if L_LNNO_SIZE == 2
-#define GET_LINENO_LNNO(abfd, ext)     bfd_h_get_16 (abfd, (bfd_byte *) (ext->l_lnno));
-#define PUT_LINENO_LNNO(abfd,val, ext) bfd_h_put_16 (abfd,val,  (bfd_byte *) (ext->l_lnno));
+#define GET_LINENO_LNNO H_GET_16
+#define PUT_LINENO_LNNO H_PUT_16
 #endif
 
 #endif /* not DO_NOT_DEFINE_LINENO */
Index: include/coff/m88k.h
===================================================================
RCS file: /cvs/src/src/include/coff/m88k.h,v
retrieving revision 1.3
diff -u -p -w -r1.3 m88k.h
--- m88k.h	2001/03/24 00:45:11	1.3
+++ m88k.h	2001/09/17 09:28:54
@@ -158,20 +158,22 @@ union external_auxent
   } x_tv;			/* info about .tv section (in auxent of symbol .tv)) */
 };
 
-#define GET_FCN_LNNOPTR(abfd, ext) bfd_h_get_32(abfd, (bfd_byte *)ext->x_sym.x_fcnary.x_fcn.x_lnnoptr)
-#define GET_FCN_ENDNDX(abfd, ext) bfd_h_get_32(abfd, (bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_endndx)
-#define PUT_FCN_LNNOPTR(abfd, in, ext)  bfd_h_put_32(abfd,  in, (bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_lnnoptr)
-#define PUT_FCN_ENDNDX(abfd, in, ext) bfd_h_put_32(abfd, in, (bfd_byte *)   ext->x_sym.x_fcnary.x_fcn.x_endndx)
-#define GET_LNSZ_SIZE(abfd, ext) bfd_h_get_32(abfd, (bfd_byte *) ext->x_sym.x_misc.x_lnsz.x_size)
-#define GET_LNSZ_LNNO(abfd, ext) bfd_h_get_32(abfd, (bfd_byte *) ext->x_sym.x_misc.x_lnsz.x_lnno)
-#define PUT_LNSZ_LNNO(abfd, in, ext) bfd_h_put_32(abfd, in, (bfd_byte *) ext->x_sym.x_misc.x_lnsz.x_lnno)
-#define PUT_LNSZ_SIZE(abfd, in, ext) bfd_h_put_32(abfd, in, (bfd_byte *) ext->x_sym.x_misc.x_lnsz.x_size)
-#define GET_SCN_SCNLEN(abfd, ext) bfd_h_get_32(abfd, (bfd_byte *) ext->x_scn.x_scnlen)
-#define GET_SCN_NRELOC(abfd, ext) bfd_h_get_32(abfd, (bfd_byte *) ext->x_scn.x_nreloc)
-#define GET_SCN_NLINNO(abfd, ext)  bfd_h_get_32(abfd, (bfd_byte *) ext->x_scn.x_nlinno)
-#define PUT_SCN_SCNLEN(abfd,in, ext) bfd_h_put_32(abfd, in, (bfd_byte *) ext->x_scn.x_scnlen)
-#define PUT_SCN_NRELOC(abfd,in, ext) bfd_h_put_32(abfd, in, (bfd_byte *)ext->x_scn.x_nreloc)
-#define PUT_SCN_NLINNO(abfd,in, ext)  bfd_h_put_32(abfd,in, (bfd_byte *) ext->x_scn.x_nlinno)
+#define GET_LNSZ_SIZE(abfd, ext) \
+  H_GET_32 (abfd, ext->x_sym.x_misc.x_lnsz.x_size)
+#define GET_LNSZ_LNNO(abfd, ext) \
+  H_GET_32 (abfd, ext->x_sym.x_misc.x_lnsz.x_lnno)
+#define PUT_LNSZ_LNNO(abfd, in, ext) \
+  H_PUT_32 (abfd, in, ext->x_sym.x_misc.x_lnsz.x_lnno)
+#define PUT_LNSZ_SIZE(abfd, in, ext) \
+  H_PUT_32 (abfd, in, ext->x_sym.x_misc.x_lnsz.x_size)
+#define GET_SCN_NRELOC(abfd, ext) \
+  H_GET_32 (abfd, ext->x_scn.x_nreloc)
+#define GET_SCN_NLINNO(abfd, ext) \
+  H_GET_32 (abfd, ext->x_scn.x_nlinno)
+#define PUT_SCN_NRELOC(abfd, in, ext) \
+  H_PUT_32 (abfd, in, ext->x_scn.x_nreloc)
+#define PUT_SCN_NLINNO(abfd, in, ext) \
+  H_PUT_32 (abfd,in, ext->x_scn.x_nlinno)
 
 #define	SYMENT	struct external_syment
 #define	SYMESZ	20
Index: include/coff/ti.h
===================================================================
RCS file: /cvs/src/src/include/coff/ti.h,v
retrieving revision 1.9
diff -u -p -w -r1.9 ti.h
--- ti.h	2001/03/14 02:27:43	1.9
+++ ti.h	2001/09/17 09:28:55
@@ -92,16 +92,22 @@ struct external_filehdr
 /* we need to read/write an extra field in the coff file header */
 #ifndef COFF_ADJUST_FILEHDR_IN_POST
 #define COFF_ADJUST_FILEHDR_IN_POST(abfd,src,dst) \
-do { ((struct internal_filehdr *)(dst))->f_target_id = \
-bfd_h_get_16(abfd, (bfd_byte *)(((FILHDR *)(src))->f_target_id)); \
-} while(0)
+  do									\
+    {									\
+      ((struct internal_filehdr *)(dst))->f_target_id =			\
+	H_GET_16 (abfd, ((FILHDR *)(src))->f_target_id);			\
+    }									\
+  while (0)
 #endif
 
 #ifndef COFF_ADJUST_FILEHDR_OUT_POST
 #define COFF_ADJUST_FILEHDR_OUT_POST(abfd,src,dst) \
-do { bfd_h_put_16(abfd, ((struct internal_filehdr *)(src))->f_target_id, \
-             (bfd_byte *)(((FILHDR *)(dst))->f_target_id)); \
-} while(0)
+  do									\
+    {									\
+      H_PUT_16 (abfd, ((struct internal_filehdr *)(src))->f_target_id,	\
+	       ((FILHDR *)(dst))->f_target_id);				\
+    }									\
+  while (0)
 #endif
 
 #define	FILHDR	struct external_filehdr
@@ -201,35 +207,39 @@ struct external_scnhdr {
    accordingly 
  */
 #define GET_SCNHDR_NRELOC(ABFD,PTR) \
-(COFF2_P(ABFD) ? bfd_h_get_32 (ABFD,PTR) : bfd_h_get_16 (ABFD, PTR))
+  (COFF2_P (ABFD) ? H_GET_32 (ABFD, PTR) : H_GET_16 (ABFD, PTR))
 #define PUT_SCNHDR_NRELOC(ABFD,VAL,PTR) \
-(COFF2_P(ABFD) ? bfd_h_put_32 (ABFD,VAL,PTR) : bfd_h_put_16 (ABFD,VAL,PTR))
+  (COFF2_P (ABFD) ? H_PUT_32 (ABFD, VAL, PTR) : H_PUT_16 (ABFD, VAL, PTR))
 #define GET_SCNHDR_NLNNO(ABFD,PTR) \
-(COFF2_P(ABFD) ? bfd_h_get_32 (ABFD,PTR) : bfd_h_get_16 (ABFD, (PTR)-2))
+  (COFF2_P (ABFD) ? H_GET_32 (ABFD, PTR) : H_GET_16 (ABFD, (PTR) -2))
 #define PUT_SCNHDR_NLNNO(ABFD,VAL,PTR) \
-(COFF2_P(ABFD) ? bfd_h_put_32 (ABFD,VAL,PTR) : bfd_h_put_16 (ABFD,VAL,(PTR)-2))
+  (COFF2_P (ABFD) ? H_PUT_32 (ABFD, VAL, PTR) : H_PUT_16 (ABFD, VAL, (PTR) -2))
 #define GET_SCNHDR_FLAGS(ABFD,PTR) \
-(COFF2_P(ABFD) ? bfd_h_get_32 (ABFD,PTR) : bfd_h_get_16 (ABFD, (PTR)-4))
+  (COFF2_P (ABFD) ? H_GET_32 (ABFD, PTR) : H_GET_16 (ABFD, (PTR) -4))
 #define PUT_SCNHDR_FLAGS(ABFD,VAL,PTR) \
-(COFF2_P(ABFD) ? bfd_h_put_32 (ABFD,VAL,PTR) : bfd_h_put_16 (ABFD,VAL,(PTR)-4))
+  (COFF2_P (ABFD) ? H_PUT_32 (ABFD, VAL, PTR) : H_PUT_16 (ABFD, VAL, (PTR) -4))
 #define GET_SCNHDR_PAGE(ABFD,PTR) \
-(COFF2_P(ABFD) ? bfd_h_get_16 (ABFD,PTR) : bfd_h_get_8 (ABFD, (PTR)-7))
+  (COFF2_P (ABFD) ? H_GET_16 (ABFD, PTR) : H_GET_8 (ABFD, (PTR) -7))
 /* on output, make sure that the "reserved" field is zero */
 #define PUT_SCNHDR_PAGE(ABFD,VAL,PTR) \
-(COFF2_P(ABFD) ? bfd_h_put_16 (ABFD,VAL,PTR) : \
-bfd_h_put_8 (ABFD,VAL,(PTR)-7), bfd_h_put_8 (ABFD, 0, (PTR)-8))
+  (COFF2_P (ABFD) \
+   ? H_PUT_16 (ABFD, VAL, PTR) \
+   : H_PUT_8 (ABFD, VAL, (PTR) -7), H_PUT_8 (ABFD, 0, (PTR) -8))
 
 /* TI COFF stores section size as number of bytes (address units, not octets),
    so adjust to be number of octets, which is what BFD expects */ 
 #define GET_SCNHDR_SIZE(ABFD,SZP) \
-(bfd_h_get_32(ABFD,SZP)*bfd_octets_per_byte(ABFD))
+  (H_GET_32 (ABFD, SZP) * bfd_octets_per_byte (ABFD))
 #define PUT_SCNHDR_SIZE(ABFD,SZ,SZP) \
-bfd_h_put_32(ABFD,(SZ)/bfd_octets_per_byte(ABFD),SZP)
+  H_PUT_32 (ABFD, (SZ) / bfd_octets_per_byte (ABFD), SZP)
 
 #define COFF_ADJUST_SCNHDR_IN_POST(ABFD,EXT,INT) \
-do { ((struct internal_scnhdr *)(INT))->s_page = \
-GET_SCNHDR_PAGE(ABFD,(bfd_byte *)((SCNHDR *)(EXT))->s_page); \
-} while(0)
+  do									\
+    {									\
+      ((struct internal_scnhdr *)(INT))->s_page =			\
+	GET_SCNHDR_PAGE (ABFD, ((SCNHDR *)(EXT))->s_page);		\
+    }									\
+   while (0)
 
 /* The line number and reloc overflow checking in coff_swap_scnhdr_out in
    coffswap.h doesn't use PUT_X for s_nlnno and s_nreloc.
@@ -237,16 +247,18 @@ GET_SCNHDR_PAGE(ABFD,(bfd_byte *)((SCNHD
    fields.
  */
 #define COFF_ADJUST_SCNHDR_OUT_POST(ABFD,INT,EXT) \
-do { \
+  do									   \
+    {									   \
 PUT_SCNHDR_NLNNO(ABFD,((struct internal_scnhdr *)(INT))->s_nlnno,\
-                (bfd_byte *)((SCNHDR *)(EXT))->s_nlnno); \
+			((SCNHDR *)(EXT))->s_nlnno);			   \
 PUT_SCNHDR_NRELOC(ABFD,((struct internal_scnhdr *)(INT))->s_nreloc,\
-                (bfd_byte *)((SCNHDR *)(EXT))->s_nreloc); \
+			 ((SCNHDR *)(EXT))->s_nreloc);			   \
 PUT_SCNHDR_FLAGS(ABFD,((struct internal_scnhdr *)(INT))->s_flags, \
-                (bfd_byte *)((SCNHDR *)(EXT))->s_flags); \
+			((SCNHDR *)(EXT))->s_flags);			   \
 PUT_SCNHDR_PAGE(ABFD,((struct internal_scnhdr *)(INT))->s_page, \
-                (bfd_byte *)((SCNHDR *)(EXT))->s_page); \
-} while(0)
+		       ((SCNHDR *)(EXT))->s_page);			   \
+    }									   \
+   while (0)
 
 /* Page macros
 
@@ -387,32 +399,37 @@ union external_auxent {
 
 /* section lengths are in target bytes (not host bytes) */
 #define GET_SCN_SCNLEN(ABFD,EXT) \
-(bfd_h_get_32(ABFD,(bfd_byte *)(EXT)->x_scn.x_scnlen)*bfd_octets_per_byte(ABFD))
+  (H_GET_32 (ABFD, (EXT)->x_scn.x_scnlen) * bfd_octets_per_byte (ABFD))
 #define PUT_SCN_SCNLEN(ABFD,INT,EXT) \
-bfd_h_put_32(ABFD,(INT)/bfd_octets_per_byte(ABFD),\
-             (bfd_byte *)(EXT)->x_scn.x_scnlen)
+  H_PUT_32 (ABFD, (INT) / bfd_octets_per_byte (ABFD), (EXT)->x_scn.x_scnlen)
 
 /* lnsz size is in bits in COFF file, in bytes in BFD */
 #define GET_LNSZ_SIZE(abfd, ext) \
-(bfd_h_get_16(abfd, (bfd_byte *)ext->x_sym.x_misc.x_lnsz.x_size) / \
- (class != C_FIELD ? 8 : 1))
+ (H_GET_16 (abfd, ext->x_sym.x_misc.x_lnsz.x_size) / (class != C_FIELD ? 8 : 1))
 
 #define PUT_LNSZ_SIZE(abfd, in, ext) \
- bfd_h_put_16(abfd, ((class != C_FIELD) ? (in)*8 : (in)), \
-              (bfd_byte*) ext->x_sym.x_misc.x_lnsz.x_size)
+  H_PUT_16 (abfd, ((class != C_FIELD) ? (in) * 8 : (in)), \
+	   ext->x_sym.x_misc.x_lnsz.x_size)
  
 /* TI COFF stores offsets for MOS and MOU in bits; BFD expects bytes */
 #define COFF_ADJUST_SYM_IN_POST(ABFD,EXT,INT) \
-do { struct internal_syment *dst = (struct internal_syment *)(INT); \
-if (dst->n_sclass == C_MOS || dst->n_sclass == C_MOU) dst->n_value /= 8; \
-} while (0)
+  do									\
+    {									\
+      struct internal_syment *dst = (struct internal_syment *)(INT);	\
+      if (dst->n_sclass == C_MOS || dst->n_sclass == C_MOU)		\
+	dst->n_value /= 8;						\
+    }									\
+   while (0)
 
 #define COFF_ADJUST_SYM_OUT_POST(ABFD,INT,EXT) \
-do { struct internal_syment *src = (struct internal_syment *)(INT); \
+  do									\
+    {									\
+       struct internal_syment *src = (struct internal_syment *)(INT);	\
 SYMENT *dst = (SYMENT *)(EXT); \
 if(src->n_sclass == C_MOU || src->n_sclass == C_MOS) \
-bfd_h_put_32(abfd,src->n_value * 8,(bfd_byte *)dst->e_value); \
-} while (0)
+	 H_PUT_32 (abfd, src->n_value * 8, dst->e_value);		\
+    }									\
+   while (0)
 
 /* Detect section-relative absolute symbols so they get flagged with a sym
    index of -1.
Index: include/coff/xcoff.h
===================================================================
RCS file: /cvs/src/src/include/coff/xcoff.h,v
retrieving revision 1.3
diff -u -p -w -r1.3 xcoff.h

white space changes

Index: include/elf/internal.h
===================================================================
RCS file: /cvs/src/src/include/elf/internal.h,v
retrieving revision 1.3
diff -u -p -w -r1.3 internal.h
--- internal.h	2001/03/14 02:27:44	1.3
+++ internal.h	2001/09/17 09:28:56
@@ -153,7 +153,7 @@ typedef struct elf_internal_rel {
 typedef struct elf_internal_rela {
   bfd_vma	r_offset;	/* Location at which to apply the action */
   bfd_vma	r_info;		/* Index and Type of relocation */
-  bfd_signed_vma r_addend;	/* Constant addend used to compute value */
+  bfd_vma	r_addend;	/* Constant addend used to compute value */
 } Elf_Internal_Rela;
 
 #define elf32_internal_rela elf_internal_rela

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

* bfd/doc changes for the bfd/ cleanup
       [not found]             ` <20010918192318.R27386@bubble.sa.bigpond.net.au>
  2001-09-18  2:58               ` include/* changes for the bfd/ cleanup Alan Modra
@ 2001-09-18  3:03               ` Alan Modra
  2001-09-18  3:05               ` binutils " Alan Modra
                                 ` (2 subsequent siblings)
  4 siblings, 0 replies; 22+ messages in thread
From: Alan Modra @ 2001-09-18  3:03 UTC (permalink / raw)
  To: binutils

bfd/doc/ChangeLog
	* bfdint.texi: Replace reference to bfd_read with bfd_bread.
	Likewise for bfd_write.

Index: bfd/doc/bfdint.texi
===================================================================
RCS file: /cvs/src/src/bfd/doc/bfdint.texi,v
retrieving revision 1.9
diff -u -p -w -r1.9 bfdint.texi
--- bfdint.texi	2001/06/20 22:23:23	1.9
+++ bfdint.texi	2001/09/17 09:28:03
@@ -503,7 +503,7 @@ corresponds to an actual section in an a
 Get the contents of a section.  This is called from
 @samp{bfd_get_section_contents}.  Most targets set this to
 @samp{_bfd_generic_get_section_contents}, which does a @samp{bfd_seek}
-based on the section's @samp{filepos} field and a @samp{bfd_read}.  The
+based on the section's @samp{filepos} field and a @samp{bfd_bread}.  The
 corresponding field in the target vector is named
 @samp{_bfd_get_section_contents}.
 
@@ -636,7 +636,7 @@ always uses extended name tables anyhow.
 target vector is named @samp{_bfd_truncate_arname}.
 
 @item _write_armap
-Write out the archive symbol table using calls to @samp{bfd_write}.
+Write out the archive symbol table using calls to @samp{bfd_bwrite}.
 This is normally called from the archive @samp{write_contents} routine.
 The corresponding field in the target vector is named @samp{write_armap}
 (no leading underscore).

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

* binutils changes for the bfd/ cleanup
       [not found]             ` <20010918192318.R27386@bubble.sa.bigpond.net.au>
  2001-09-18  2:58               ` include/* changes for the bfd/ cleanup Alan Modra
  2001-09-18  3:03               ` bfd/doc " Alan Modra
@ 2001-09-18  3:05               ` Alan Modra
  2001-09-18  3:06               ` gas " Alan Modra
  2001-09-18  3:09               ` ld " Alan Modra
  4 siblings, 0 replies; 22+ messages in thread
From: Alan Modra @ 2001-09-18  3:05 UTC (permalink / raw)
  To: binutils

binutils/ChangeLog
	* ar.c (print_contents): Cast args of bfd_seek to the right types.
	Replace bfd_read call with call to bfd_bread.
	(extract_file): Likewise.

	* objdump.c (dump_section_header): Cast section->filepos to
	unsigned long to suit printf format string.
	* readelf.c (process_section_headers): Similarly for sh_offset.
	(process_unwind): Likewise.

Index: binutils/ar.c
===================================================================
RCS file: /cvs/src/src/binutils/ar.c,v
retrieving revision 1.19
diff -u -p -w -r1.19 ar.c
--- ar.c	2001/03/13 06:43:56	1.19
+++ ar.c	2001/09/17 09:28:04
@@ -827,7 +827,7 @@ print_contents (abfd)
     /* xgettext:c-format */
     printf (_("\n<member %s>\n\n"), bfd_get_filename (abfd));
 
-  bfd_seek (abfd, 0, SEEK_SET);
+  bfd_seek (abfd, (file_ptr) 0, SEEK_SET);
 
   size = buf.st_size;
   while (ncopied < size)
@@ -838,8 +838,7 @@ print_contents (abfd)
       if (tocopy > BUFSIZE)
 	tocopy = BUFSIZE;
 
-      nread = bfd_read (cbuf, 1, tocopy, abfd);	/* oops -- broke
-							   abstraction!  */
+      nread = bfd_bread (cbuf, (bfd_size_type) tocopy, abfd);
       if (nread != tocopy)
 	/* xgettext:c-format */
 	fatal (_("%s is not a valid archive"),
@@ -883,7 +882,7 @@ extract_file (abfd)
   if (verbose)
     printf ("x - %s\n", bfd_get_filename (abfd));
 
-  bfd_seek (abfd, 0, SEEK_SET);
+  bfd_seek (abfd, (file_ptr) 0, SEEK_SET);
 
   ostream = NULL;
   if (size == 0)
@@ -907,7 +906,7 @@ extract_file (abfd)
 	if (tocopy > BUFSIZE)
 	  tocopy = BUFSIZE;
 
-	nread = bfd_read (cbuf, 1, tocopy, abfd);
+	nread = bfd_bread (cbuf, (bfd_size_type) tocopy, abfd);
 	if (nread != tocopy)
 	  /* xgettext:c-format */
 	  fatal (_("%s is not a valid archive"),
Index: binutils/objdump.c
===================================================================
RCS file: /cvs/src/src/binutils/objdump.c,v
retrieving revision 1.40
diff -u -p -w -r1.40 objdump.c
--- objdump.c	2001/08/10 16:43:18	1.40
+++ objdump.c	2001/09/17 09:28:06
@@ -287,7 +287,7 @@ dump_section_header (abfd, section, igno
   bfd_printf_vma (abfd, bfd_get_section_vma (abfd, section));
   printf ("  ");
   bfd_printf_vma (abfd, section->lma);
-  printf ("  %08lx  2**%u", section->filepos,
+  printf ("  %08lx  2**%u", (unsigned long) section->filepos,
 	  bfd_get_section_alignment (abfd, section));
   if (! wide_output)
     printf ("\n                ");
Index: binutils/readelf.c
===================================================================
RCS file: /cvs/src/src/binutils/readelf.c,v
retrieving revision 1.119
diff -u -p -w -r1.119 readelf.c
--- readelf.c	2001/09/12 23:53:45	1.119
+++ readelf.c	2001/09/17 09:28:12
@@ -3085,7 +3085,7 @@ process_section_headers (file)
 	{
 	  putchar (' ');
 	  print_vma (section->sh_addr, LONG_HEX);
-	  printf ("  %8.8lx", section->sh_offset);
+	  printf ("  %8.8lx", (unsigned long) section->sh_offset);
 	  printf ("\n       ");
 	  print_vma (section->sh_size, LONG_HEX);
 	  printf ("  ");
@@ -3650,7 +3650,7 @@ process_unwind (file)
 	    printf ("'%s'", SECTION_NAME (unwsec));
 
 	  printf (_(" at offset 0x%lx contains %lu entries:\n"),
-		  unwsec->sh_offset,
+		  (unsigned long) unwsec->sh_offset,
 		  (unsigned long) (unwsec->sh_size / (3 * addr_size)));
 
 	  (void) slurp_ia64_unwind_table (file, & aux, unwsec);

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

* gas changes for the bfd/ cleanup
       [not found]             ` <20010918192318.R27386@bubble.sa.bigpond.net.au>
                                 ` (2 preceding siblings ...)
  2001-09-18  3:05               ` binutils " Alan Modra
@ 2001-09-18  3:06               ` Alan Modra
  2001-09-18  3:09               ` ld " Alan Modra
  4 siblings, 0 replies; 22+ messages in thread
From: Alan Modra @ 2001-09-18  3:06 UTC (permalink / raw)
  To: binutils

gas/ChangeLog
	* dwarf2dbg.c (dwarf2_directive_file): Avoid signed/unsigned warning.

	* write.c (set_symtab): Update bfd_alloc declaration.  Use a temp
	var to ensure bfd_alloc arg is the right type.
	(write_object_file): Cast args of bfd_seek.  Replace bfd_write with
	bfd_bwrite.

	* config/obj-coff.c: Replace calls to bfd_write with calls to
	bfd_bwrite.  Cast args of bfd_seek.

	* config/obj-elf.c (obj_elf_change_section): Avoid signed/unsigned
	warning.

	* config/tc-mn10300.c (set_arch_mach): Make param unsigned.

	* config/tc-tic54x.c (tic54x_mlib): Replace bfd_read call with
	call to bfd_bread.

Index: gas/write.c
===================================================================
RCS file: /cvs/src/src/gas/write.c,v
retrieving revision 1.45
diff -u -p -w -r1.45 write.c
--- write.c	2001/09/09 14:01:16	1.45
+++ write.c	2001/09/17 09:28:15
@@ -1365,7 +1365,7 @@ set_symtab ()
   asymbol **asympp;
   symbolS *symp;
   boolean result;
-  extern PTR bfd_alloc PARAMS ((bfd *, size_t));
+  extern PTR bfd_alloc PARAMS ((bfd *, bfd_size_type));
 
   /* Count symbols.  We can't rely on a count made by the loop in
      write_object_file, because *_frob_file may add a new symbol or
@@ -1377,9 +1377,9 @@ set_symtab ()
   if (nsyms)
     {
       int i;
+      bfd_size_type amt = (bfd_size_type) nsyms * sizeof (asymbol *);
 
-      asympp = (asymbol **) bfd_alloc (stdoutput,
-				       nsyms * sizeof (asymbol *));
+      asympp = (asymbol **) bfd_alloc (stdoutput, amt);
       symp = symbol_rootP;
       for (i = 0; i < nsyms; i++, symp = symbol_next (symp))
 	{
@@ -1880,8 +1880,8 @@ write_object_file ()
       obj_emit_strings (&next_object_file_charP);
 
 #ifdef BFD_HEADERS
-    bfd_seek (stdoutput, 0, 0);
-    bfd_write (the_object_file, 1, object_file_size, stdoutput);
+    bfd_seek (stdoutput, (file_ptr) 0, 0);
+    bfd_bwrite (the_object_file, (bfd_size_type) object_file_size, stdoutput);
 #else
 
     /* Write the data to the file.  */
Index: gas/config/obj-coff.c
===================================================================
RCS file: /cvs/src/src/gas/config/obj-coff.c,v
retrieving revision 1.51
diff -u -p -w -r1.51 obj-coff.c
--- obj-coff.c	2001/08/09 14:42:07	1.51
+++ obj-coff.c	2001/09/17 09:28:20
@@ -2059,8 +2059,8 @@ do_relocs_for (abfd, h, file_cursor)
 #endif
 
 	      /* Write out the reloc table */
-	      bfd_write ((PTR) external_reloc_vec, 1, external_reloc_size,
-			 abfd);
+	      bfd_bwrite ((PTR) external_reloc_vec,
+			  (bfd_size_type) external_reloc_size, abfd);
 	      free (external_reloc_vec);
 
 	      /* Fill in section header info.  */
@@ -2202,7 +2202,7 @@ fill_section (abfd, h, file_cursor)
 	    {
 	      if (s->s_scnptr != 0)
 		{
-		  bfd_write (buffer, s->s_size, 1, abfd);
+		  bfd_bwrite (buffer, s->s_size, abfd);
 		  *file_cursor += s->s_size;
 		}
 	      free (buffer);
@@ -2226,7 +2226,7 @@ coff_header_append (abfd, h)
   unsigned long string_size = 4;
 #endif
 
-  bfd_seek (abfd, 0, 0);
+  bfd_seek (abfd, (file_ptr) 0, 0);
 
 #ifndef OBJ_COFF_OMIT_OPTIONAL_HEADER
   H_SET_MAGIC_NUMBER (h, COFF_MAGIC);
@@ -2242,8 +2242,8 @@ coff_header_append (abfd, h)
 
   i = bfd_coff_swap_filehdr_out (abfd, &h->filehdr, buffer);
 
-  bfd_write (buffer, i, 1, abfd);
-  bfd_write (buffero, H_GET_SIZEOF_OPTIONAL_HEADER (h), 1, abfd);
+  bfd_bwrite (buffer, (bfd_size_type) i, abfd);
+  bfd_bwrite (buffero, (bfd_size_type) H_GET_SIZEOF_OPTIONAL_HEADER (h), abfd);
 
   for (i = SEG_E0; i < SEG_LAST; i++)
     {
@@ -2268,7 +2268,7 @@ coff_header_append (abfd, h)
 					   buffer);
 	  if (size == 0)
 	    as_bad (_("bfd_coff_swap_scnhdr_out failed"));
-	  bfd_write (buffer, size, 1, abfd);
+	  bfd_bwrite (buffer, (bfd_size_type) size, abfd);
 	}
     }
 }
@@ -3395,7 +3395,7 @@ do_linenos_for (abfd, h, file_cursor)
 
 	  s->scnhdr.s_lnnoptr = *file_cursor;
 
-	  bfd_write (buffer, 1, s->scnhdr.s_nlnno * LINESZ, abfd);
+	  bfd_bwrite (buffer, (bfd_size_type) s->scnhdr.s_nlnno * LINESZ, abfd);
 	  free (buffer);
 
 	  *file_cursor += s->scnhdr.s_nlnno * LINESZ;
@@ -3618,7 +3618,8 @@ write_object_file ()
     w_symbols (abfd, buffer1, symbol_rootP);
     if (string_byte_count > 0)
       w_strings (buffer1 + symtable_size);
-    bfd_write (buffer1, 1, symtable_size + string_byte_count, abfd);
+    bfd_bwrite (buffer1, (bfd_size_type) symtable_size + string_byte_count,
+		abfd);
     free (buffer1);
   }
 
Index: gas/config/obj-elf.c
===================================================================
RCS file: /cvs/src/src/gas/config/obj-elf.c,v
retrieving revision 1.37
diff -u -p -w -r1.37 obj-elf.c
--- obj-elf.c	2001/09/11 16:46:38	1.37
+++ obj-elf.c	2001/09/17 09:28:22
@@ -721,7 +721,7 @@ obj_elf_change_section (name, type, attr
 	  & (SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_CODE
 	     | SEC_EXCLUDE | SEC_SORT_ENTRIES | SEC_MERGE | SEC_STRINGS))
 	as_warn (_("Ignoring changed section attributes for %s"), name);
-      else if ((flags & SEC_MERGE) && old_sec->entsize != entsize)
+      else if ((flags & SEC_MERGE) && old_sec->entsize != (unsigned) entsize)
 	as_warn (_("Ignoring changed section entity size for %s"), name);
     }
 
Index: gas/config/tc-arc.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-arc.c,v
retrieving revision 1.15
diff -u -p -w -r1.15 tc-arc.c
--- tc-arc.c	2001/07/23 14:02:12	1.15
+++ tc-arc.c	2001/09/17 09:28:24
@@ -1631,9 +1631,7 @@ void
 arc_code_symbol (expressionP)
      expressionS *expressionP;
 {
-  if (expressionP->X_op == O_symbol && expressionP->X_add_number == 0
-      /* I think this test is unnecessary but just as a sanity check...  */
-      && expressionP->X_op_symbol == NULL)
+  if (expressionP->X_op == O_symbol && expressionP->X_add_number == 0)
     {
       expressionS two;
       expressionP->X_op = O_right_shift;
Index: gas/config/tc-mn10300.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-mn10300.c,v
retrieving revision 1.27
diff -u -p -w -r1.27 tc-mn10300.c
--- tc-mn10300.c	2001/07/30 06:15:49	1.27
+++ tc-mn10300.c	2001/09/17 09:28:30
@@ -92,7 +92,7 @@ static int reg_name_search PARAMS ((cons
 static boolean data_register_name PARAMS ((expressionS *expressionP));
 static boolean address_register_name PARAMS ((expressionS *expressionP));
 static boolean other_register_name PARAMS ((expressionS *expressionP));
-static void set_arch_mach PARAMS ((int));
+static void set_arch_mach PARAMS ((unsigned int));
 
 /*  Set linkrelax here to avoid fixups in most sections.  */
 int linkrelax = 1;
@@ -2130,7 +2130,7 @@ check_operand (insn, operand, val)
 
 static void
 set_arch_mach (mach)
-     int mach;
+     unsigned int mach;
 {
   if (!bfd_set_arch_mach (stdoutput, bfd_arch_mn10300, mach))
     as_warn (_("could not set architecture and machine"));
Index: gas/config/tc-tic54x.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-tic54x.c,v
retrieving revision 1.6
diff -u -p -w -r1.6 tc-tic54x.c
--- tc-tic54x.c	2001/03/08 23:24:25	1.6
+++ tc-tic54x.c	2001/09/17 09:28:36
@@ -2388,7 +2388,7 @@ tic54x_mlib (ignore)
       FILE *ftmp;
 
       /* We're not sure how big it is, but it will be smaller than "size".  */
-      bfd_read (buf, size, 1, mbfd);
+      bfd_bread (buf, size, mbfd);
 
       /* Write to a temporary file, then use s_include to include it
 	 a bit of a hack.  */

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

* ld changes for the bfd/ cleanup
       [not found]             ` <20010918192318.R27386@bubble.sa.bigpond.net.au>
                                 ` (3 preceding siblings ...)
  2001-09-18  3:06               ` gas " Alan Modra
@ 2001-09-18  3:09               ` Alan Modra
  4 siblings, 0 replies; 22+ messages in thread
From: Alan Modra @ 2001-09-18  3:09 UTC (permalink / raw)
  To: binutils

ld/ChangeLog
	* deffilep.y (def_stash_module): Constify "name" param.

	* pe-dll.c: Replace CONST with const throughout.
	(quick_symbol): Constify "n1", "n2", "n3" params.
	(make_singleton_name_thunk): Constify "import" param.  Make
	"buffer_len" a size_t.
	(make_import_fixup_entry): Constify "name", "fixup_name",
	"dll_symname" params.
	(pe_get16): Cast args of bfd_seek.  Replace bfd_read with bfd_bread.
	(pe_get32): Likewise.
	(pe_implied_import_dll): Likewise.

	* emultempl/beos.em (sort_by_file_name): Constify "ra", "rb".
	(sort_by_section_name): Likewise.

	* emultempl/pe.em: Move defines for arm_epoc_pe before bfd.h included.
	(make_import_fixup): Cast printf arg, rel->address to long rather
	than int.
	(gld_${EMULATION_NAME}_after_open): Don't compare NULL against int.

Index: ld/deffilep.y
===================================================================
RCS file: /cvs/src/src/ld/deffilep.y,v
retrieving revision 1.7
diff -u -p -w -r1.7 deffilep.y
--- deffilep.y	2001/08/21 11:42:57	1.7
+++ deffilep.y	2001/09/17 09:28:56
@@ -83,7 +83,7 @@ static void def_heapsize PARAMS ((int, i
 static void def_import
   PARAMS ((const char *, const char *, const char *, const char *, int));
 static void def_library PARAMS ((const char *, int));
-static def_file_module *def_stash_module PARAMS ((def_file *, char *));
+static def_file_module *def_stash_module PARAMS ((def_file *, const char *));
 static void def_name PARAMS ((const char *, int));
 static void def_section PARAMS ((const char *, int));
 static void def_section_alt PARAMS ((const char *, const char *));
@@ -495,7 +495,7 @@ def_file_add_export (def, external_name,
 static def_file_module *
 def_stash_module (def, name)
      def_file *def;
-     char *name;
+     const char *name;
 {
   def_file_module *s;
   for (s=def->modules; s; s=s->next)
Index: ld/pe-dll.c
===================================================================
RCS file: /cvs/src/src/ld/pe-dll.c,v
retrieving revision 1.28
diff -u -p -w -r1.28 pe-dll.c
--- pe-dll.c	2001/09/14 14:19:05	1.28
+++ pe-dll.c	2001/09/17 09:28:59
@@ -281,14 +281,16 @@ static void generate_reloc PARAMS ((bfd 
 static void quoteput PARAMS ((char *, FILE *, int));
 static asection *quick_section PARAMS ((bfd *, const char *, int, int));
 static void quick_symbol
-  PARAMS ((bfd *, char *, char *, char *, asection *, int, int));
+  PARAMS ((bfd *, const char *, const char *, const char *,
+	   asection *, int, int));
 static void quick_reloc PARAMS ((bfd *, int, int, int));
 static bfd *make_head PARAMS ((bfd *));
 static bfd *make_tail PARAMS ((bfd *));
 static bfd *make_one PARAMS ((def_file_export *, bfd *));
-static bfd *make_singleton_name_thunk PARAMS ((char *, bfd *));
+static bfd *make_singleton_name_thunk PARAMS ((const char *, bfd *));
 static char *make_import_fixup_mark PARAMS ((arelent *));
-static bfd *make_import_fixup_entry PARAMS ((char *, char *, char *, bfd *));
+static bfd *make_import_fixup_entry
+  PARAMS ((const char *, const char *, const char *, bfd *));
 static unsigned int pe_get16 PARAMS ((bfd *, int));
 static unsigned int pe_get32 PARAMS ((bfd *, int));
 static unsigned int pe_as32 PARAMS ((void *));
@@ -988,7 +990,7 @@ static struct sec *current_sec;
 void
 pe_walk_relocs_of_symbol (info, name, cb)
      struct bfd_link_info *info;
-     CONST char *name;
+     const char *name;
      int (*cb) (arelent *, asection *);
 {
   bfd *b;
@@ -1474,9 +1476,9 @@ quick_section (abfd, name, flags, align)
 static void
 quick_symbol (abfd, n1, n2, n3, sec, flags, addr)
      bfd *abfd;
-     char *n1;
-     char *n2;
-     char *n3;
+     const char *n1;
+     const char *n2;
+     const char *n3;
      asection *sec;
      int flags;
      int addr;
@@ -1893,7 +1895,7 @@ make_one (exp, parent)
 
 static bfd *
 make_singleton_name_thunk (import, parent)
-     char *import;
+     const char *import;
      bfd *parent;
 {
   /* Name thunks go to idata$4.  */
@@ -1941,7 +1943,7 @@ make_import_fixup_mark (rel)
   /* We convert reloc to symbol, for later reference.  */
   static int counter;
   static char *fixup_name = NULL;
-  static unsigned int buffer_len = 0;
+  static size_t buffer_len = 0;
   
   struct symbol_cache_entry *sym = *rel->sym_ptr_ptr;
   
@@ -1989,9 +1991,9 @@ make_import_fixup_mark (rel)
 
 static bfd *
 make_import_fixup_entry (name, fixup_name, dll_symname,parent)
-     char *name;
-     char *fixup_name;
-     char *dll_symname;
+     const char *name;
+     const char *fixup_name;
+     const char *dll_symname;
      bfd *parent;
 {
   asection *id3;
@@ -2046,7 +2048,7 @@ pe_create_import_fixup (rel)
   char buf[300];
   struct symbol_cache_entry *sym = *rel->sym_ptr_ptr;
   struct bfd_link_hash_entry *name_thunk_sym;
-  CONST char *name = sym->name;
+  const char *name = sym->name;
   char *fixup_name = make_import_fixup_mark (rel);
 
   sprintf (buf, U ("_nm_thnk_%s"), name);
@@ -2149,7 +2151,7 @@ pe_dll_generate_implib (def, impfilename
 static void
 add_bfd_to_link (abfd, name, link_info)
      bfd *abfd;
-     CONST char *name;
+     const char *name;
      struct bfd_link_info *link_info;
 {
   lang_input_statement_type *fake_file;
@@ -2250,8 +2252,8 @@ pe_get16 (abfd, where)
 {
   unsigned char b[2];
 
-  bfd_seek (abfd, where, SEEK_SET);
-  bfd_read (b, 1, 2, abfd);
+  bfd_seek (abfd, (file_ptr) where, SEEK_SET);
+  bfd_bread (b, (bfd_size_type) 2, abfd);
   return b[0] + (b[1] << 8);
 }
 
@@ -2262,8 +2264,8 @@ pe_get32 (abfd, where)
 {
   unsigned char b[4];
 
-  bfd_seek (abfd, where, SEEK_SET);
-  bfd_read (b, 1, 4, abfd);
+  bfd_seek (abfd, (file_ptr) where, SEEK_SET);
+  bfd_bread (b, (bfd_size_type) 4, abfd);
   return b[0] + (b[1] << 8) + (b[2] << 16) + (b[3] << 24);
 }
 
@@ -2343,8 +2345,8 @@ pe_implied_import_dll (filename)
       unsigned long vsize = pe_get32 (dll, secptr1 + 16);
       unsigned long fptr = pe_get32 (dll, secptr1 + 20);
 
-      bfd_seek (dll, secptr1, SEEK_SET);
-      bfd_read (sname, 1, 8, dll);
+      bfd_seek (dll, (file_ptr) secptr1, SEEK_SET);
+      bfd_bread (sname, (bfd_size_type) 8, dll);
 
       if (vaddr <= export_rva && vaddr + vsize > export_rva)
 	{
@@ -2356,8 +2358,8 @@ pe_implied_import_dll (filename)
     }
 
   expdata = (unsigned char *) xmalloc (export_size);
-  bfd_seek (dll, expptr, SEEK_SET);
-  bfd_read (expdata, 1, export_size, dll);
+  bfd_seek (dll, (file_ptr) expptr, SEEK_SET);
+  bfd_bread (expdata, (bfd_size_type) export_size, dll);
   erva = expdata - export_rva;
 
   if (pe_def_file == 0)
Index: ld/emultempl/beos.em
===================================================================
RCS file: /cvs/src/src/ld/emultempl/beos.em,v
retrieving revision 1.15
diff -u -p -w -r1.15 beos.em
--- beos.em	2001/09/03 07:29:50	1.15
+++ beos.em	2001/09/17 09:29:01
@@ -461,8 +461,8 @@ sort_by_file_name (a, b)
      const PTR a;
      const PTR b;
 {
-  lang_statement_union_type **ra = a;
-  lang_statement_union_type **rb = b;
+  const lang_statement_union_type *const *ra = a;
+  const lang_statement_union_type *const *rb = b;
   int i, a_sec, b_sec;
 
   i = strcmp ((*ra)->input_section.ifile->the_bfd->my_archive->filename,
@@ -518,8 +518,8 @@ sort_by_section_name (a, b)
      const PTR a;
      const PTR b;
 {
-  lang_statement_union_type **ra = a;
-  lang_statement_union_type **rb = b;
+  const lang_statement_union_type *const *ra = a;
+  const lang_statement_union_type *const *rb = b;
   int i;
   i = strcmp ((*ra)->input_section.section->name,
 		 (*rb)->input_section.section->name);
Index: ld/emultempl/pe.em
===================================================================
RCS file: /cvs/src/src/ld/emultempl/pe.em,v
retrieving revision 1.51
diff -u -p -w -r1.51 pe.em
--- pe.em	2001/09/12 15:54:37	1.51
+++ pe.em	2001/09/17 09:29:02
@@ -33,6 +33,18 @@ Foundation, Inc., 59 Temple Place - Suit
    only determine if the subsystem is console or windows in order to select
    the correct entry point by default. */
 
+#define TARGET_IS_${EMULATION_NAME}
+
+/* Do this before including bfd.h, so we prototype the right functions.  */
+#ifdef TARGET_IS_arm_epoc_pe
+#define bfd_arm_pe_allocate_interworking_sections \
+	bfd_arm_epoc_pe_allocate_interworking_sections
+#define bfd_arm_pe_get_bfd_for_interworking \
+	bfd_arm_epoc_pe_get_bfd_for_interworking
+#define bfd_arm_pe_process_before_allocation \
+	bfd_arm_epoc_pe_process_before_allocation
+#endif
+
 #include "bfd.h"
 #include "sysdep.h"
 #include "bfdlink.h"
@@ -59,8 +71,6 @@ Foundation, Inc., 59 Temple Place - Suit
 
 #include <ctype.h>
 
-#define TARGET_IS_${EMULATION_NAME}
-
 /* Permit the emulation parameters to override the default section
    alignment by setting OVERRIDE_SECTION_ALIGNMENT.  FIXME: This makes
    it seem that include/coff/internal.h should not define
@@ -94,15 +104,6 @@ Foundation, Inc., 59 Temple Place - Suit
 #define PE_DEF_FILE_ALIGNMENT		0x00000200
 #endif
 
-#ifdef TARGET_IS_arm_epoc_pe
-#define bfd_arm_pe_allocate_interworking_sections \
-	bfd_arm_epoc_pe_allocate_interworking_sections
-#define bfd_arm_pe_get_bfd_for_interworking \
-	bfd_arm_epoc_pe_get_bfd_for_interworking
-#define bfd_arm_pe_process_before_allocation \
-	bfd_arm_epoc_pe_process_before_allocation
-#endif
-
 static void gld_${EMULATION_NAME}_set_symbols PARAMS ((void));
 static void gld_${EMULATION_NAME}_after_open PARAMS ((void));
 static void gld_${EMULATION_NAME}_before_parse PARAMS ((void));
@@ -853,8 +854,8 @@ make_import_fixup (rel, s)
 
   if (pe_dll_extra_pe_debug)
     {
-      printf ("arelent: %s@%#x: add=%li\n", sym->name,
-              (int) rel->address, rel->addend);
+      printf ("arelent: %s@%#lx: add=%li\n", sym->name,
+              (long) rel->address, (long) rel->addend);
     }
 
   {
@@ -979,7 +980,7 @@ gld_${EMULATION_NAME}_after_open ()
      FIXME: This should be done via a function, rather than by
      including an internal BFD header.  */
 
-  if (coff_data (output_bfd) == NULL || coff_data (output_bfd)->pe == NULL)
+  if (coff_data (output_bfd) == NULL || coff_data (output_bfd)->pe == 0)
     einfo (_("%F%P: PE operations on non PE file.\n"));
 
   pe_data (output_bfd)->pe_opthdr = pe;

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

* Re: bfd_read and bfd_write
@ 2001-09-18  3:32 Alan Modra
  0 siblings, 0 replies; 22+ messages in thread
From: Alan Modra @ 2001-09-18  3:32 UTC (permalink / raw)
  To: binutils

First try at posting this foiled by the 400k limit.
Heh.  Anyone who wants the diff mailed to them, let me know.  Probably
easier for most of the people interested in it to "cp -la src_tree save;
cvs update; diff" themseleves, or simply use cvs diff.

On Thu, Sep 06, 2001 at 06:32:13PM +0100, Nick Clifton wrote:
> 
> I like the idea of adding the new interface, with new function names,
> and a warning message being generated if the old interface is used, as
> part of the current CVS sources/forthcoming release.  Then in the
> release after that, we can remove the old interface.

OK, that's what I've done.  Compiling anything that calls bfd_read gets
a runtime nag warning, and the shared lib version has been bumped.

So, here we go, an enormous cleanup patch that no one in their right mind
would start working on.  Apologies for its size, and for not splitting
out the bugfixes in the following.  I expect nobody will review it in
its entirety, but the changelog below should alert anyone interested in
seeing what has changed on their turf.

For those who don't want to even look at the ChangeLog, here's a quick
summary of changes beyond just killing -Wconversion warnings or
formatting fixes:

o  bfd_read and bfd_write lose an unnecessary param and become
   bfd_bread and bfd_bwrite.

o  bfd_*alloc now all take a bfd_size_type arg, and will error if
   size_t is too small.  eg. 32 bit host, 64 bit bfd, verrry big files
   or bugs in linker scripts etc.

o  file_ptr becomes a bfd_signed_vma.  Besides matching sizes with
   various other types involved in handling sections, this should make
   it easier for bfd to support a 64 bit off_t on 32 bit hosts that
   provide it.

o  I've made the H_GET_* and H_PUT_* macros (which invoke bfd_h_{get,put}_*)
   generally available.  They now cast their args to bfd_vma and
   bfd_byte * as appropriate, which removes a swag of casts from the
   source.   

o  Bug fixes to bfd_get8, aix386_core_vec, elf32_h8_relax_section, and
   aout-encap.c.

Caveats: Some of the core file handling code, and som.c, can only be
compiled natively.  I'll be pleasantly surprised if I haven't temporarily
broken something.  Feel free to throw (virtual) bricks.

One last thing: I fixed copyright dates after this diff, so those changes
don't appear here.  You'll also see that the diff is done with -w, which
trims its size by about 500k.

-- 
Alan Modra

bfd/ChangeLog
	* libbfd.c (bfd_bread): New function replacing bfd_read without
	redundant params.  Allow reads up to (size_t) -2 in length.
	(bfd_bwrite): Similarly for bfd_write.
	(real_read): Return a size_t.
	(bfd_read): Call bfd_bread.
	(bfd_write): Call bfd_bwrite.
	(warn_deprecated): New function to annoy everybody.
	(bfd_get_file_window): Don't call bfd_set_error unnecessarily.
	* bfd-in.h (bfd_bread, bfd_bwrite, warn_deprecated): Declare.
	(bfd_read, bfd_write): Define as macro.
	* aix386-core.c: Replace calls to bfd_read with bfd_bread, and
	likewise for bfd_write.  Ensure function args are correct size by
	using casts or local vars.  In some cases, remove unnecessary
	casts.  Formatting fixes, in some cases removing a large expression
	from function args by using a local var.  Replace CONST with const.
	Modify variable types to avoid warings.  Use casts to avoid
	warnings when using negative numbers in unsigned expressions.
	* aout-adobe.c: Likewise.
	* aout-arm.c: Likewise.
	* aout-cris.c: Likewise.
	* aout-encap.c: Likewise.
	* aout-ns32k.c: Likewise.
	* aout-target.h: Likewise.
	* aout-tic30.c: Likewise.
	* aoutf1.h: Likewise.
	* aoutx.h: Likewise.
	* archive.c: Likewise.
	* archures.c: Likewise.
	* bfd-in.h: Likewise.
	* bfd.c: Likewise.
	* binary.c: Likewise.
	* bout.c: Likewise.
	* cache.c: Likewise.
	* cisco-core.c: Likewise.
	* coff-a29k.c: Likewise.
	* coff-alpha.c: Likewise.
	* coff-arm.c: Likewise.
	* coff-h8300.c: Likewise.
	* coff-h8500.c: Likewise.
	* coff-i386.c: Likewise.
	* coff-i860.c: Likewise.
	* coff-i960.c: Likewise.
	* coff-ia64.c: Likewise.
	* coff-m68k.c: Likewise.
	* coff-m88k.c: Likewise.
	* coff-mcore.c: Likewise.
	* coff-mips.c: Likewise.
	* coff-ppc.c: Likewise.
	* coff-rs6000.c: Likewise.
	* coff-sh.c: Likewise.
	* coff-sparc.c: Likewise.
	* coff-stgo32.c: Likewise.
	* coff-tic30.c: Likewise.
	* coff-tic54x.c: Likewise.
	* coff-tic80.c: Likewise.
	* coff-w65.c: Likewise.
	* coff-z8k.c: Likewise.
	* coff64-rs6000.c: Likewise.
	* coffcode.h: Likewise.
	* coffgen.c: Likewise.
	* cofflink.c: Likewise.
	* coffswap.h: Likewise.
	* corefile.c: Likewise.
	* cpu-arc.c: Likewise.
	* cpu-h8300.c: Likewise.
	* cpu-h8500.c: Likewise.
	* cpu-i960.c: Likewise.
	* cpu-ia64-opc.c: Likewise.
	* cpu-ns32k.c: Likewise.
	* cpu-pdp11.c: Likewise.
	* cpu-pj.c: Likewise.
	* cpu-sh.c: Likewise.
	* cpu-w65.c: Likewise.
	* cpu-z8k.c: Likewise.
	* dwarf1.c: Likewise.
	* dwarf2.c: Likewise.
	* ecoff.c: Likewise.
	* ecofflink.c: Likewise.
	* ecoffswap.h: Likewise.
	* elf-bfd.h: Likewise.
	* elf-hppa.h: Likewise.
	* elf-m10200.c: Likewise.
	* elf-m10300.c: Likewise.
	* elf.c: Likewise.
	* elf32-arc.c: Likewise.
	* elf32-arm.h: Likewise.
	* elf32-avr.c: Likewise.
	* elf32-cris.c: Likewise.
	* elf32-fr30.c: Likewise.
	* elf32-gen.c: Likewise.
	* elf32-h8300.c: Likewise.
	* elf32-hppa.c: Likewise.
	* elf32-i370.c: Likewise.
	* elf32-i386.c: Likewise.
	* elf32-i860.c: Likewise.
	* elf32-m32r.c: Likewise.
	* elf32-m68k.c: Likewise.
	* elf32-mcore.c: Likewise.
	* elf32-mips.c: Likewise.
	* elf32-openrisc.c: Likewise.
	* elf32-pj.c: Likewise.
	* elf32-ppc.c: Likewise.
	* elf32-s390.c: Likewise.
	* elf32-sh-lin.c: Likewise.
	* elf32-sh.c: Likewise.
	* elf32-sparc.c: Likewise.
	* elf32-v850.c: Likewise.
	* elf64-alpha.c: Likewise.
	* elf64-hppa.c: Likewise.
	* elf64-mips.c: Likewise.
	* elf64-ppc.c: Likewise.
	* elf64-s390.c: Likewise.
	* elf64-sparc.c: Likewise.
	* elf64-x86-64.c: Likewise.
	* elfarm-nabi.c: Likewise.
	* elfcode.h: Likewise.
	* elfcore.h: Likewise.
	* elflink.c: Likewise.
	* elflink.h: Likewise.
	* elfxx-ia64.c: Likewise.
	* elfxx-target.h: Likewise.
	* format.c: Likewise.
	* hash.c: Likewise.
	* hp300hpux.c: Likewise.
	* hppabsd-core.c: Likewise.
	* hpux-core.c: Likewise.
	* i386aout.c: Likewise.
	* i386dynix.c: Likewise.
	* i386linux.c: Likewise.
	* i386lynx.c: Likewise.
	* i386mach3.c: Likewise.
	* i386msdos.c: Likewise.
	* i386os9k.c: Likewise.
	* ieee.c: Likewise.
	* ihex.c: Likewise.
	* irix-core.c: Likewise.
	* libaout.h: Likewise.
	* libbfd-in.h: Likewise.
	* libbfd.c: Likewise.
	* libcoff-in.h: Likewise.
	* libecoff.h: Likewise.
	* libieee.h: Likewise.
	* libnlm.h: Likewise.
	* libpei.h: Likewise.
	* libxcoff.h: Likewise.
	* linker.c: Likewise.
	* lynx-core.c: Likewise.
	* m68klinux.c: Likewise.
	* merge.c: Likewise.
	* mipsbsd.c: Likewise.
	* netbsd-core.c: Likewise.
	* nlm.c: Likewise.
	* nlm32-alpha.c: Likewise.
	* nlm32-i386.c: Likewise.
	* nlm32-ppc.c: Likewise.
	* nlm32-sparc.c: Likewise.
	* nlmcode.h: Likewise.
	* nlmswap.h: Likewise.
	* ns32k.h: Likewise.
	* oasys.c: Likewise.
	* opncls.c: Likewise.
	* osf-core.c: Likewise.
	* pc532-mach.c: Likewise.
	* pdp11.c: Likewise.
	* pe-mips.c: Likewise.
	* peXXigen.c: Likewise.
	* peicode.h: Likewise.
	* ppcboot.c: Likewise.
	* ptrace-core.c: Likewise.
	* reloc.c: Likewise.
	* reloc16.c: Likewise.
	* riscix.c: Likewise.
	* rs6000-core.c: Likewise.
	* sco5-core.c: Likewise.
	* section.c: Likewise.
	* som.c: Likewise.
	* sparclinux.c: Likewise.
	* sparclynx.c: Likewise.
	* srec.c: Likewise.
	* stabs.c: Likewise.
	* sunos.c: Likewise.
	* syms.c: Likewise.
	* targets.c: Likewise.
	* tekhex.c: Likewise.
	* trad-core.c: Likewise.
	* versados.c: Likewise.
	* vms-gsd.c: Likewise.
	* vms-hdr.c: Likewise.
	* vms-misc.c: Likewise.
	* vms-tir.c: Likewise.
	* vms.c: Likewise.
	* vms.h: Likewise.
	* xcofflink.c: Likewise.
	* bfd-in2.h: Regenerate.
	* libbfd.h: Regenerate.
	* libcoff.h: Regenerate.

	* bfd.c (struct _bfd): Make "where" and "origin" unsigned.
	* bfd-in.h (file_ptr): Change from a long int to a bfd_signed_vma.
	(ufile_ptr): Define.
	(bfd_tell): Return a ufile_ptr.
	* libbfd.c (bfd_tell): Likewise.
	(bfd_seek): Use bfd_size_type locals.  Don't call bfd_set_error
	unnecessarily.
	* aix386-core.c: Test != 0 for bfd_seek errors rather than < 0.
	* aoutf1.h: Likewise.
	* som.c: Likewise.
	* cache.c (bfd_cache_lookup_worker): Guard against abfd->where
	larger than unsigned long can represent.

	* libbfd.c (bfd_malloc): Take a bfd_size_type arg.  Error if
	size overflows size_t.
	(bfd_realloc): Likewise.
	(bfd_zmalloc): Likewise.
	* opncls.c (bfd_alloc): Likewise.
	(bfd_zalloc): Likewise.
	* libbfd-in.h (bfd_malloc, bfd_realloc, bfd_zmalloc): Update.
	(bfd_alloc, bfd_zalloc): Update.

	* libbfd.c (bfd_get_8): Mask with 0xff in case char is more than
	8 bits.
	(bfd_get_signed_8): Likewise.
	(H_PUT_64, H_PUT_32, H_PUT_16, H_PUT_8,
	H_PUT_S64, H_PUT_S32, H_PUT_S16, H_PUT_S8,
	H_GET_64, H_GET_32, H_GET_16, H_GET_8,
	H_GET_S64, H_GET_S32, H_GET_S16, H_GET_S8): Define and use.
	* libaout.h: Likewise define and use here.
	* aout-adobe.c: Use H_GET_* and H_PUT_* macros.
	* aout-arm.c: Likewise.
	* aout-encap.c: Likewise.
	* aout-ns32k.c: Likewise.
	* aout-tic30.c: Likewise.
	* aoutf1.h: Likewise.
	* aoutx.h: Likewise.
	* bout.c: Likewise.
	* coff-alpha.c: Likewise.
	* coff-h8300.c: Likewise.
	* coff-h8500.c: Likewise.
	* coff-i960.c: Likewise.
	* coff-ia64.c: Likewise.
	* coff-m88k.c: Likewise.
	* coff-mips.c: Likewise.
	* coff-ppc.c: Likewise.
	* coff-rs6000.c: Likewise.
	* coff-sh.c: Likewise.
	* coff-sparc.c: Likewise.
	* coff-stgo32.c: Likewise.
	* coff-tic30.c: Likewise.
	* coff-tic80.c: Likewise.
	* coff-w65.c: Likewise.
	* coff-z8k.c: Likewise.
	* coff64-rs6000.c: Likewise.
	* coffgen.c: Likewise.
	* cofflink.c: Likewise.
	* coffswap.h: Likewise.
	* ecoff.c: Likewise.
	* ecoffswap.h: Likewise.
	* elf.c: Likewise.
	* elf32-mips.c: Likewise.
	* elf64-mips.c: Likewise.
	* hp300hpux.c: Likewise.
	* i386dynix.c: Likewise.
	* i386lynx.c: Likewise.
	* i386msdos.c: Likewise.
	* i386os9k.c: Likewise.
	* libpei.h: Likewise.
	* nlm32-alpha.c: Likewise.
	* nlm32-i386.c: Likewise.
	* nlm32-ppc.c: Likewise.
	* nlmcode.h: Likewise.
	* nlmswap.h: Likewise.
	* oasys.c: Likewise.
	* pdp11.c: Likewise.
	* pe-mips.c: Likewise.
	* peXXigen.c: Likewise.
	* peicode.h: Likewise.
	* riscix.c: Likewise.
	* sunos.c: Likewise.
	* xcofflink.c: Likewise.
	* elfcode.h: (put_word, get_word, put_signed_word, get_signed_word):
	Rename to H_PUT_WORD, H_GET_WORD, H_PUT_SIGNED_WORD, H_GET_SIGNED_WORD.
	* coff-rs6000.c (PUTWORD, PUTHALF, PUTBYTE): Don't define. Use
	equivalent H_PUT_* macro instead.
	(GETWORD, GETHALF, GETBYTE): Similarly.
	* coff64-rs6000.c (PUTWORD, PUTHALF, PUTBYTE): Likewise.
	(GETWORD, GETHALF, GETBYTE): Likewise.
	* coffswap.h (PUTWORD, PUTHALF, PUTBYTE): Likewise.

	* bfd-in.h (struct orl): Change "pos" to a union.
	* archive.c (_bfd_compute_and_write_armap): Use it instead of casts.
	(bsd_write_armap): Here too.
	(coff_write_armap): And here.
	* coff-rs6000.c (xcoff_write_armap_old): And here.
	(xcoff_write_one_armap_big): And here.
	(xcoff_write_armap_big): And here.
	* ecoff.c (_bfd_ecoff_write_armap): And here.
	* elf64-mips.c (mips_elf64_write_armap): And here.

	* aoutf1.h (sunos_set_arch_mach): Make "mach" param an enum.
	* elf-m10300.c (elf_mn10300_mach): Return an unsigned long.
	* elf32-h8300.c (elf32_h8_mach): Likewise.
	* elf32-mips.c (elf_mips_mach): Likewise.
	* sparclynx.c (NAME(lynx,set_arch_mach)): Likewise.

	* aix386-core.c (aix386_core_file_p): Remove redundant bfd_release
	calls.
	(aix386_core_vec): Typo fix.

	* aout-arm.c: Include libaout.h and aout/aout64.h after N_TXTADDR
	etc. to avoid redefined macro warning.
	(MY(put_reloc)): Use bfd_vma for "value" rather than long.
	(MY(fix_pcrel_26)): Likewise.
	* aout-ns32k.c (MY(put_reloc)): Likewise.
	* aout-cris.c (MY(swap_ext_reloc_out)): Likewise for r_addend.
	* aoutx.h (NAME(aout,swap_ext_reloc_out)): Likewise.
	* coff-arm.c (coff_arm_relocate_section): Likewise for my_offset.

	* aout-encap.c: Include "file", not <file> for binutils headers.
	(encap_object_p): Half baked attempt to fix compile errors in
	code dealing with "magic".

	* aout-ns32k.c: Include "file", not <file> for binutils headers.
	(_bfd_ns32k_relocate_contents): get_data and put_data manipulate
	bfd_vma's rather than longs.
	* cpu-ns32k.c (ns32k_sign_extend): Delete.
	(_bfd_ns32k_get_displacement): Return a bfd_vma, don't pass in offset.
	(_bfd_ns32k_get_immediate): Likewise.  Add code for 8 byte values,
	remove case 3.
	(_bfd_ns32k_put_displacement): Accept a bfd_vma, don't pass in offset.
	Use unsigned comparisons.
	(bfd_ns32k_put_immediate): Likewise, and add code for 8 byte values.
	(do_ns32k_reloc): get_data and put_data operate on bfd_vma's.
	(_bfd_do_ns32k_reloc_contents): Likewise.
	* ns32k.h (_bfd_ns32k_get_displacement): Update prototype.
	(_bfd_ns32k_get_immediate): Likewise.
	(_bfd_ns32k_put_displacement): Likewise.
	(_bfd_ns32k_put_immediate): Likewise.
	(bfd_reloc_status_type): Likewise.

	* aoutx.h (NAME(aout,find_nearest_line)): Rename 'p' to 'colon'
	to avoid shadowing.
	* pdp11.c (NAME(aout,find_nearest_line)): Likewise.
	* coff-h8300.c (h8300_reloc16_extra_cases): Remove shadowing "value".
	* coff-ppc.c (enum ref_category): Rename "data" to "tocdata" to
	avoid shadowing.
	(record_toc): Use a bfd_signed_vma for our_toc_offset.
	* coffcode.h (coff_write_relocs): Rename "i" to avoid shadowing.
	* elf.c (bfd_elf_get_bfd_needed_list): Rename "link" var to avoid
	shadow warning.
	(_bfd_elfcore_strndup): Likewise for "dup".
	* elf32-cris.c (cris_elf_relocate_section): "symname" instead of
	"name" to avoid shadowing.
	* elf32-hppa.c (elf32_hppa_relocate_section): Remove duplicate
	definition of "off".
	* elf32-i386.c (elf_i386_relocate_section): Likewise.
	* elf32-mips.c (_bfd_mips_elf_modify_segment_map): Remove duplicate
	definition of "s".
	(_bfd_mips_elf_final_link): Rename "i" to "j".  Remove duplicate
	"secpp".
	* elf64-x86-64.c (elf64_x86_64_relocate_section): Rename inner "indx"
	to avoid shadowing.
	* elflink.h (elf_link_add_object_symbols): Rename "link" to "shlink"
	to avoid shadowing.
	(elf_link_input_bfd): Likewise.
	(elf_bfd_final_link): Remove duplicate innermost "off" var.
	* oasys.c (oasys_write_data): Rename innermost "p" to "sym".
	* reloc16.c (bfd_coff_reloc16_relax_section): Rename "i" param to
	"input_section".
	* som.c (som_prep_for_fixups): Rename inner "i" to "j".
	* sunos.c (sunos_add_dynamic_symbols): Localise "s" var.
	(sunos_write_dynamic_symbol): Remove unused vars.
	* syms.c (_bfd_stab_section_find_nearest_line): Remove duplicate
	innermost "directory_name" and "file_name" vars.
	* tekhex.c (first_phase): Rename local var "type" to "stype".
	(tekhex_write_object_contents): Rename innermost "s" to "sym".
	* vms-gsd.c (vms_secflag_by_name): Change "size" param to "hassize",
	doing comparison at caller.
	(vms_esecflag_by_name): Likewise.
	* vms-tir.c (etir_sto): Rename innermost "psect" to "psect1".
	* xcofflink.c (xcoff_link_input_bfd): Delete duplicate innermost "o".
	(xcoff_write_global_symbol): Rename "p" param to "inf".

	* cisco-core.c: Add missing prototypes.
	(cisco_core_file_failing_command): Add ATTRIBUTE_UNUSED.
	(cisco_core_file_failing_signal): Likewise.
	(cisco_core_file_matches_executable_p): Likewise.
	* hpux-core.c (hpux_core_core_file_failing_signal): Likewise.
	* netbsd-core.c (netbsd_core_file_matches_executable_p): Likewise.
	* osf-core.c (osf_core_core_file_matches_executable_p): Likewise.
	* sco5-core.c (sco5_core_file_matches_executable_p): Likewise.

	* coff-arm.c (coff_arm_link_hash_table): Use bfd_size_type for
	thumb_glue_size and arm_glue_size.
	* elf32-arm.h (elf32_arm_link_hash_table): Likewise here.

	* coff64-rs6000.c: Group prototypes together.

	* coffcode.h (coff_set_arch_mach): Add ATTRIBUTE_UNUSED.
	(buy_and_read): Remove "seek" param.  Change "size" to bfd_size_type.

	* cpu-arc.c: Add missing prototypes.
	* cpu-h8500.c: Likewise.
	* cpu-i960.c: Likewise.
	* cpu-pj.c: Likewise.
	* cpu-sh.c: Likewise.
	* cpu-w65.c: Likewise.
	* cpu-z8k.c: Likewise.
	* elf32-fr30.c: Likewise.
	* elf32-h8300.c: Likewise.
	* elf32-i370.c: Likewise.
	* hpux-core.c: Likewise.
	* versados.c: Likewise.

	* cpu-h8300.c (bfd_default_scan_num_mach): Don't declare.
	* cpu-h8500.c: Likewise.
	* cpu-i960.c: Likewise.
	* cpu-z8k.c: Likewise.

	* cpu-ia64-opc.c: Correct comment.

	* dwarf2.c (_bfd_dwarf2_find_nearest_line): Remove unused var.

	* elf-bfd.h (elf_size_info): Change count param of write_out_phdrs
	to unsigned.
	(bfd_elf32_write_out_phdrs): Likewise.
	(bfd_elf64_write_out_phdrs): Likewise.
	(elf_linker_section_pointers): Change addend to bfd_vma.
	(_bfd_elf_find_pointer_linker_section): Likewise.
	(_bfd_elfcore_make_pseudosection): Change size param to size_t and
	filepos to unsigned file_ptr.
	(_bfd_elfcore_strndup): Change max param to size_t.
	* elf.c (_bfd_elfcore_make_pseudosection): As above.
	(_bfd_elfcore_strndup): Likewise.
	(_bfd_elf_find_pointer_linker_section): Likewise.

	* elf-hppa.h (elf_hppa_relocate_insn): Return an int, and change
	insn and sym_value to ints.

	* elf.c (elf_read): Make "offset" param a file_ptr, "size" a
	bfd_size_type.
	(elfcore_read_notes): Likewise.

	* elf32-arm.h (elf32_arm_final_link_relocate): Change sym_flags
	param from unsigned char to int.
	(elf32_arm_relocate_section): If USE_REL, cast "rel" appropriately
	for info_to_howto call.
	(add_dynamic_entry): Define macro.
	(elf32_arm_size_dynamic_sections): Use add_dynamic_entry.

	* elf32-cris.c (add_dynamic_entry): Define macro.
	(elf_cris_size_dynamic_sections): Use add_dynamic_entry.

	* elf32-h8300.c (elf32_h8_final_write_processing): Make static.
	(elf32_h8_object_p): Likewise.
	(elf32_h8_merge_private_bfd_data): Likewise.
	(elf32_h8_relax_section): Cast gap to int so signed comparisons work.

	* elf32-hppa.c (add_dynamic_entry): Define macro.
	(elf32_hppa_size_dynamic_sections): Use it.
	* elf32-i370.c (add_dynamic_entry): Define macro.
	(i370_elf_size_dynamic_sections): Use it.
	(i370_noop): Make static.
	* elf32-i386.c (add_dynamic_entry): Define macro.
	(elf_i386_size_dynamic_sections): Use it.
	* elf32-m68k.c (add_dynamic_entry): Define macro.
	(elf_m68k_size_dynamic_sections): Use it.
	* elf32-ppc.c (add_dynamic_entry): Define macro.
	(ppc_elf_size_dynamic_sections): Use it.
	* elf32-s390.c (add_dynamic_entry): Define macro.
	(elf_s390_size_dynamic_sections): Use it.
	* elf64-alpha.c (add_dynamic_entry): Define macro.
	(elf64_alpha_size_dynamic_sections): Use it.
	* elf64-hppa.c (add_dynamic_entry): Define macro.
	(elf64_hppa_size_dynamic_sections): Use it.
	* elf64-ppc.c (add_dynamic_entry): Define macro.
	(ppc64_elf_size_dynamic_sections): Use it.
	* elf64-s390.c (add_dynamic_entry): Define macro.
	(elf_s390_size_dynamic_sections): Use it.
	* elf64-sparc.c (add_dynamic_entry): Define macro.
	(sparc64_elf_size_dynamic_sections): Use it.
	* elf64-x86-64.c (add_dynamic_entry): Define macro.
	(elf64_x86_64_size_dynamic_sections): Use it.
	* elfxx-ia64.c (add_dynamic_entry): Define macro.
	(elfNN_ia64_size_dynamic_sections): Use it.

	* elf32-v850.c (SEXT24): Modify to avoid signed/unsigned warning.
	(v850_elf_perform_relocation): Make "r_type" param unsigned.

	* elf64-mips.c (mips_elf64_slurp_one_reloc_table): Just return
	false if the first malloc fails rather than going via error_return.

	* elf64-sparc.c (sparc64_elf_plt_entry_offset): Use a bfd_vma for
	"index" param.
	(sparc64_elf_plt_ptr_offset): Likewise, and for "max" param too.

	* elfxx-ia64.c (global_sym_index): Return a long.

	* ieee.c (get_symbol): Use int rather than char param.
	(ieee_slurp_sections): Move "section" var to inner blocks.
	(copy_expression): Don't init "value" to zero or worry about
	clearing to zero after using.
	(ieee_write_debug_part): Rename "output_buffer" to "obuff" to avoid
	shadowing.

	* ihex.c (ihex_write_record): Make "count" var a size_t, "addr" an
	unsigned int.

	* libbfd-in.h (BFD_ALIGN): Add cast to avoid signed/unsigned warning.
	(bfd_write_bigendian_4byte_int): Pass an unsigned int value param.

	* mipsbsd.c (mips_fix_jmp_addr): Add "error_message" param.

	* pc532-mach.c (MYNSX): Delete.
	(ns32kaout_bfd_reloc_type_lookup): Define prototype without MYNSX.
	(write_object_contents): Correct prototype.

	* peicode.h (pe_ILF_build_a_bfd): Use an unsigned int param rather
	than unsigned short.

	* section.c (bfd_set_section_contents): Remove redundant
	"offset < 0" test.  Check that "count" doesn't overflow size_t.
	(bfd_get_section_contents): Likewise.

	* som.c (som_fixup_formats): Add missing braces.
	(som_reloc_addend): Pass a bfd_vma for "addend".

	* srec.c (srec_write_record): Pass "type" as an unsigned int.
	(srec_write_symbols): Remove an unnecessary var.

	* targets.c (_bfd_target_vector): Sort entries.  Sort externs
	to match.
	* configure.in: Sort to match.  Bump version number.
	* configure: Regenerate.

	* tekhex.c (move_section_contents): Assert offset == 0.

	* versados.c (new_symbol_string): Constify arg.
	(process_esd): Use bfd_und_section_ptr rather than &bfd_und_section.
	(versados_get_symbol_info): Make static.
	(versados_print_symbol): Likewise.
	(versados_get_reloc_upper_bound): Likewise.
	(versados_canonicalize_reloc): Likewise.

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

end of thread, other threads:[~2001-09-18  3:32 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-09-04 22:20 bfd_read and bfd_write Alan Modra
2001-09-05  9:45 ` Andrew Cagney
2001-09-05 12:21   ` Richard Henderson
2001-09-05 17:26     ` Andrew Cagney
2001-09-05 18:52       ` Alan Modra
2001-09-05 20:03         ` Andrew Cagney
2001-09-06 10:33           ` Nick Clifton
     [not found]             ` <20010918192318.R27386@bubble.sa.bigpond.net.au>
2001-09-18  2:58               ` include/* changes for the bfd/ cleanup Alan Modra
2001-09-18  3:03               ` bfd/doc " Alan Modra
2001-09-18  3:05               ` binutils " Alan Modra
2001-09-18  3:06               ` gas " Alan Modra
2001-09-18  3:09               ` ld " Alan Modra
2001-09-05 23:15         ` bfd_read and bfd_write Andreas Jaeger
2001-09-06  0:01           ` Alan Modra
2001-09-05 20:13 ` Hans-Peter Nilsson
2001-09-05 20:30   ` Alan Modra
2001-09-08 22:42   ` Jim Blandy
2001-09-09  7:24     ` Hans-Peter Nilsson
2001-09-10  9:51       ` Ian Lance Taylor
2001-09-10 17:56         ` Hans-Peter Nilsson
2001-09-10 18:04           ` Ian Lance Taylor
2001-09-18  3:32 Alan Modra

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).