gdb_compile_shlib: Only consider shlib= options when building executables
authorSimon Marchi <simon.marchi@ericsson.com>
Fri, 12 Jan 2018 02:08:23 +0000 (21:08 -0500)
committerSimon Marchi <simon.marchi@ericsson.com>
Fri, 12 Jan 2018 02:08:23 +0000 (21:08 -0500)
commit6181e9c2c5ba252ac016f51903dc35d7bfbbca71
tree4dcde462196c1a04dbd925e8e57ad9efe9e02c0a
parent89a7f793f1963b14bd649afc4154903d22591ae0
gdb_compile_shlib: Only consider shlib= options when building executables

Trying to use gdb_compile_shlib with the shlib= option to build a shared
library that depends on another shared library does not work as of
today.  See:

  https://sourceware.org/ml/gdb-patches/2017-10/msg00733.html

The problem is that building the lib is done in two steps, compilation
(.c -> .o) and linking (.o -> .so) and the shlib= options are passed to
both steps.  When compiling the object file (.o), it results in gcc
complaining:

  gcc: warning: .../solib-vanish-lib2.so: linker input file unused because linking not done

The first solution I came up with was to filter the options inside
gdb_compile_shlib to remove the shlib= options from the options we pass
when compiling the .o file.

I then thought it would be simpler to ignore the shlib= options in
gdb_compile when not building an executable (the executable category
includes the shared libraries).  For other compilation types (object
file, preprocess and generate assembly), it doesn't make sense to add
shared libraries to the source file list.

Regtested on the buildbot.

gdb/testsuite/ChangeLog:

* lib/gdb.exp (gdb_compile): Ignore shlib= and shlib_load
options when not creating an executable.
gdb/testsuite/ChangeLog
gdb/testsuite/lib/gdb.exp
This page took 0.029934 seconds and 4 git commands to generate.