debug compile: Replace confusing debug message
Commit Message
Hi,
It was found that
(gdb) set debug compile 1
(gdb) compile code 1
[...]
allocated 0x7f bytes at 0x7ffff7ff9000 prot 5
allocated 0x38 bytes at 0x7ffff7ff8000 prot 1
lookup undefined ELF symbol "_GLOBAL_OFFSET_TABLE_"
allocated 0x10 bytes at 0x7ffff7ff7000 for registers
(gdb) _
the message 'lookup undefined ELF symbol' looks as an error to people,
including to myself once.
->
allocated 0x7f bytes at 0x7ffff7ff9000 prot 5
allocated 0x38 bytes at 0x7ffff7ff8000 prot 1
ELF symbol "_GLOBAL_OFFSET_TABLE_" relocated to zero
allocated 0x10 bytes at 0x7ffff7ff7000 for registers
(gdb) _
Jan
2015-07-01 Jan Kratochvil <jan.kratochvil@redhat.com>
* compile/compile-object-load.c (compile_object_load): Replace debug
message "lookup undefined ELF symbol" by 3 more specific messages.
Comments
On 01/07/15 13:20, Jan Kratochvil wrote:
> Hi,
>
> It was found that
>
> (gdb) set debug compile 1
> (gdb) compile code 1
> [...]
> allocated 0x7f bytes at 0x7ffff7ff9000 prot 5
> allocated 0x38 bytes at 0x7ffff7ff8000 prot 1
> lookup undefined ELF symbol "_GLOBAL_OFFSET_TABLE_"
> allocated 0x10 bytes at 0x7ffff7ff7000 for registers
> (gdb) _
>
> the message 'lookup undefined ELF symbol' looks as an error to people,
> including to myself once.
>
> ->
> allocated 0x7f bytes at 0x7ffff7ff9000 prot 5
> allocated 0x38 bytes at 0x7ffff7ff8000 prot 1
> ELF symbol "_GLOBAL_OFFSET_TABLE_" relocated to zero
> allocated 0x10 bytes at 0x7ffff7ff7000 for registers
> (gdb) _
>
Fine by me
Cheers
Phil
OK.
On 07/01/2015 01:20 PM, Jan Kratochvil wrote:
> if (strcmp (sym->name, "_GLOBAL_OFFSET_TABLE_") == 0)
> {
It'd be nice to have a comment here mentioning why we need to do this.
Thanks,
Pedro Alves
On Wed, 01 Jul 2015 16:10:22 +0200, Pedro Alves wrote:
> OK.
>
> On 07/01/2015 01:20 PM, Jan Kratochvil wrote:
>
> > if (strcmp (sym->name, "_GLOBAL_OFFSET_TABLE_") == 0)
> > {
>
> It'd be nice to have a comment here mentioning why we need to do this.
I do not know, I think it is a GCC bug, with -mcmodel=large I have no idea why
GCC needs _GLOBAL_OFFSET_TABLE_. I can write there this info.
Jan
@@ -731,14 +731,14 @@ compile_object_load (const char *object_file, const char *source_file,
if (sym->flags != 0)
continue;
- if (compile_debug)
- fprintf_unfiltered (gdb_stdlog,
- "lookup undefined ELF symbol \"%s\"\n",
- sym->name);
sym->flags = BSF_GLOBAL;
sym->section = bfd_abs_section_ptr;
if (strcmp (sym->name, "_GLOBAL_OFFSET_TABLE_") == 0)
{
+ if (compile_debug)
+ fprintf_unfiltered (gdb_stdlog,
+ "ELF symbol \"%s\" relocated to zero\n",
+ sym->name);
sym->value = 0;
continue;
}
@@ -748,10 +748,21 @@ compile_object_load (const char *object_file, const char *source_file,
{
case mst_text:
sym->value = BMSYMBOL_VALUE_ADDRESS (bmsym);
+ if (compile_debug)
+ fprintf_unfiltered (gdb_stdlog,
+ "ELF mst_text symbol \"%s\" relocated to %s\n",
+ sym->name,
+ paddress (target_gdbarch (), sym->value));
break;
case mst_text_gnu_ifunc:
sym->value = gnu_ifunc_resolve_addr (target_gdbarch (),
BMSYMBOL_VALUE_ADDRESS (bmsym));
+ if (compile_debug)
+ fprintf_unfiltered (gdb_stdlog,
+ "ELF mst_text_gnu_ifunc symbol \"%s\" "
+ "relocated to %s\n",
+ sym->name,
+ paddress (target_gdbarch (), sym->value));
break;
default:
warning (_("Could not find symbol \"%s\" "