gdb: store gdbtk object files into their sources directory
Checks
| Context |
Check |
Description |
| linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 |
success
|
Build passed
|
| linaro-tcwg-bot/tcwg_gdb_build--master-arm |
success
|
Build passed
|
| linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 |
success
|
Test passed
|
| linaro-tcwg-bot/tcwg_gdb_check--master-arm |
success
|
Test passed
|
Commit Message
Do not list gdbtk required object file names, but generates them from
source file names.
Use gdb object file list rather than static library for linking insight.
---
gdb/Makefile.in | 31 ++++++++++---------------------
1 file changed, 10 insertions(+), 21 deletions(-)
Comments
>>>>> "Patrick" == Patrick Monnerat <patrick@monnerat.net> writes:
Patrick> Do not list gdbtk required object file names, but generates them from
Patrick> source file names.
Patrick> Use gdb object file list rather than static library for linking insight.
Patrick> SUBDIR_GDBTK_SRCS = \
Patrick> gdbtk/generic/gdbtk.c \
Patrick> gdbtk/generic/gdbtk-bp.c \
Patrick> gdbtk/generic/gdbtk-cmds.c \
Patrick> gdbtk/generic/gdbtk-hooks.c \
Patrick> gdbtk/generic/gdbtk-interp.c \
Patrick> - gdbtk/generic/gdbtk-main.c \
I was curious to know why this needed a special case.
Patrick> # Python files need special flags.
Patrick> python/%.o: INTERNAL_CFLAGS += $(PYTHON_CFLAGS)
Patrick> # Removing the old gdb first works better if it is running, at least on SunOS.
Patrick> -insight$(EXEEXT): gdbtk-main.o libgdb.a $(CDEPS) $(TDEPLIBS)
Patrick> - rm -f insight$(EXEEXT)
Patrick> +insight$(EXEEXT): gdbtk/generic/gdbtk-main.o $(LIBGDB_OBS) $(CDEPS) $(TDEPLIBS)
Patrick> + $(SILENCE) rm -f insight$(EXEEXT)
Patrick> $(ECHO_CXXLD) $(CC_LD) $(INTERNAL_LDFLAGS) $(WIN32LDAPP) \
Patrick> - -o insight$(EXEEXT) gdbtk-main.o libgdb.a \
Patrick> + -o insight$(EXEEXT) gdbtk/generic/gdbtk-main.o $(LIBGDB_OBS) \
... like why does it need to be mentioned here?
Patrick> # A list of all the objects we might care about in this build, for
Patrick> # dependency tracking.
Patrick> -all_object_files = gdb.o $(LIBGDB_OBS) gdbtk-main.o
Patrick> +all_object_files = gdb.o $(LIBGDB_OBS) gdbtk/generic/gdbtk-main.o
... or here.
It seems to me like the soutce file could just remain in the source list
and those explicit .o mentions could be dropped?
thanks,
Tom
On 4/6/26 8:15 PM, Tom Tromey wrote:
> Patrick> SUBDIR_GDBTK_SRCS = \
> Patrick> gdbtk/generic/gdbtk.c \
> Patrick> gdbtk/generic/gdbtk-bp.c \
> Patrick> gdbtk/generic/gdbtk-cmds.c \
> Patrick> gdbtk/generic/gdbtk-hooks.c \
> Patrick> gdbtk/generic/gdbtk-interp.c \
> Patrick> - gdbtk/generic/gdbtk-main.c \
>
> I was curious to know why this needed a special case.
What do you nean by "special case"? If this is the explicit listing of
object files in building SUBDIR_GDBTK_OBS, this was for historical
reasons. Conversion to patsubst use by you in 2017 was never applied to
iinsight/gdbtk.
>
> Patrick> # Python files need special flags.
> Patrick> python/%.o: INTERNAL_CFLAGS += $(PYTHON_CFLAGS)
>
> Patrick> # Removing the old gdb first works better if it is running, at least on SunOS.
> Patrick> -insight$(EXEEXT): gdbtk-main.o libgdb.a $(CDEPS) $(TDEPLIBS)
> Patrick> - rm -f insight$(EXEEXT)
> Patrick> +insight$(EXEEXT): gdbtk/generic/gdbtk-main.o $(LIBGDB_OBS) $(CDEPS) $(TDEPLIBS)
> Patrick> + $(SILENCE) rm -f insight$(EXEEXT)
> Patrick> $(ECHO_CXXLD) $(CC_LD) $(INTERNAL_LDFLAGS) $(WIN32LDAPP) \
> Patrick> - -o insight$(EXEEXT) gdbtk-main.o libgdb.a \
> Patrick> + -o insight$(EXEEXT) gdbtk/generic/gdbtk-main.o $(LIBGDB_OBS) \
>
> ... like why does it need to be mentioned here?
>
> Patrick> # A list of all the objects we might care about in this build, for
> Patrick> # dependency tracking.
> Patrick> -all_object_files = gdb.o $(LIBGDB_OBS) gdbtk-main.o
> Patrick> +all_object_files = gdb.o $(LIBGDB_OBS) gdbtk/generic/gdbtk-main.o
>
> ... or here.
>
> It seems to me like the soutce file could just remain in the source list
> and those explicit .o mentions could be dropped?
Still historical, at least for the gdb.o case.
However this is the correct way of doing since putting the
(gdbtk-)main.o files in *_OBS respective lists causes a duplicate main
symbol definition at insight link time.
I also tried to use the static libraries rather than .so lists, but that
did not work either because there are mutual dependencies in libraries.
Maybe you have another solution ?
Thanks for your review,
Patrick
>>>>> "Patrick" == Patrick Monnerat <patrick@monnerat.net> writes:
Patrick> On 4/6/26 8:15 PM, Tom Tromey wrote:
Patrick> SUBDIR_GDBTK_SRCS = \
Patrick> gdbtk/generic/gdbtk.c \
Patrick> gdbtk/generic/gdbtk-bp.c \
Patrick> gdbtk/generic/gdbtk-cmds.c \
Patrick> gdbtk/generic/gdbtk-hooks.c \
Patrick> gdbtk/generic/gdbtk-interp.c \
Patrick> - gdbtk/generic/gdbtk-main.c \
>> I was curious to know why this needed a special case.
Patrick> What do you nean by "special case"?
I mean why is it necessary to remove gdbtk-main.c from this list.
Patrick> However this is the correct way of doing since putting the
Patrick> (gdbtk-)main.o files in *_OBS respective lists causes a duplicate main
Patrick> symbol definition at insight link time.
Why is that?
Tom
@@ -558,29 +558,19 @@ GDBTK_LIBRARY = $(datadir)/insight$(GDBTK_VERSION)
# the testsuite won't run properly.
GDBTK_SRC_DIR = @GDBTK_SRC_DIR@
-SUBDIR_GDBTK_OBS = \
- gdbtk.o \
- gdbtk-bp.o \
- gdbtk-cmds.o \
- gdbtk-hooks.o \
- gdbtk-interp.o \
- gdbtk-register.o \
- gdbtk-stack.o \
- gdbtk-varobj.o \
- gdbtk-wrapper.o
-
SUBDIR_GDBTK_SRCS = \
gdbtk/generic/gdbtk.c \
gdbtk/generic/gdbtk-bp.c \
gdbtk/generic/gdbtk-cmds.c \
gdbtk/generic/gdbtk-hooks.c \
gdbtk/generic/gdbtk-interp.c \
- gdbtk/generic/gdbtk-main.c \
gdbtk/generic/gdbtk-register.c \
gdbtk/generic/gdbtk-stack.c \
gdbtk/generic/gdbtk-varobj.c \
gdbtk/generic/gdbtk-wrapper.c
+SUBDIR_GDBTK_OBS = $(patsubst %.c,%.o,$(SUBDIR_GDBTK_SRCS))
+
SUBDIR_GDBTK_DEPS = $(LIBGUI) $(TCL_DEPS) $(TK_DEPS)
SUBDIR_GDBTK_LDFLAGS =
SUBDIR_GDBTK_CFLAGS= -DGDBTK -D@TCL_PLATFORM_DEFINE@ -D@TK_PLATFORM_DEFINE@
@@ -598,7 +588,7 @@ HAVE_NATIVE_GCORE_TARGET = @HAVE_NATIVE_GCORE_TARGET@
HAVE_GSTACK = @HAVE_GSTACK@
CONFIG_SRC_SUBDIR = arch cli dwarf2 mi compile tui unittests guile python \
- target nat
+ target nat gdbtk/generic
CONFIG_DEP_SUBDIR = $(addsuffix /$(DEPDIR),$(CONFIG_SRC_SUBDIR))
# -I. for config files.
@@ -2109,10 +2099,8 @@ $(CONFIG_DEP_SUBDIR):
# Python files need special flags.
python/%.o: INTERNAL_CFLAGS += $(PYTHON_CFLAGS)
-# Rules for compiling .c files in the various source subdirectories.
-%.o: $(srcdir)/gdbtk/generic/%.c
- $(COMPILE) $(all_gdbtk_cflags) $<
- $(POSTCOMPILE)
+# Insight UI needs special flags.
+gdbtk/generic/%.o: INTERNAL_CFLAGS += $(all_gdbtk_cflags)
installcheck:
@@ -2342,6 +2330,7 @@ uninstall: force $(CONFIG_UNINSTALL)
# computing the list of source files from the list of object files.
INIT_FILES_FILTER_OUT = \
+ gdbres.o \
init.o \
version.o \
xml-builtin.o \
@@ -2823,10 +2812,10 @@ clean-gdbtk:
rm -f insight$(EXEEXT)
# Removing the old gdb first works better if it is running, at least on SunOS.
-insight$(EXEEXT): gdbtk-main.o libgdb.a $(CDEPS) $(TDEPLIBS)
- rm -f insight$(EXEEXT)
+insight$(EXEEXT): gdbtk/generic/gdbtk-main.o $(LIBGDB_OBS) $(CDEPS) $(TDEPLIBS)
+ $(SILENCE) rm -f insight$(EXEEXT)
$(ECHO_CXXLD) $(CC_LD) $(INTERNAL_LDFLAGS) $(WIN32LDAPP) \
- -o insight$(EXEEXT) gdbtk-main.o libgdb.a \
+ -o insight$(EXEEXT) gdbtk/generic/gdbtk-main.o $(LIBGDB_OBS) \
$(TDEPLIBS) $(TUI_LIBRARY) $(CLIBS) $(LOADLIBES)
gdbres.o: $(srcdir)/gdbtk/gdb.rc $(srcdir)/gdbtk/gdbtool.ico
@@ -2861,7 +2850,7 @@ endif
# A list of all the objects we might care about in this build, for
# dependency tracking.
-all_object_files = gdb.o $(LIBGDB_OBS) gdbtk-main.o
+all_object_files = gdb.o $(LIBGDB_OBS) gdbtk/generic/gdbtk-main.o
# All the .deps files to include.
all_deps_files = $(foreach dep,$(patsubst %.o,%.Po,$(all_object_files)),\