[PING][RFC/RFA] Fix building with -DDEBUG=7 CFLAGS option.
Pierre Muller
pierre.muller@ics-cnrs.unistra.fr
Wed Sep 29 07:41:00 GMT 2010
More information about the Binutils mailing list
Wed Sep 29 07:41:00 GMT 2010
- Previous message (by thread): [RFC/RFA] Fix building with -DDEBUG=7 CFLAGS option.
- Next message (by thread): about libbfd
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
No-one reacted to that first email :( Would it be easier if I split that into smaller RFA? Pierre Muller Pascal language support maintainer for GDB > -----Message d'origine----- > De : binutils-owner@sourceware.org [mailto:binutils- > owner@sourceware.org] De la part de Pierre Muller > Envoyé : Monday, September 20, 2010 11:47 PM > À : 'Binutils' > Objet : [RFC/RFA] Fix building with -DDEBUG=7 CFLAGS option. > > Following my attempt to fix problems related > to the sizeof(long) < sizeof(void*) for mingw64, > I started to try to build gdb and Binutils using > -DDEBUG=7 in CFLAGS. > > The macro DEBUG seems to be accepted in a wide > range of source files, but it gave a few errors, > which were quite easy to fix. > There are also some changes that are just needed > because a function was deleted from main source > or some type was changed. > > I didn't try to investigate the soundness > of the current debug function but just fixed the > problems so that I could use > -DDEBUG=7 > directly at build level for: > make all-gdb all-binutils all-gas all-ld > > after applying this patch. > > The least obvious change is in > Binutils/nlmheader.y file > in which I changed DEBUG token into _DEBUG. > I have no idea if this is an acceptable change > from the point of view of a parser specialist... > I suppose that the name given to the token itself > has no influence on the generated code, but I am unable to > test it ... > > > > Pierre Muller > Pascal language support maintainer for GDB > > bfd/ChangeLog entry: > > 2010-09-21 Pierre Muller <muller@ics.u-strasbg.fr> > > Fix build with -DDEBUG=7 > * elf.c (_bfd_elf_symbol_from_bfd_symbol): Remove call > to deleted function elf_symbol_flags. > Add typecast to avoid warning. > * elf32-rx.c (dump_symbol) : Rename to... > (rx_dump_symbol): ...this to avoid link errors. > * elflink.c (elf_link_input_bfd): Add typecast > to avoid warnings. > > binutils/ChangeLog entry: > > 2010-09-21 Pierre Muller <muller@ics.u-strasbg.fr> > > Fix build with -DDEBUG=7 > nlmheader.y (DEBUG token): Rename to... > (_DEBUG token): ...this to avoid collision with DEBUG macro. > > gas/ChangeLog entry: > > 2010-09-21 Pierre Muller <muller@ics.u-strasbg.fr> > > Fix build with -DDEBUG=7 > * config/obj-coff.c (s_get_name, symbol_dump): > Add prototypes to avoid warnings. > > opcodes/ChangeLog entry: > > 2010-09-21 Pierre Muller <muller@ics.u-strasbg.fr> > > Fix build with -DDEBUG=7 > * frv-opc.c (DEBUG): Undefine DEBUG if needed > to avoid a problem in call to macro OP with DEBUG as argument. > * or32-dis.c: Avoid redefinition of DEBUG macro > if already set. > (find_bytes_big, or32_extract, or32_opcode_match, > or32_print_register): > Adapt DEBUG code to some type changes throughout. > * or32-opc.c (or32_extract): Likewise. > > > Index: src/bfd/elf.c > =================================================================== > RCS file: /cvs/src/src/bfd/elf.c,v > retrieving revision 1.520 > diff -u -p -r1.520 elf.c > --- src/bfd/elf.c 16 Sep 2010 00:06:11 -0000 1.520 > +++ src/bfd/elf.c 17 Sep 2010 15:24:09 -0000 > @@ -5157,9 +5157,8 @@ _bfd_elf_symbol_from_bfd_symbol (bfd *ab > #if DEBUG & 4 > { > fprintf (stderr, > - "elf_symbol_from_bfd_symbol 0x%.8lx, name = %s, sym num = > %d, flags = 0x%.8lx%s\n", > - (long) asym_ptr, asym_ptr->name, idx, flags, > - elf_symbol_flags (flags)); > + "elf_symbol_from_bfd_symbol 0x%.8lx, name = %s, sym num = > %d, flags = 0x%.8lx\n", > + (long) asym_ptr, asym_ptr->name, idx, (long) flags); > fflush (stderr); > } > #endif > Index: src/bfd/elf32-rx.c > =================================================================== > RCS file: /cvs/src/src/bfd/elf32-rx.c,v > retrieving revision 1.3 > diff -u -p -r1.3 elf32-rx.c > --- src/bfd/elf32-rx.c 27 Jun 2010 04:07:51 -0000 1.3 > +++ src/bfd/elf32-rx.c 20 Sep 2010 21:18:59 -0000 > @@ -29,7 +29,7 @@ > > #ifdef DEBUG > char * rx_get_reloc (long); > -void dump_symtab (bfd *, void *, void *); > +void rx_dump_symtab (bfd *, void *, void *); > #endif > > #define RXREL(n,sz,bit,shift,complain,pcrel) > \ > @@ -2962,7 +2962,7 @@ rx_elf_object_p (bfd * abfd) > > #ifdef DEBUG > void > -dump_symtab (bfd * abfd, void * internal_syms, void * external_syms) > +rx_dump_symtab (bfd * abfd, void * internal_syms, void * > external_syms) > { > size_t locsymcount; > Elf_Internal_Sym * isymbuf; > Index: src/bfd/elflink.c > =================================================================== > RCS file: /cvs/src/src/bfd/elflink.c,v > retrieving revision 1.379 > diff -u -p -r1.379 elflink.c > --- src/bfd/elflink.c 16 Sep 2010 00:06:11 -0000 1.379 > +++ src/bfd/elflink.c 17 Sep 2010 15:24:12 -0000 > @@ -9477,7 +9477,8 @@ elf_link_input_bfd (struct elf_final_lin > #ifdef DEBUG > printf ("Encountered a complex symbol!"); > printf (" (input_bfd %s, section %s, reloc %ld\n", > - input_bfd->filename, o->name, rel - > internal_relocs); > + input_bfd->filename, o->name, > + (long) (rel - internal_relocs)); > printf (" symbol: idx %8.8lx, name %s\n", > r_symndx, sym_name); > printf (" reloc : info %8.8lx, addr %8.8lx\n", > Index: src/binutils/nlmheader.y > =================================================================== > RCS file: /cvs/src/src/binutils/nlmheader.y,v > retrieving revision 1.13 > diff -u -p -r1.13 nlmheader.y > --- src/binutils/nlmheader.y 2 Sep 2009 07:22:32 -0000 1.13 > +++ src/binutils/nlmheader.y 20 Sep 2010 21:19:04 -0000 > @@ -117,7 +117,7 @@ static char *xstrdup (const char *); > > /* The reserved words. */ > > -%token CHECK CODESTART COPYRIGHT CUSTOM DATE DEBUG DESCRIPTION EXIT > +%token CHECK CODESTART COPYRIGHT CUSTOM DATE _DEBUG DESCRIPTION EXIT > %token EXPORT FLAG_ON FLAG_OFF FULLMAP HELP IMPORT INPUT MAP MESSAGES > %token MODULE MULTIPLE OS_DOMAIN OUTPUT PSEUDOPREEMPTION REENTRANT > %token SCREENNAME SHARELIB STACK START SYNCHRONIZE > @@ -202,7 +202,7 @@ command: > if (version_hdr->year < 1900 || version_hdr->year > 3000) > nlmheader_warn (_("illegal year"), -1); > } > - | DEBUG > + | _DEBUG > { > debug_info = TRUE; > } > @@ -593,7 +593,7 @@ static struct keyword_tokens_struct keyw > { "COPYRIGHT", COPYRIGHT }, > { "CUSTOM", CUSTOM }, > { "DATE", DATE }, > - { "DEBUG", DEBUG }, > + { "DEBUG", _DEBUG }, > { "DESCRIPTION", DESCRIPTION }, > { "EXIT", EXIT }, > { "EXPORT", EXPORT }, > Index: src/gas/config/obj-coff.c > =================================================================== > RCS file: /cvs/src/src/gas/config/obj-coff.c,v > retrieving revision 1.106 > diff -u -p -r1.106 obj-coff.c > --- src/gas/config/obj-coff.c 11 Jul 2010 08:45:50 -0000 1.106 > +++ src/gas/config/obj-coff.c 17 Sep 2010 15:24:13 -0000 > @@ -1829,12 +1829,16 @@ obj_coff_init_stab_section (segT seg) > } > > #ifdef DEBUG > +const char * s_get_name (symbolS *); > + > const char * > s_get_name (symbolS *s) > { > return ((s == NULL) ? "(NULL)" : S_GET_NAME (s)); > } > > +void symbol_dump (void); > + > void > symbol_dump (void) > { > Index: src/opcodes/frv-opc.c > =================================================================== > RCS file: /cvs/src/src/opcodes/frv-opc.c,v > retrieving revision 1.25 > diff -u -p -r1.25 frv-opc.c > --- src/opcodes/frv-opc.c 12 Feb 2010 03:25:48 -0000 1.25 > +++ src/opcodes/frv-opc.c 17 Sep 2010 15:24:14 -0000 > @@ -1502,6 +1502,11 @@ static const CGEN_IFMT ifmt_fnop ATTRIBU > #define MNEM CGEN_SYNTAX_MNEMONIC /* syntax value for mnemonic */ > #define OP(field) CGEN_SYNTAX_MAKE_FIELD (OPERAND (field)) > > +/* DEBUG appear below as argument of OP macro, this leads to > + problems if DEBUG is itself a macro. */ > +#ifdef DEBUG > +#undef DEBUG > +#endif > /* The instruction table. */ > > static const CGEN_OPCODE frv_cgen_insn_opcode_table[MAX_INSNS] = > Index: src/opcodes/or32-dis.c > =================================================================== > RCS file: /cvs/src/src/opcodes/or32-dis.c,v > retrieving revision 1.7 > diff -u -p -r1.7 or32-dis.c > --- src/opcodes/or32-dis.c 5 Jul 2007 09:49:02 -0000 1.7 > +++ src/opcodes/or32-dis.c 20 Sep 2010 21:19:11 -0000 > @@ -20,7 +20,9 @@ > Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, > MA 02110-1301, USA. */ > > +#ifndef DEBUG > #define DEBUG 0 > +#endif > > #include "dis-asm.h" > #include "opcode/or32.h" > @@ -41,7 +43,7 @@ find_bytes_big (unsigned char *insn_ch, > ((unsigned long) insn_ch[2] << 8) + > ((unsigned long) insn_ch[3]); > #if DEBUG > - printf ("find_bytes_big3: %x\n", *insn); > + printf ("find_bytes_big3: %lx\n", *insn); > #endif > } > > @@ -88,7 +90,7 @@ or32_extract (char param_ch, char *enc_i > { > unsigned long tmp = strtoul (enc, NULL, 16); > #if DEBUG > - printf (" enc=%s, tmp=%x ", enc, tmp); > + printf (" enc=%s, tmp=%lx ", enc, tmp); > #endif > if (param_ch == '0') > tmp = 15 - tmp; > @@ -108,7 +110,7 @@ or32_extract (char param_ch, char *enc_i > opc_pos--; > param_pos--; > #if DEBUG > - printf ("\n ret=%x opc_pos=%x, param_pos=%x\n", ret, opc_pos, > param_pos); > + printf ("\n ret=%lx opc_pos=%x, param_pos=%x\n", ret, opc_pos, > param_pos); > #endif > ret += ((insn >> opc_pos) & 0x1) << param_pos; > > @@ -117,12 +119,12 @@ or32_extract (char param_ch, char *enc_i > && ret >> (letter_range (param_ch) - 1)) > { > #if DEBUG > - printf ("\n ret=%x opc_pos=%x, param_pos=%x\n", > + printf ("\n ret=%lx opc_pos=%x, param_pos=%x\n", > ret, opc_pos, param_pos); > #endif > ret |= 0xffffffff << letter_range(param_ch); > #if DEBUG > - printf ("\n after conversion to signed: ret=%x\n", ret); > + printf ("\n after conversion to signed: ret=%lx\n", ret); > #endif > } > enc++; > @@ -141,7 +143,7 @@ or32_extract (char param_ch, char *enc_i > enc++; > > #if DEBUG > - printf ("ret=%x\n", ret); > + printf ("ret=%lx\n", ret); > #endif > return ret; > } > @@ -158,8 +160,8 @@ or32_opcode_match (unsigned long insn, c > zeros = or32_extract ('0', encoding, insn); > > #if DEBUG > - printf ("ones: %x \n", ones); > - printf ("zeros: %x \n", zeros); > + printf ("ones: %lx \n", ones); > + printf ("zeros: %lx \n", zeros); > #endif > if ((insn & ones) != ones) > { > @@ -194,7 +196,7 @@ or32_print_register (char param_ch, > int regnum = or32_extract (param_ch, encoding, insn); > > #if DEBUG > - printf ("or32_print_register: %c, %s, %x\n", param_ch, encoding, > insn); > + printf ("or32_print_register: %c, %s, %lx\n", param_ch, encoding, > insn); > #endif > if (param_ch == 'A') > (*info->fprintf_func) (info->stream, "r%d", regnum); > Index: src/opcodes/or32-opc.c > =================================================================== > RCS file: /cvs/src/src/opcodes/or32-opc.c,v > retrieving revision 1.10 > diff -u -p -r1.10 or32-opc.c > --- src/opcodes/or32-opc.c 11 Dec 2009 13:42:17 -0000 1.10 > +++ src/opcodes/or32-opc.c 20 Sep 2010 21:19:11 -0000 > @@ -898,7 +898,7 @@ or32_extract (char param_ch, char *enc_i > { > unsigned long tmp = strtol (enc, NULL, 16); > #if DEBUG > - printf (" enc=%s, tmp=%x ", enc, tmp); > + printf (" enc=%s, tmp=%lx ", enc, tmp); > #endif > if (param_ch == '0') > tmp = 15 - tmp; > @@ -918,7 +918,7 @@ or32_extract (char param_ch, char *enc_i > opc_pos--; > param_pos--; > #if DEBUG > - printf ("\n ret=%x opc_pos=%x, param_pos=%x\n", ret, opc_pos, > param_pos); > + printf ("\n ret=%lx opc_pos=%x, param_pos=%x\n", ret, > opc_pos, param_pos); > #endif > if (ISLOWER (param_ch)) > ret -= ((insn >> opc_pos) & 0x1) << param_pos; > @@ -940,7 +940,7 @@ or32_extract (char param_ch, char *enc_i > enc++; > > #if DEBUG > - printf ("ret=%x\n", ret); > + printf ("ret=%lx\n", ret); > #endif > return ret; > } >
- Previous message (by thread): [RFC/RFA] Fix building with -DDEBUG=7 CFLAGS option.
- Next message (by thread): about libbfd
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Binutils mailing list