From: Simon Marchi <simark@simark.ca>
To: Tom de Vries <tdevries@suse.de>, gdb-patches@sourceware.org
Subject: Re: [PATCH][gdb/testsuite] Don't pass -fPIC to gdb_compile_shlib
Date: Mon, 14 Dec 2020 11:30:49 -0500 [thread overview]
Message-ID: <1373362e-778e-65f6-1d85-3e75e1c34823@simark.ca> (raw)
In-Reply-To: <20201207122016.GA14320@delia>
On 2020-12-07 7:20 a.m., Tom de Vries wrote:
> Hi,
>
> When running test-case gdb.base/info-shared.exp, I see in gdb.log:
> ...
> Executing on host: \
> gcc ... -fPIC -fpic -c -o info-shared-solib1.c.o info-shared-solib1.c
> ...
>
> The -fPIC comes from the test-case:
> ...
> if { [gdb_compile_shlib $srcfile_lib1 $binfile_lib1 \
> [list additional_flags=-fPIC]] != "" } {
> ...
> but the -fpic, which overrides the -fPIC comes from gdb_compile_shlib.
>
> The proc gdb_compile_shlib adds the -fpic or similar dependent on platform
> and compiler. However, in some cases it doesn't add anything, which is
> probably why all those test-case pass -fPIC.
>
> Fix this by removing -fPIC from all the calls to gdb_compile_shlib, and
> ensuring that gdb_compile_shlib takes care of adding it, if required.
>
> Tested on x86_64-linux.
>
> Any comments?
I agree with the direction, where the test cases themselves should
encode the least knowledge as possible about how to compile things. So
from my point of view, this LGTM. Just one formatting nit below.
> diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
> index e413bab93c..e35d236018 100644
> --- a/gdb/testsuite/lib/gdb.exp
> +++ b/gdb/testsuite/lib/gdb.exp
> @@ -4304,17 +4304,21 @@ proc gdb_compile_shlib {sources dest options} {
> lappend obj_options "additional_flags=-qpic"
> }
> "clang-*" {
> - if { !([istarget "*-*-cygwin*"]
> - || [istarget "*-*-mingw*"]) } {
> + if { [istarget "*-*-cygwin*"]
> + || [istarget "*-*-mingw*"] } {
> + lappend obj_options "additional_flags=-fPIC"
> + } else {
> lappend obj_options "additional_flags=-fpic"
> }
> }
> "gcc-*" {
> - if { !([istarget "powerpc*-*-aix*"]
> + if { [istarget "powerpc*-*-aix*"]
> || [istarget "rs6000*-*-aix*"]
> || [istarget "*-*-cygwin*"]
> || [istarget "*-*-mingw*"]
> - || [istarget "*-*-pe*"]) } {
> + || [istarget "*-*-pe*"] } {
The last line is not aligned with the others. I never know how to
properly wrap TCL code, but you can at least make them aligned with the
existing ones.
Simon
next prev parent reply other threads:[~2020-12-14 16:30 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-07 12:20 Tom de Vries
2020-12-13 13:39 ` Joel Brobecker
2020-12-13 15:43 ` Tom de Vries
2020-12-14 16:30 ` Simon Marchi [this message]
2020-12-15 15:34 ` Luis Machado via Gdb-patches
2020-12-16 22:00 ` Tom de Vries
2020-12-17 13:26 ` Luis Machado via Gdb-patches
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1373362e-778e-65f6-1d85-3e75e1c34823@simark.ca \
--to=simark@simark.ca \
--cc=gdb-patches@sourceware.org \
--cc=tdevries@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox