From: Nick Clifton <nickc@redhat.com>
To: binutils@sourceware.org
Subject: Re: bfd nits
Date: Tue, 02 May 2006 09:55:00 -0000 [thread overview]
Message-ID: <44572C76.7010009@redhat.com> (raw)
In-Reply-To: <20060502014123.GE11597@bubble.grove.modra.org>
[-- Attachment #1: Type: text/plain, Size: 603 bytes --]
Hi Alan,
> Fixes for assorted nits, most found when trying to build with -DDEBUG at
> the top level to enable gas assertions. An --enable-targets=all build
> still won't work with -DDEBUG, because bfd/elf32-sh-symbian.c
> unconditionally does "#define DEBUG 0"
Well this one is my fault, so I am checking in the attached patch to fix
it. Tested by building an sh-symbianelf targeted toolchain.
Cheers
Nick
bfd/ChangeLog
2006-05-02 Nick Clifton <nickc@redhat.com>
* elf32-sh-symbian.c: Rename local define DEBUG to SYMBIAN_DEBUG
in order to avoid conflicts with the global DEBUG define.
[-- Attachment #2: elf32-sh-symbian.c.patch --]
[-- Type: text/x-patch, Size: 12621 bytes --]
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 "#<SYMEDIT>#\n"
#define DIRECTIVE_IMPORT "IMPORT "
--- 26,33 ----
#include "elf32-sh.c"
! //#define SYMBIAN_DEBUG 1
! #define SYMBIAN_DEBUG 0
#define DIRECTIVE_HEADER "#<SYMEDIT>#\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);
prev parent reply other threads:[~2006-05-02 9:55 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-05-02 1:41 Alan Modra
2006-05-02 9:55 ` Nick Clifton [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=44572C76.7010009@redhat.com \
--to=nickc@redhat.com \
--cc=binutils@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).