This is the mail archive of the
binutils@sourceware.cygnus.com
mailing list for the binutils project.
Re: identifier mangling when linking binary "blobs"
>>>>> "Ian" == Ian Lance Taylor <ian@airs.com> writes:
Ian> I think it's a bug. mangle_name in binary.c should prepend
Ian> bfd_get_symbol_leading_char (abfd). That should make the name
Ian> consistently start with an underscore, which I think is correct.
I finally got a chance to follow up, and came up with the enclosed
patch. Unfortunately, it doesn't work as expected. As bfd_get_
symbol_leading_char(abfd) returns the leading character of the
"binary" BFD vector instead of that the output file.
After poking around for a while, I could not find a way for
mangle_name() to get that info without causing major damage.
Any ideas?
--jtc
Index: binary.c
===================================================================
RCS file: /cvs/binutils/binutils/bfd/binary.c,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 binary.c
*** binary.c 1999/05/03 07:28:55 1.1.1.1
--- binary.c 1999/05/28 23:15:16
***************
*** 143,149 ****
char *buf;
char *p;
! size = (strlen (bfd_get_filename (abfd))
+ strlen (suffix)
+ sizeof "_binary__");
--- 143,150 ----
char *buf;
char *p;
! size = ( (bfd_get_symbol_leading_char(abfd) != 0)
! + strlen (bfd_get_filename (abfd))
+ strlen (suffix)
+ sizeof "_binary__");
***************
*** 151,157 ****
if (buf == NULL)
return "";
! sprintf (buf, "_binary_%s_%s", bfd_get_filename (abfd), suffix);
/* Change any non-alphanumeric characters to underscores. */
for (p = buf; *p; p++)
--- 152,163 ----
if (buf == NULL)
return "";
! /* Note that symbol_leading_char may be '\0'. */
! buf[0] = bfd_get_symbol_leading_char(abfd);
! buf[1] = 0;
! p = buf + strlen(buf);
!
! sprintf (p, "_binary_%s_%s", bfd_get_filename (abfd), suffix);
/* Change any non-alphanumeric characters to underscores. */
for (p = buf; *p; p++)
--
J.T. Conklin
RedBack Networks