[review v3] [gdb/testsuite] Compile ada with -lgnarl_pic and -lgnat_pic if required

Joel Brobecker (Code Review)
2019-11-02T00:04:03Z

Joel Brobecker has posted comments on this change.

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/32
......................................................................

Patch Set 3:

I think there is one weakness in the approach, which would show up if the program is to be compiled with '-bargs -shared', or when calling "gnatbind" with the '-shared' command-line argument. In that situation, it instructs the linker to use the shared version of libgnat, rather than the archive. In that case, I don't think you should be using -lgnat_pic, as I believe it would force the non-shared version to be used.

Ideally, what we would do to avoid that issue is to check whether the program is being compiled with a `-shared` option inside a `-bargs` section. This may require a bit of smart splitting, unfortunately.

The good news is that the above would effectively take care of another question of mine, which is the fact that the code links the program with libgnarl without checking that the program depends on the tasking runtime or not. For programs that don't use tasking, it's not desirable to include it like that. But the good news is, if we determine that the PIC versions are needed in general, and we don't see `-bargs -shared`, then we know we're linking against runtime archive files, and thus libgnarl ends up being ignored if nothing references it.

--
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: I3e1e40bd46236b45e2d7808c1cd744a075d4a148
Gerrit-Change-Number: 32
Gerrit-PatchSet: 3
Gerrit-Owner: Tom de Vries <tdevries@suse.de>
Gerrit-Reviewer: Joel Brobecker <brobecker@adacore.com>
Gerrit-Reviewer: Luis Machado <luis.machado@linaro.org>
Gerrit-Reviewer: Tom Tromey <tromey@sourceware.org>
Gerrit-Reviewer: Tom de Vries <tdevries@suse.de>
Gerrit-CC: Simon Marchi <simon.marchi@polymtl.ca>
Gerrit-Comment-Date: Sat, 02 Nov 2019 00:03:56 +0000
Gerrit-HasComments: No