bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

64-bit long vs int problem in binutils (gas and probably others)


From: Anders Gavare
Subject: 64-bit long vs int problem in binutils (gas and probably others)
Date: Thu, 12 Dec 2002 03:35:31 +0100 (MET)

Hello,

I don't know if this is the prefered way of submitting bug reports, and
I'm sorry if this bug has been mentioned before.

It seems like the binutils assembler produces corrupt files when
compiled for the vax-dec-bsd target or vax-unknown-netbsdaout target on
a 64-bit host.  (It works and produces ok files on my PC though, but I'd
like to use an Alpha machine for development stuff.)

Building binutils (I'm trying with 2.13.1pre1) succeeds, but the 'as'
program produces corrupt output files, which cannot be read by objdump
etc.


diff -ru binutils-2.13/gas/config/aout_gnu.h 
binutils-2.13-gavare/gas/config/aout_gnu.h
--- binutils-2.13/gas/config/aout_gnu.h Sun Jul 14 03:14:22 2002
+++ binutils-2.13-gavare/gas/config/aout_gnu.h  Mon Dec  9 05:24:46 2002
@@ -91,7 +91,7 @@

 struct exec
 {
-  unsigned long a_info;                /* Use macros N_MAGIC, etc for access */
+  unsigned a_info;             /* Use macros N_MAGIC, etc for access */
   unsigned a_text;             /* length of text, in bytes */
   unsigned a_data;             /* length of data, in bytes */
   unsigned a_bss;              /* length of uninitialized data area for file, 
in bytes */


unsigned long is 64-bit, but the a_info field should be a 32-bit value.  (I
think.)

There are other bugs too. At least one more bug in 'as'. While
compiling a gcc cross-compiler, xgcc dies with the message

        xgcc: Internal error: Segmentation fault (program as)

It took some time to hunt down the bug. It seems that in gas' write.c,
in the function write_object_file(), there is a line:

        object_file_size = H_GET_FILE_SIZE (&headers);

This size is not enough to hold the resulting object file in memory, and
hence 'as' dies.  A simple hexdump of an object file produced by the
assembler on an Alpha vs produced on an i386 machine shows that the one
on the Alpha doesn't include symbols, or that it is broken somehow.

Also, perhaps the a_info field in the internal_exec struct in
bdf/libaout.h is broken too (it is a long, should probably be a 32-bit
type instead).

I do not easily find my way around the gas sources, so I cannot really
tell how to correct the bug.



Anders

PS. I'm not on the mailing list, so if someone feels like fixing the bug
then please cc me. DS.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]