Index: bfd/elf32-sh-symbian.c =================================================================== RCS file: /cvs/src/src/bfd/elf32-sh-symbian.c,v retrieving revision 1.9 diff -c -3 -p -r1.9 elf32-sh-symbian.c *** bfd/elf32-sh-symbian.c 4 May 2005 15:53:19 -0000 1.9 --- bfd/elf32-sh-symbian.c 2 May 2006 09:52:24 -0000 *************** *** 26,33 **** #include "elf32-sh.c" ! //#define DEBUG 1 ! #define DEBUG 0 #define DIRECTIVE_HEADER "##\n" #define DIRECTIVE_IMPORT "IMPORT " --- 26,33 ---- #include "elf32-sh.c" ! //#define SYMBIAN_DEBUG 1 ! #define SYMBIAN_DEBUG 0 #define DIRECTIVE_HEADER "##\n" #define DIRECTIVE_IMPORT "IMPORT " *************** *** 36,42 **** /* Macro to advance 's' until either it reaches 'e' or the character pointed to by 's' is equal to 'c'. If 'e' is ! reached and DEBUG is enabled then the error message 'm' is displayed. */ #define SKIP_UNTIL(s,e,c,m) \ do \ --- 36,42 ---- /* Macro to advance 's' until either it reaches 'e' or the character pointed to by 's' is equal to 'c'. If 'e' is ! reached and SYMBIAN_DEBUG is enabled then the error message 'm' is displayed. */ #define SKIP_UNTIL(s,e,c,m) \ do \ *************** *** 45,51 **** ++ s; \ if (s >= e) \ { \ ! if (DEBUG) \ fprintf (stderr, "Corrupt directive: %s\n", m); \ result = FALSE; \ } \ --- 45,51 ---- ++ s; \ if (s >= e) \ { \ ! if (SYMBIAN_DEBUG) \ fprintf (stderr, "Corrupt directive: %s\n", m); \ result = FALSE; \ } \ *************** *** 63,69 **** ++ s; \ if (s >= e) \ { \ ! if (DEBUG) \ fprintf (stderr, "Corrupt directive: %s\n", m); \ result = FALSE; \ } \ --- 63,69 ---- ++ s; \ if (s >= e) \ { \ ! if (SYMBIAN_DEBUG) \ fprintf (stderr, "Corrupt directive: %s\n", m); \ result = FALSE; \ } \ *************** *** 74,80 **** /* Macro to advance 's' until either it reaches 'e' or the character pointed to by 's' is not equal to 'c'. If 'e' ! is reached and DEBUG is enabled then the error message 'm' is displayed. */ #define SKIP_WHILE(s,e,c,m) \ do \ --- 74,80 ---- /* Macro to advance 's' until either it reaches 'e' or the character pointed to by 's' is not equal to 'c'. If 'e' ! is reached and SYMBIAN_DEBUG is enabled then the error message 'm' is displayed. */ #define SKIP_WHILE(s,e,c,m) \ do \ *************** *** 83,89 **** ++ s; \ if (s >= e) \ { \ ! if (DEBUG) \ fprintf (stderr, "Corrupt directive: %s\n", m); \ result = FALSE; \ } \ --- 83,89 ---- ++ s; \ if (s >= e) \ { \ ! if (SYMBIAN_DEBUG) \ fprintf (stderr, "Corrupt directive: %s\n", m); \ result = FALSE; \ } \ *************** sh_symbian_import_as (struct bfd_link_in *** 114,120 **** struct elf_link_hash_entry * new_hash; symbol_rename * node; ! if (DEBUG) fprintf (stderr, "IMPORT '%s' AS '%s'\n", current_name, new_name); for (node = rename_list; node; node = node->next) --- 114,120 ---- struct elf_link_hash_entry * new_hash; symbol_rename * node; ! if (SYMBIAN_DEBUG) fprintf (stderr, "IMPORT '%s' AS '%s'\n", current_name, new_name); for (node = rename_list; node; node = node->next) *************** sh_symbian_import_as (struct bfd_link_in *** 132,145 **** if ((node = bfd_malloc (sizeof * node)) == NULL) { ! if (DEBUG) fprintf (stderr, "IMPORT AS: No mem for new rename node\n"); return FALSE; } if ((node->current_name = bfd_malloc (strlen (current_name) + 1)) == NULL) { ! if (DEBUG) fprintf (stderr, "IMPORT AS: No mem for current name field in rename node\n"); free (node); return FALSE; --- 132,145 ---- if ((node = bfd_malloc (sizeof * node)) == NULL) { ! if (SYMBIAN_DEBUG) fprintf (stderr, "IMPORT AS: No mem for new rename node\n"); return FALSE; } if ((node->current_name = bfd_malloc (strlen (current_name) + 1)) == NULL) { ! if (SYMBIAN_DEBUG) fprintf (stderr, "IMPORT AS: No mem for current name field in rename node\n"); free (node); return FALSE; *************** sh_symbian_import_as (struct bfd_link_in *** 149,155 **** if ((node->new_name = bfd_malloc (strlen (new_name) + 1)) == NULL) { ! if (DEBUG) fprintf (stderr, "IMPORT AS: No mem for new name field in rename node\n"); free (node->current_name); free (node); --- 149,155 ---- if ((node->new_name = bfd_malloc (strlen (new_name) + 1)) == NULL) { ! if (SYMBIAN_DEBUG) fprintf (stderr, "IMPORT AS: No mem for new name field in rename node\n"); free (node->current_name); free (node); *************** sh_symbian_import_as (struct bfd_link_in *** 175,181 **** static bfd_boolean sh_symbian_import (bfd * abfd ATTRIBUTE_UNUSED, char * name) { ! if (DEBUG) fprintf (stderr, "IMPORT '%s'\n", name); /* XXX: Generate an import somehow ? */ --- 175,181 ---- static bfd_boolean sh_symbian_import (bfd * abfd ATTRIBUTE_UNUSED, char * name) { ! if (SYMBIAN_DEBUG) fprintf (stderr, "IMPORT '%s'\n", name); /* XXX: Generate an import somehow ? */ *************** sh_symbian_import (bfd * abfd ATTRIBUTE_ *** 186,192 **** static bfd_boolean sh_symbian_export (bfd * abfd ATTRIBUTE_UNUSED, char * name) { ! if (DEBUG) fprintf (stderr, "EXPORT '%s'\n", name); /* XXX: Generate an export somehow ? */ --- 186,192 ---- static bfd_boolean sh_symbian_export (bfd * abfd ATTRIBUTE_UNUSED, char * name) { ! if (SYMBIAN_DEBUG) fprintf (stderr, "EXPORT '%s'\n", name); /* XXX: Generate an export somehow ? */ *************** sh_symbian_process_embedded_commands (st *** 266,272 **** if (strncmp (s, DIRECTIVE_AS, strlen (DIRECTIVE_AS))) { /* Skip the new-line at the end of the name. */ ! if (DEBUG && name_end_char != '\n') fprintf (stderr, "IMPORT: No newline at end of directive\n"); else s ++; --- 266,272 ---- if (strncmp (s, DIRECTIVE_AS, strlen (DIRECTIVE_AS))) { /* Skip the new-line at the end of the name. */ ! if (SYMBIAN_DEBUG && name_end_char != '\n') fprintf (stderr, "IMPORT: No newline at end of directive\n"); else s ++; *************** sh_symbian_process_embedded_commands (st *** 276,282 **** /* Skip past the NUL character. */ if (* s ++ != 0) { ! if (DEBUG) fprintf (stderr, "IMPORT: No NUL at end of directive\n"); } } --- 276,282 ---- /* Skip past the NUL character. */ if (* s ++ != 0) { ! if (SYMBIAN_DEBUG) fprintf (stderr, "IMPORT: No NUL at end of directive\n"); } } *************** sh_symbian_process_embedded_commands (st *** 300,306 **** SKIP_WHILE (s, e, ' ', "IMPORT AS: Current name just followed by spaces"); /* Skip past the newline character. */ if (* s ++ != '\n') ! if (DEBUG) fprintf (stderr, "IMPORT AS: No newline at end of directive\n"); /* Terminate the current name after having performed the skips. */ --- 300,306 ---- SKIP_WHILE (s, e, ' ', "IMPORT AS: Current name just followed by spaces"); /* Skip past the newline character. */ if (* s ++ != '\n') ! if (SYMBIAN_DEBUG) fprintf (stderr, "IMPORT AS: No newline at end of directive\n"); /* Terminate the current name after having performed the skips. */ *************** sh_symbian_process_embedded_commands (st *** 311,317 **** /* The next character should be a NUL. */ if (* s != 0) { ! if (DEBUG) fprintf (stderr, "IMPORT AS: Junk at end of directive\n"); result = FALSE; } --- 311,317 ---- /* The next character should be a NUL. */ if (* s != 0) { ! if (SYMBIAN_DEBUG) fprintf (stderr, "IMPORT AS: Junk at end of directive\n"); result = FALSE; } *************** sh_symbian_process_embedded_commands (st *** 355,361 **** /* The next character should be a NUL. */ if (* s != 0) { ! if (DEBUG) fprintf (stderr, "EXPORT: Junk at end of directive\n"); result = FALSE; } --- 355,361 ---- /* The next character should be a NUL. */ if (* s != 0) { ! if (SYMBIAN_DEBUG) fprintf (stderr, "EXPORT: Junk at end of directive\n"); result = FALSE; } *************** sh_symbian_process_embedded_commands (st *** 373,379 **** if (! result) { ! if (DEBUG) fprintf (stderr, "offset into .directive section: %ld\n", (long) (directive - (char *) contents)); --- 373,379 ---- if (! result) { ! if (SYMBIAN_DEBUG) fprintf (stderr, "offset into .directive section: %ld\n", (long) (directive - (char *) contents)); *************** sh_symbian_relocate_section (bfd * *** 464,470 **** if (ptr->current_hash == NULL) { ! if (DEBUG) fprintf (stderr, "IMPORT AS: current symbol '%s' does not exist\n", ptr->current_name); continue; } --- 464,470 ---- if (ptr->current_hash == NULL) { ! if (SYMBIAN_DEBUG) fprintf (stderr, "IMPORT AS: current symbol '%s' does not exist\n", ptr->current_name); continue; } *************** sh_symbian_relocate_section (bfd * *** 511,517 **** if (new_hash->dynindx == -1) new_hash->def_regular = 1; ! if (DEBUG) fprintf (stderr, "Created new symbol %s\n", ptr->new_name); } --- 511,517 ---- if (new_hash->dynindx == -1) new_hash->def_regular = 1; ! if (SYMBIAN_DEBUG) fprintf (stderr, "Created new symbol %s\n", ptr->new_name); } *************** sh_symbian_relocate_section (bfd * *** 521,527 **** if (* h == new_hash) { ptr->new_symndx = h - sym_hashes + num_local_syms; ! if (DEBUG) fprintf (stderr, "Converted new hash to index of %ld\n", ptr->new_symndx); break; } --- 521,527 ---- if (* h == new_hash) { ptr->new_symndx = h - sym_hashes + num_local_syms; ! if (SYMBIAN_DEBUG) fprintf (stderr, "Converted new hash to index of %ld\n", ptr->new_symndx); break; } *************** sh_symbian_relocate_section (bfd * *** 539,545 **** new_sym_hashes = bfd_alloc (input_bfd, num_global_syms * sizeof * sym_hashes); if (new_sym_hashes == NULL) { ! if (DEBUG) fprintf (stderr, "Out of memory extending hash table\n"); continue; } --- 539,545 ---- new_sym_hashes = bfd_alloc (input_bfd, num_global_syms * sizeof * sym_hashes); if (new_sym_hashes == NULL) { ! if (SYMBIAN_DEBUG) fprintf (stderr, "Out of memory extending hash table\n"); continue; } *************** sh_symbian_relocate_section (bfd * *** 551,557 **** ptr->new_symndx = num_global_syms - 1 + num_local_syms; ! if (DEBUG) fprintf (stderr, "Extended symbol hash table to insert new symbol as index %ld\n", ptr->new_symndx); } --- 551,557 ---- ptr->new_symndx = num_global_syms - 1 + num_local_syms; ! if (SYMBIAN_DEBUG) fprintf (stderr, "Extended symbol hash table to insert new symbol as index %ld\n", ptr->new_symndx); } *************** sh_symbian_relocate_section (bfd * *** 601,607 **** if (h == ptr->current_hash) { BFD_ASSERT (ptr->new_symndx); ! if (DEBUG) fprintf (stderr, "convert reloc %lx from using index %ld to using index %ld\n", (long) rel->r_info, (long) ELF32_R_SYM (rel->r_info), ptr->new_symndx); rel->r_info = ELF32_R_INFO (ptr->new_symndx, r_type); --- 601,607 ---- if (h == ptr->current_hash) { BFD_ASSERT (ptr->new_symndx); ! if (SYMBIAN_DEBUG) fprintf (stderr, "convert reloc %lx from using index %ld to using index %ld\n", (long) rel->r_info, (long) ELF32_R_SYM (rel->r_info), ptr->new_symndx); rel->r_info = ELF32_R_INFO (ptr->new_symndx, r_type);