This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: objcopy - Invalid operation


Hi James,

> Tried to compile the latest 2.14 version and receiving
> the following message:
>
> % ./configure --prefix=mydir
> checking host system type... powerpc-apple-darwin6.8
> checking target system type... powerpc-apple-darwin6.8
> checking build system type... powerpc-apple-darwin6.8
> *** This configuration is not supported in the
> following subdirectories:
>      bfd binutils ld gas opcodes gprof

Correct - the 2.14 release and the current binutils sources are not
set up to supprot the MACH-O format.  Apple have their own set of
sources that do support this format and we hope that they will be
contributing them at some point in the future.

> I have attached the error_msg.o file. 

Thanks - with this I was able to solve part of the problem.  The
objcopy code was not set up to handle file formats which do not
support relocations.  This is why it was issuing the "invalid
operation" error message.  The patch attached below fixes this, so
that objcopy gracefully ignores relocations if the target does not
support them.

The patch is not sufficient to allow your symbol renaming command to
work.  Objcopy will now  fail with:

   File truncated

I have traced this into bugs/problems/features in the MACH-O specific
code in bfd, but since I am not familiar with this code, I could not
take it any further.  You will have to contact Apple and ask for their
help.

Cheers
        Nick

PS.  I will be applying this patch to the mainline sources shortly.
        
binutils/ChangeLog
2003-10-27  Nick Clifton  <nickc@redhat.com>

	* objcopy.c (copy_section): Do not complain when a target does not
	support relocations.
	(mark_symbols_used_in_relocations): Likewise.

Index: binutils/objcopy.c
===================================================================
RCS file: /cvs/src/src/binutils/objcopy.c,v
retrieving revision 1.54
diff -c -3 -p -r1.54 objcopy.c
*** binutils/objcopy.c	21 Oct 2003 14:08:12 -0000	1.54
--- binutils/objcopy.c	27 Oct 2003 12:38:08 -0000
*************** copy_section (bfd *ibfd, sec_ptr isectio
*** 1885,1894 ****
    if (bfd_get_format (obfd) == bfd_core)
      relsize = 0;
    else
!     relsize = bfd_get_reloc_upper_bound (ibfd, isection);
  
!   if (relsize < 0)
!     RETURN_NONFATAL (bfd_get_filename (ibfd));
  
    if (relsize == 0)
      bfd_set_reloc (obfd, osection, NULL, 0);
--- 1885,1901 ----
    if (bfd_get_format (obfd) == bfd_core)
      relsize = 0;
    else
!     {
!       relsize = bfd_get_reloc_upper_bound (ibfd, isection);
  
!       if (relsize < 0)
! 	{
!       /* Do not complain if the target does not support relocations.  */
! 	  if (relsize == -1 && bfd_get_error () == bfd_error_invalid_operation)
! 	    relsize = 0;
! 	  else
! 	    RETURN_NONFATAL (bfd_get_filename (ibfd));
! 	}
!     }
  
    if (relsize == 0)
      bfd_set_reloc (obfd, osection, NULL, 0);
*************** mark_symbols_used_in_relocations (bfd *i
*** 2030,2036 ****
  
    relsize = bfd_get_reloc_upper_bound (ibfd, isection);
    if (relsize < 0)
!     bfd_fatal (bfd_get_filename (ibfd));
  
    if (relsize == 0)
      return;
--- 2037,2048 ----
  
    relsize = bfd_get_reloc_upper_bound (ibfd, isection);
    if (relsize < 0)
!     {
!       /* Do not complain if the target does not support relocations.  */
!       if (relsize == -1 && bfd_get_error () == bfd_error_invalid_operation)
! 	return;
!       bfd_fatal (bfd_get_filename (ibfd));
!     }
  
    if (relsize == 0)
      return;
                


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]