Re: [PATCH] gdb.dwarf2: Define and use gdb_target_symbol_prefix for symbol prefixes

Pedro Alves
2015-10-30T11:11:37Z

On 10/30/2015 05:25 AM, Kevin Buettner wrote:
> On Thu, 29 Oct 2015 21:25:09 -0700
> Kevin Buettner <kevinb@redhat.com> wrote:
>
>> Some of the tests in gdb.dwarf2 which use Dwarf::assemble refer to
>> (minimal/linker) symbols created in the course of building a small
>> test program. Some targets use a prefix such as underscore ("_") on
>> these symbols. Many of the tests in gdb.dwarf2 do not take this into
>> account. As a consequence, these tests fail to build, resulting
>> either in failures or untested testcases.
>
> Several of the .S files in gdb.dwarf2 have the same problem. E.g.
> when linking the test case for gdb.dwarf2/method-ptr.exp, I see a
> linker error "undefined reference to `main'". It appears that crt0
> is generating a reference to _main, but the .S file only provides a
> reference to main.
>
> Any thoughts on what to do about this?

Isn't this being addressed by gdb_target_symbol_prefix_flags in
the existing tests that use it? E.g., gdb.arch/i386-bp_permanent.c:

#ifdef SYMBOL_PREFIX
#define SYMBOL(str) SYMBOL_PREFIX #str
#else
#define SYMBOL(str) #str
#endif

...

#ifdef __x86_64__
asm(".text\n"
" .align 8\n"
SYMBOL (standard) ":\n"

Thanks,
Pedro Alves