#include "elf32-sh.c"
-//#define DEBUG 1
-#define DEBUG 0
+//#define SYMBIAN_DEBUG 1
+#define SYMBIAN_DEBUG 0
#define DIRECTIVE_HEADER "#<SYMEDIT>#\n"
#define DIRECTIVE_IMPORT "IMPORT "
/* 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'
+ reached and SYMBIAN_DEBUG is enabled then the error message 'm'
is displayed. */
#define SKIP_UNTIL(s,e,c,m) \
do \
++ s; \
if (s >= e) \
{ \
- if (DEBUG) \
+ if (SYMBIAN_DEBUG) \
fprintf (stderr, "Corrupt directive: %s\n", m); \
result = FALSE; \
} \
++ s; \
if (s >= e) \
{ \
- if (DEBUG) \
+ if (SYMBIAN_DEBUG) \
fprintf (stderr, "Corrupt directive: %s\n", m); \
result = FALSE; \
} \
/* 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
+ is reached and SYMBIAN_DEBUG is enabled then the error message
'm' is displayed. */
#define SKIP_WHILE(s,e,c,m) \
do \
++ s; \
if (s >= e) \
{ \
- if (DEBUG) \
+ if (SYMBIAN_DEBUG) \
fprintf (stderr, "Corrupt directive: %s\n", m); \
result = FALSE; \
} \
struct elf_link_hash_entry * new_hash;
symbol_rename * node;
- if (DEBUG)
+ if (SYMBIAN_DEBUG)
fprintf (stderr, "IMPORT '%s' AS '%s'\n", current_name, new_name);
for (node = rename_list; node; node = node->next)
if ((node = bfd_malloc (sizeof * node)) == NULL)
{
- if (DEBUG)
+ 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 (DEBUG)
+ if (SYMBIAN_DEBUG)
fprintf (stderr, "IMPORT AS: No mem for current name field in rename node\n");
free (node);
return FALSE;
if ((node->new_name = bfd_malloc (strlen (new_name) + 1)) == NULL)
{
- if (DEBUG)
+ if (SYMBIAN_DEBUG)
fprintf (stderr, "IMPORT AS: No mem for new name field in rename node\n");
free (node->current_name);
free (node);
static bfd_boolean
sh_symbian_import (bfd * abfd ATTRIBUTE_UNUSED, char * name)
{
- if (DEBUG)
+ if (SYMBIAN_DEBUG)
fprintf (stderr, "IMPORT '%s'\n", name);
/* XXX: Generate an import somehow ? */
static bfd_boolean
sh_symbian_export (bfd * abfd ATTRIBUTE_UNUSED, char * name)
{
- if (DEBUG)
+ if (SYMBIAN_DEBUG)
fprintf (stderr, "EXPORT '%s'\n", name);
/* XXX: Generate an export somehow ? */
if (strncmp (s, DIRECTIVE_AS, strlen (DIRECTIVE_AS)))
{
/* Skip the new-line at the end of the name. */
- if (DEBUG && name_end_char != '\n')
+ if (SYMBIAN_DEBUG && name_end_char != '\n')
fprintf (stderr, "IMPORT: No newline at end of directive\n");
else
s ++;
/* Skip past the NUL character. */
if (* s ++ != 0)
{
- if (DEBUG)
+ if (SYMBIAN_DEBUG)
fprintf (stderr, "IMPORT: No NUL at end of directive\n");
}
}
SKIP_WHILE (s, e, ' ', "IMPORT AS: Current name just followed by spaces");
/* Skip past the newline character. */
if (* s ++ != '\n')
- if (DEBUG)
+ if (SYMBIAN_DEBUG)
fprintf (stderr, "IMPORT AS: No newline at end of directive\n");
/* Terminate the current name after having performed the skips. */
/* The next character should be a NUL. */
if (* s != 0)
{
- if (DEBUG)
+ if (SYMBIAN_DEBUG)
fprintf (stderr, "IMPORT AS: Junk at end of directive\n");
result = FALSE;
}
/* The next character should be a NUL. */
if (* s != 0)
{
- if (DEBUG)
+ if (SYMBIAN_DEBUG)
fprintf (stderr, "EXPORT: Junk at end of directive\n");
result = FALSE;
}
if (! result)
{
- if (DEBUG)
+ if (SYMBIAN_DEBUG)
fprintf (stderr, "offset into .directive section: %ld\n",
(long) (directive - (char *) contents));
if (ptr->current_hash == NULL)
{
- if (DEBUG)
+ if (SYMBIAN_DEBUG)
fprintf (stderr, "IMPORT AS: current symbol '%s' does not exist\n", ptr->current_name);
continue;
}
if (new_hash->dynindx == -1)
new_hash->def_regular = 1;
- if (DEBUG)
+ if (SYMBIAN_DEBUG)
fprintf (stderr, "Created new symbol %s\n", ptr->new_name);
}
if (* h == new_hash)
{
ptr->new_symndx = h - sym_hashes + num_local_syms;
- if (DEBUG)
+ if (SYMBIAN_DEBUG)
fprintf (stderr, "Converted new hash to index of %ld\n", ptr->new_symndx);
break;
}
new_sym_hashes = bfd_alloc (input_bfd, num_global_syms * sizeof * sym_hashes);
if (new_sym_hashes == NULL)
{
- if (DEBUG)
+ if (SYMBIAN_DEBUG)
fprintf (stderr, "Out of memory extending hash table\n");
continue;
}
ptr->new_symndx = num_global_syms - 1 + num_local_syms;
- if (DEBUG)
+ if (SYMBIAN_DEBUG)
fprintf (stderr, "Extended symbol hash table to insert new symbol as index %ld\n",
ptr->new_symndx);
}
if (h == ptr->current_hash)
{
BFD_ASSERT (ptr->new_symndx);
- if (DEBUG)
+ 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);