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]

[PATCH] Fix objcopy compilation problems on HP-UX


The following patch fixes the errors compiling objcopy.c with
the native HP-UX C compiler.  The issue is that the "(char *)"
cast on the problematic lines masks the lvalue, causing the
following errors:


Error 337: "../../src/binutils/objcopy.c", line 801 # The left side of '='
    must be a modifiable lvalue.
              name = (char *) bfd_asymbol_name (sym) = new_name;
                              ^^^^^^^^^^^^^^^^
Error 337: "../../src/binutils/objcopy.c", line 831 # The left side of '='
    must be a modifiable lvalue.
            name = (char *) bfd_asymbol_name (sym) = name + 1;
                            ^^^^^^^^^^^^^^^^
Error 337: "../../src/binutils/objcopy.c", line 849 # The left side of '='
    must be a modifiable lvalue.
              name = (char *) bfd_asymbol_name (sym) = n;
                              ^^^^^^^^^^^^^^^^

This can be fixed trivially by assigning the value to name in a
separate statement.  The patch below allows compilation of objcopy
to complete on ia64-hp-hpux11.22.  I have binutils copyright
assignments on file, but not write access to CVS.

Ok for mainline?

Many thanks in advance.


2003-02-19  Roger Sayle  <roger at eyesopen dot com>

	* objcopy.c (filter_symbols): Fix compilation problems with
	HP-UX's C compiler.


Index: objcopy.c
===================================================================
RCS file: /cvs/src/src/binutils/objcopy.c,v
retrieving revision 1.44
diff -c -3 -p -r1.44 objcopy.c
*** objcopy.c	13 Dec 2002 13:19:44 -0000	1.44
--- objcopy.c	20 Feb 2003 01:20:31 -0000
*************** filter_symbols (abfd, obfd, osyms, isyms
*** 798,804 ****

  	  old_name = (char *) bfd_asymbol_name (sym);
  	  new_name = (char *) lookup_sym_redefinition (old_name);
! 	  name = (char *) bfd_asymbol_name (sym) = new_name;
  	}

        /* Check if we will remove the current leading character.  */
--- 798,805 ----

  	  old_name = (char *) bfd_asymbol_name (sym);
  	  new_name = (char *) lookup_sym_redefinition (old_name);
! 	  bfd_asymbol_name (sym) = new_name;
! 	  name = new_name;
  	}

        /* Check if we will remove the current leading character.  */
*************** filter_symbols (abfd, obfd, osyms, isyms
*** 828,834 ****

        /* Remove leading char.  */
        if (rem_leading_char)
! 	name = (char *) bfd_asymbol_name (sym) = name + 1;

        /* Add new leading char and/or prefix.  */
        if (add_leading_char || prefix_symbols_string)
--- 829,835 ----

        /* Remove leading char.  */
        if (rem_leading_char)
! 	bfd_asymbol_name (sym) = ++name;

        /* Add new leading char and/or prefix.  */
        if (add_leading_char || prefix_symbols_string)
*************** filter_symbols (abfd, obfd, osyms, isyms
*** 846,852 ****
             }

            strcpy (ptr, name);
!           name = (char *) bfd_asymbol_name (sym) = n;
  	}

        if (strip_symbols == STRIP_ALL)
--- 847,854 ----
             }

            strcpy (ptr, name);
!           bfd_asymbol_name (sym) = n;
!           name = n;
  	}

        if (strip_symbols == STRIP_ALL)

Roger
--
Roger Sayle,                         E-mail: roger at eyesopen dot com
OpenEye Scientific Software,         WWW: http://www.eyesopen.com/
Suite 1107, 3600 Cerrillos Road,     Tel: (+1) 505-473-7385
Santa Fe, New Mexico, 87507.         Fax: (+1) 505-473-0833


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