https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=231832 Index: gdb-7.4.50.20111218/gdb/symmisc.c =================================================================== --- gdb-7.4.50.20111218.orig/gdb/symmisc.c 2011-04-04 17:19:59.000000000 +0200 +++ gdb-7.4.50.20111218/gdb/symmisc.c 2011-12-19 00:28:18.189232014 +0100 @@ -147,8 +147,8 @@ print_objfile_statistics (void) if (OBJSTAT (objfile, sz_strtab) > 0) printf_filtered (_(" Space used by a.out string tables: %d\n"), OBJSTAT (objfile, sz_strtab)); - printf_filtered (_(" Total memory used for objfile obstack: %d\n"), - obstack_memory_used (&objfile->objfile_obstack)); + printf_filtered (_(" Total memory used for objfile obstack: %ld\n"), + (long) obstack_memory_used (&objfile->objfile_obstack)); printf_filtered (_(" Total memory used for psymbol cache: %d\n"), bcache_memory_used (psymbol_bcache_get_bcache (objfile->psymbol_cache))); Index: gdb-7.4.50.20111218/include/obstack.h =================================================================== --- gdb-7.4.50.20111218.orig/include/obstack.h 2011-10-22 03:35:29.000000000 +0200 +++ gdb-7.4.50.20111218/include/obstack.h 2011-12-19 00:28:18.189232014 +0100 @@ -188,31 +188,31 @@ struct obstack /* control current objec /* Declare the external functions we use; they are in obstack.c. */ -extern void _obstack_newchunk (struct obstack *, int); +extern void _obstack_newchunk (struct obstack *, PTR_INT_TYPE); extern void _obstack_free (struct obstack *, void *); -extern int _obstack_begin (struct obstack *, int, int, +extern int _obstack_begin (struct obstack *, PTR_INT_TYPE, int, void *(*) (long), void (*) (void *)); -extern int _obstack_begin_1 (struct obstack *, int, int, +extern int _obstack_begin_1 (struct obstack *, PTR_INT_TYPE, int, void *(*) (void *, long), void (*) (void *, void *), void *); -extern int _obstack_memory_used (struct obstack *); +extern PTR_INT_TYPE _obstack_memory_used (struct obstack *); /* Do the function-declarations after the structs but before defining the macros. */ void obstack_init (struct obstack *obstack); -void * obstack_alloc (struct obstack *obstack, int size); +void * obstack_alloc (struct obstack *obstack, PTR_INT_TYPE size); -void * obstack_copy (struct obstack *obstack, void *address, int size); -void * obstack_copy0 (struct obstack *obstack, void *address, int size); +void * obstack_copy (struct obstack *obstack, void *address, PTR_INT_TYPE size); +void * obstack_copy0 (struct obstack *obstack, void *address, PTR_INT_TYPE size); void obstack_free (struct obstack *obstack, void *block); -void obstack_blank (struct obstack *obstack, int size); +void obstack_blank (struct obstack *obstack, PTR_INT_TYPE size); -void obstack_grow (struct obstack *obstack, void *data, int size); -void obstack_grow0 (struct obstack *obstack, void *data, int size); +void obstack_grow (struct obstack *obstack, void *data, PTR_INT_TYPE size); +void obstack_grow0 (struct obstack *obstack, void *data, PTR_INT_TYPE size); void obstack_1grow (struct obstack *obstack, int data_char); void obstack_ptr_grow (struct obstack *obstack, void *data); @@ -220,20 +220,20 @@ void obstack_int_grow (struct obstack *o void * obstack_finish (struct obstack *obstack); -int obstack_object_size (struct obstack *obstack); +PTR_INT_TYPE obstack_object_size (struct obstack *obstack); -int obstack_room (struct obstack *obstack); -void obstack_make_room (struct obstack *obstack, int size); +PTR_INT_TYPE obstack_room (struct obstack *obstack); +void obstack_make_room (struct obstack *obstack, PTR_INT_TYPE size); void obstack_1grow_fast (struct obstack *obstack, int data_char); void obstack_ptr_grow_fast (struct obstack *obstack, void *data); void obstack_int_grow_fast (struct obstack *obstack, int data); -void obstack_blank_fast (struct obstack *obstack, int size); +void obstack_blank_fast (struct obstack *obstack, PTR_INT_TYPE size); void * obstack_base (struct obstack *obstack); void * obstack_next_free (struct obstack *obstack); int obstack_alignment_mask (struct obstack *obstack); -int obstack_chunk_size (struct obstack *obstack); -int obstack_memory_used (struct obstack *obstack); +size_t obstack_chunk_size (struct obstack *obstack); +size_t obstack_memory_used (struct obstack *obstack); /* Error handler called when `obstack_chunk_alloc' failed to allocate more memory. This can be set to a user defined function. The @@ -318,7 +318,7 @@ extern int obstack_exit_failure; # define obstack_make_room(OBSTACK,length) \ __extension__ \ ({ struct obstack *__o = (OBSTACK); \ - int __len = (length); \ + PTR_INT_TYPE __len = (length); \ if (__o->chunk_limit - __o->next_free < __len) \ _obstack_newchunk (__o, __len); \ (void) 0; }) @@ -331,7 +331,7 @@ __extension__ \ # define obstack_grow(OBSTACK,where,length) \ __extension__ \ ({ struct obstack *__o = (OBSTACK); \ - int __len = (length); \ + PTR_INT_TYPE __len = (length); \ if (__o->next_free + __len > __o->chunk_limit) \ _obstack_newchunk (__o, __len); \ _obstack_memcpy (__o->next_free, (where), __len); \ @@ -341,7 +341,7 @@ __extension__ \ # define obstack_grow0(OBSTACK,where,length) \ __extension__ \ ({ struct obstack *__o = (OBSTACK); \ - int __len = (length); \ + PTR_INT_TYPE __len = (length); \ if (__o->next_free + __len + 1 > __o->chunk_limit) \ _obstack_newchunk (__o, __len + 1); \ _obstack_memcpy (__o->next_free, (where), __len); \ @@ -392,7 +392,7 @@ __extension__ \ # define obstack_blank(OBSTACK,length) \ __extension__ \ ({ struct obstack *__o = (OBSTACK); \ - int __len = (length); \ + PTR_INT_TYPE __len = (length); \ if (__o->chunk_limit - __o->next_free < __len) \ _obstack_newchunk (__o, __len); \ obstack_blank_fast (__o, __len); \ Index: gdb-7.4.50.20111218/libiberty/obstack.c =================================================================== --- gdb-7.4.50.20111218.orig/libiberty/obstack.c 2005-05-10 17:33:33.000000000 +0200 +++ gdb-7.4.50.20111218/libiberty/obstack.c 2011-12-19 00:28:18.191232006 +0100 @@ -44,9 +44,11 @@ #if !defined (_LIBC) && defined (__GNU_LIBRARY__) && __GNU_LIBRARY__ > 1 #include #if _GNU_OBSTACK_INTERFACE_VERSION == OBSTACK_INTERFACE_VERSION +#if 0 /* 64-bit obstack is not compatible with any glibc implementation. */ #define ELIDE_CODE #endif #endif +#endif #ifndef ELIDE_CODE @@ -139,7 +141,7 @@ struct obstack *_obstack; free up some memory, then call this again. */ int -_obstack_begin (struct obstack *h, int size, int alignment, +_obstack_begin (struct obstack *h, PTR_INT_TYPE size, int alignment, POINTER (*chunkfun) (long), void (*freefun) (void *)) { register struct _obstack_chunk *chunk; /* points to new chunk */ @@ -183,7 +185,7 @@ _obstack_begin (struct obstack *h, int s } int -_obstack_begin_1 (struct obstack *h, int size, int alignment, +_obstack_begin_1 (struct obstack *h, PTR_INT_TYPE size, int alignment, POINTER (*chunkfun) (POINTER, long), void (*freefun) (POINTER, POINTER), POINTER arg) { @@ -235,7 +237,7 @@ _obstack_begin_1 (struct obstack *h, int to the beginning of the new one. */ void -_obstack_newchunk (struct obstack *h, int length) +_obstack_newchunk (struct obstack *h, PTR_INT_TYPE length) { register struct _obstack_chunk *old_chunk = h->chunk; register struct _obstack_chunk *new_chunk; @@ -388,11 +390,11 @@ obstack_free (struct obstack *h, POINTER abort (); } -int +PTR_INT_TYPE _obstack_memory_used (struct obstack *h) { register struct _obstack_chunk* lp; - register int nbytes = 0; + register PTR_INT_TYPE nbytes = 0; for (lp = h->chunk; lp != 0; lp = lp->prev) { @@ -421,6 +423,7 @@ print_and_abort (void) } #if 0 +/* These functions are now broken for 64-bit obstack! */ /* These are now turned off because the applications do not use it and it uses bcopy via obstack_grow, which causes trouble on sysV. */