[PATCH][gdb/testsuite] Fix ada tests with -fPIE/-pie

Tom de Vries tdevries@suse.de
Thu Aug 8 10:15:00 GMT 2019


On 07-08-19 17:27, Tom de Vries wrote:
> On 07-08-19 16:18, Tom Tromey wrote:
>>>>>>> "Tom" == Tom de Vries <tdevries@suse.de> writes:
>>
>> Tom> When running the gdb testsuite with target board unix/-fPIE/-pie, the
>> Tom> resulting ada executables are not PIE executables, because gnatmake doesn't
>> Tom> recognize -pie, and consequently doesn't pass it to gnatlink.
>>
>> Tom> Fix this by replacing "-pie" with "-largs -pie -margs" for ada test-cases in
>> Tom> gdb_default_target_compile, and doing the same for -no-pie.
>>
>> I think this is a good idea overall.
>>
>> However, is gdb_default_target_compile still used?  And if so, by what
>> path?
> 
> I'm using dejagnu 1.6.1, and that one does not have find_go_linker. So,
> use_gdb_compile is set to 1 and we get:
> ...
> if {$use_gdb_compile} {
>     catch {rename default_target_compile {}}
>     rename gdb_default_target_compile default_target_compile
> }
> ...
> 
>>  My understanding is that with a "new enough" dejagnu, it won't be
>> used -- so some users might still see the old behavior.
>>
> 
> AFAIU, yes. Hmm, that's not good.
> 
>> Basically gdb_default_target_compile is all a big monkeypatching hack
> 
> /me reads https://en.wikipedia.org/wiki/Monkey_patch
> 
>> and it would be way better to have some kind of more principled approach
>> upstream.
> 
> Agreed.
> 
>> I don't know what that would look like.  And of course to get
>> there we'd probably need even more monkeypatching.
> 
> The following uses the approach taken in lib/cell.exp.
> 
> Is this any better?
> 

Updated rationale and ChangeLog entry.

OK for trunk?

Thanks,
- Tom

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-gdb-testsuite-Fix-ada-tests-with-fPIE-pie.patch
Type: text/x-patch
Size: 1811 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/gdb-patches/attachments/20190808/08797954/attachment.bin>


More information about the Gdb-patches mailing list