[Patch] to allow bfd to build natively using solaris cc

Jeff Holcomb jeffh@redhat.com
Tue Oct 16 17:57:00 GMT 2001


On Tue, 16 Oct 2001, Richard Henderson wrote:

> This isn't.  You're no longer doing pointer arithmetic on characters.

Ok.  How about this instead.  Per your advice, change the type on 
contents so the changes to elf.c aren't needed.  These changes work fine 
with Solaris cc.

in include/elf/

2001-10-16  Jeff Holcomb  <jeffh@redhat.com>

        * internal.h (elf_internal_shdr): Make contents an unsigned char *.

in bfd/

2001-10-16  Jeff Holcomb  <jeffh@redhat.com>

        * elflink.h (elf_link_sort_relocs): Remove unnecessary pointer
        casts.

Index: internal.h
===================================================================
RCS file: /cvs/src/src/include/elf/internal.h,v
retrieving revision 1.4
diff -u -p -r1.4 internal.h
--- internal.h  2001/09/18 10:01:41     1.4
+++ internal.h  2001/10/17 00:50:06
@@ -98,7 +98,7 @@ typedef struct elf_internal_shdr {
 
   /* The internal rep also has some cached info associated with it. */
   asection *   bfd_section;            /* Associated BFD section.  */
-  PTR          contents;               /* Section contents.  */
+  unsigned char *contents;             /* Section contents.  */
 } Elf_Internal_Shdr;
 
 #define elf32_internal_shdr elf_internal_shdr

Index: elflink.h
===================================================================
RCS file: /cvs/src/src/bfd/elflink.h,v
retrieving revision 1.115
diff -u -p -r1.115 elflink.h
--- elflink.h   2001/10/16 06:33:52     1.115
+++ elflink.h   2001/10/17 00:51:41
@@ -4502,7 +4502,7 @@ elf_link_sort_relocs (abfd, info, psec)
            struct elf_link_sort_rela *s;
 
            erel = (Elf_External_Rel *) o->contents;
-           erelend = (Elf_External_Rel *) ((PTR) o->contents + o->_raw_size);
+           erelend = (Elf_External_Rel *) (o->contents + o->_raw_size);
            s = rela + o->output_offset / sizeof (Elf_External_Rel);
            for (; erel < erelend; erel++, s++)
              {
@@ -4519,7 +4519,7 @@ elf_link_sort_relocs (abfd, info, psec)
            struct elf_link_sort_rela *s;
 
            erela = (Elf_External_Rela *) o->contents;
-           erelaend = (Elf_External_Rela *) ((PTR) o->contents + o->_raw_size);
+           erelaend = (Elf_External_Rela *) (o->contents + o->_raw_size);
            s = rela + o->output_offset / sizeof (Elf_External_Rela);
            for (; erela < erelaend; erela++, s++)
              {



More information about the Binutils mailing list