Re: objcopy in binutils doesn't work on Mac OS X

2007-02-27 Thread Nick Clifton

Hi Axel,


I'm trying to rename symbols in an archive using objcopy.


Your examples below use objdump rather than objcopy.  Are you 
experiencing the same problem with both tools ?


It works perfectly under Linux, but on Mac OS X, 


Do you mean that you can run objcopy and/or objdump on the test binaries 
if you are doing so under Linux, but not if you are doing so on a OS-X 
host ?  If so then this might indicate a build problem on the OS-X host. 
 ie the compiler used to build the binutils on the OS-X host might have 
a bug in it.



using binutils 2.16.1 (from MacPorts) or 2.17 (from source), doesn't work.


Have you also tried the sources from the mainline of the binutils CVS 
repository ?


sinope:~ as49$ ar cru blah.a blah.o 
sinope:~ as49$ gobjdump -a blah.o

  blah.o: file format mach-o-le
sinope:~ as49$ gobjdump -a blah.a
  gobjdump: blah.a: File format not recognized



Here, gobjdump is version 2.16.1 from MacPorts, but 2.17 gives the same
error message. Note that ar and nm are from Apple and not GNU.



Is this a bug or simply a lacking feature?


This is a bug, although it is not clear where the bug lies.  A couple of 
quick tests might help narrow things down a bit:


  * If you use the GNU version of ar to create the library, can gobjdump
then recognise the file format of the blah.a file ?  If so, are you
able to identify the differences between blah.a created by the OS-X
tool and the blah.a created by the GNU tool ?

  * Can you run "gobjdump -a blah.a" from inside GDB and put a
breakpoint on bfd_mach_o_archive_p() (in bfd/mach-o.c) ?  Is this
function called at all ?  If so, then at what point inside the
function does it decide that the blah.a file is not a MACH OS
library file ?

Cheers
  Nick


___
bug-binutils mailing list
bug-binutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-binutils


objcopy in binutils doesn't work on Mac OS X

2007-02-26 Thread Axel Simon
Hi,

I'm trying to rename symbols in an archive using objcopy. It works
perfectly under Linux, but on Mac OS X, using binutils 2.16.1 (from
MacPorts) or 2.17 (from source), doesn't work. For example:

sinope:~ as49$ cat blah.c
int foo(int f) {
 int x;
 x=2*f;
 return x;
}

sinope:~ as49$ gcc -c blah.c -o blah.o
sinope:~ as49$ ar cru blah.a blah.o 
sinope:~ as49$ nm blah.a 

blah.a(blah.o):
 T _foo

sinope:~ as49$ gobjdump -a blah.o

blah.o: file format mach-o-le
blah.o

sinope:~ as49$ gobjdump -a blah.a
gobjdump: blah.a: File format not recognized

Here, gobjdump is version 2.16.1 from MacPorts, but 2.17 gives the same
error message. Note that ar and nm are from Apple and not GNU.
I tried to build objdump from source using

./configure --enable-64-bit-bfd --enable-targets=all

but I get an error message that the the object files are ambiguous with
respect to their format.

My machine is running Mac OS X 10.4.8 (8N1051)/Darwin 8.8.2, it is a
MacBookPro2,2 with an Intel Core 2 Duo which I assume uses a 32 bit ABI,
so I shouldn't even need the 64-bit versions. As far as I know, all
files I'm operating on are flat files.

Is this a bug or simply a lacking feature?

Any help appreciated,
Axel.




___
bug-binutils mailing list
bug-binutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-binutils