Add support for the Z80 processor family
[deliverable/binutils-gdb.git] / bfd / elf32-sh-symbian.c
index 0dbf2277377a7ec57dfa6450d84d88f63101007d..477cf243e708a7e6e52e61050ce3cb68d911f622 100644 (file)
@@ -1,5 +1,5 @@
 /* Renesas / SuperH specific support for Symbian 32-bit ELF files
-   Copyright 2004
+   Copyright 2004, 2005
    Free Software Foundation, Inc.
    Contributed by Red Hat
 
 
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
 
 /* Stop elf32-sh.c from defining any target vectors.  */
 #define SH_TARGET_ALREADY_DEFINED
+#define sh_find_elf_flags           sh_symbian_find_elf_flags
+#define sh_elf_get_flags_from_mach  sh_symbian_elf_get_flags_from_mach 
 #include "elf32-sh.c"
 
 
@@ -94,8 +96,8 @@
 typedef struct symbol_rename
 {
   struct symbol_rename *       next;
-  bfd_byte *                   current_name;
-  bfd_byte *                   new_name;
+  char *                       current_name;
+  char *                       new_name;
   struct elf_link_hash_entry * current_hash;
   unsigned long                new_symndx;
 }
@@ -107,7 +109,7 @@ static symbol_rename * rename_list = NULL;
 
 static bfd_boolean
 sh_symbian_import_as (struct bfd_link_info *info, bfd * abfd,
-                     bfd_byte * current_name, bfd_byte * new_name)
+                     char * current_name, char * new_name)
 {
   struct elf_link_hash_entry * new_hash;
   symbol_rename * node;
@@ -123,8 +125,8 @@ sh_symbian_import_as (struct bfd_link_info *info, bfd * abfd,
          return TRUE;
 
        bfd_set_error (bfd_error_invalid_operation);
-       _bfd_error_handler (_("%s: IMPORT AS directive for %s conceals previous IMPORT AS"),
-                           bfd_archive_filename (abfd), current_name);
+       _bfd_error_handler (_("%B: IMPORT AS directive for %s conceals previous IMPORT AS"),
+                           abfd, current_name);
        return FALSE;       
       }
 
@@ -171,7 +173,7 @@ sh_symbian_import_as (struct bfd_link_info *info, bfd * abfd,
 
 
 static bfd_boolean
-sh_symbian_import (bfd * abfd ATTRIBUTE_UNUSED, bfd_byte * name)
+sh_symbian_import (bfd * abfd ATTRIBUTE_UNUSED, char * name)
 {
   if (DEBUG)
     fprintf (stderr, "IMPORT '%s'\n", name);
@@ -182,7 +184,7 @@ sh_symbian_import (bfd * abfd ATTRIBUTE_UNUSED, bfd_byte * name)
 }
 
 static bfd_boolean
-sh_symbian_export (bfd * abfd ATTRIBUTE_UNUSED, bfd_byte * name)
+sh_symbian_export (bfd * abfd ATTRIBUTE_UNUSED, char * name)
 {
   if (DEBUG)
     fprintf (stderr, "EXPORT '%s'\n", name);
@@ -200,14 +202,14 @@ static bfd_boolean
 sh_symbian_process_embedded_commands (struct bfd_link_info *info, bfd * abfd,
                                      asection * sec, bfd_byte * contents)
 {
-  bfd_byte *s;
-  bfd_byte *e;
+  char *s;
+  char *e;
   bfd_boolean result = TRUE;
   bfd_size_type sz = sec->rawsize ? sec->rawsize : sec->size;
 
-  for (s = contents, e = s + sz; s < e;)
+  for (s = (char *) contents, e = s + sz; s < e;)
     {
-      bfd_byte * directive = s;
+      char * directive = s;
 
       switch (*s)
        {
@@ -227,9 +229,9 @@ sh_symbian_process_embedded_commands (struct bfd_link_info *info, bfd * abfd,
            result = FALSE;
          else
            {
-             bfd_byte * new_name;
-             bfd_byte * new_name_end;
-             bfd_byte   name_end_char;
+             char * new_name;
+             char * new_name_end;
+             char   name_end_char;
 
              /* Skip the IMPORT directive.  */
              s += strlen (DIRECTIVE_IMPORT);
@@ -280,9 +282,9 @@ sh_symbian_process_embedded_commands (struct bfd_link_info *info, bfd * abfd,
                }
              else
                {
-                 bfd_byte * current_name;
-                 bfd_byte * current_name_end;
-                 bfd_byte   current_name_end_char;
+                 char * current_name;
+                 char * current_name_end;
+                 char   current_name_end_char;
 
                  /* Skip the 'AS '.  */
                  s += strlen (DIRECTIVE_AS);
@@ -329,9 +331,9 @@ sh_symbian_process_embedded_commands (struct bfd_link_info *info, bfd * abfd,
            result = FALSE;
          else
            {
-             bfd_byte * name;
-             bfd_byte * name_end;
-             bfd_byte   name_end_char;
+             char * name;
+             char * name_end;
+             char   name_end_char;
 
              /* Skip the directive.  */
              s += strlen (DIRECTIVE_EXPORT);
@@ -372,11 +374,12 @@ sh_symbian_process_embedded_commands (struct bfd_link_info *info, bfd * abfd,
       if (! result)
        {
          if (DEBUG)
-           fprintf (stderr, "offset into .directive section: %d\n", directive - contents);
+           fprintf (stderr, "offset into .directive section: %ld\n",
+                    (long) (directive - (char *) contents));
          
          bfd_set_error (bfd_error_invalid_operation);
-         _bfd_error_handler (_("%s: Unrecognised .directive command: %s"),
-                             bfd_archive_filename (abfd), directive);
+         _bfd_error_handler (_("%B: Unrecognised .directive command: %s"),
+                             abfd, directive);
          break;
        }
     }
@@ -489,12 +492,15 @@ sh_symbian_relocate_section (bfd *                  output_bfd,
              new_sym.st_other = ELF_ST_VISIBILITY (STV_DEFAULT);
              new_sym.st_shndx = SHN_UNDEF;
 
-             if (! _bfd_elf_merge_symbol (input_bfd, info, ptr->new_name, & new_sym, & psec,
-                                          & new_value, & new_hash, & skip, & override, & type_change_ok,
+             if (! _bfd_elf_merge_symbol (input_bfd, info,
+                                          ptr->new_name, & new_sym,
+                                          & psec, & new_value, NULL,
+                                          & new_hash, & skip,
+                                          & override, & type_change_ok,
                                           & size_change_ok))
                {
-                 _bfd_error_handler (_("%s: Failed to add renamed symbol %s"),
-                                     bfd_archive_filename (input_bfd), ptr->new_name);
+                 _bfd_error_handler (_("%B: Failed to add renamed symbol %s"),
+                                     input_bfd, ptr->new_name);
                  continue;
                }
              /* XXX - should we check psec, skip, override etc ?  */
@@ -503,7 +509,7 @@ sh_symbian_relocate_section (bfd *                  output_bfd,
 
              /* Allow the symbol to become local if necessary.  */
              if (new_hash->dynindx == -1)
-               new_hash->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR;
+               new_hash->def_regular = 1;
 
              if (DEBUG)
                fprintf (stderr, "Created new symbol %s\n", ptr->new_name);
This page took 0.025979 seconds and 4 git commands to generate.