From patchwork Wed Feb 7 11:04:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Hayward X-Patchwork-Id: 25853 Received: (qmail 104121 invoked by alias); 7 Feb 2018 11:04:57 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 104107 invoked by uid 89); 7 Feb 2018 11:04:56 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.7 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LOTSOFHASH, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 spammy=shortest, formato, Later X-HELO: EUR02-AM5-obe.outbound.protection.outlook.com Received: from mail-eopbgr00051.outbound.protection.outlook.com (HELO EUR02-AM5-obe.outbound.protection.outlook.com) (40.107.0.51) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 07 Feb 2018 11:04:51 +0000 Received: from AM3PR08MB0101.eurprd08.prod.outlook.com (10.160.211.19) by AM3PR08MB0104.eurprd08.prod.outlook.com (10.160.211.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.464.11; Wed, 7 Feb 2018 11:04:47 +0000 Received: from AM3PR08MB0101.eurprd08.prod.outlook.com ([fe80::c95:81b8:c681:ae2]) by AM3PR08MB0101.eurprd08.prod.outlook.com ([fe80::c95:81b8:c681:ae2%17]) with mapi id 15.20.0464.016; Wed, 7 Feb 2018 11:04:47 +0000 From: Alan Hayward To: "gdb-patches@sourceware.org" CC: nd Subject: [PATCH] Add common/ dir in build directories Date: Wed, 7 Feb 2018 11:04:46 +0000 Message-ID: <59F17949-2E3B-445F-9599-2412B7F4AF72@arm.com> authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alan.Hayward@arm.com; x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; AM3PR08MB0104; 7:p3rRSKTEZPOeQBXgMtj3geAcwL2U+RsXpoFFVE9liXOsmHf9L9yFdI0n+VEitEYV4G3GQQa92xAKksyo2RtLFcc8NL3nPX4S8MYqJniFG8T0NBn+bKezBfGLdstNnhezNAF/JyFM1oyNkafgojRbVECyua7mGUsz55aM12H/+EV5x2SAJCe0FnPGnJey2dIs0eG4Ng7nbvR0XUVYEFRlvzBzCrm+eVRYMhQz6h42mBusZ4d3xbgugW/LP+D3Kz8f x-ms-exchange-antispam-srfa-diagnostics: SSOS; x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: cfd4a194-8f98-44e9-2afc-08d56e1a99e6 x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603307)(7153060)(7193020); SRVR:AM3PR08MB0104; x-ms-traffictypediagnostic: AM3PR08MB0104: nodisclaimer: True x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(180628864354917); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040501)(2401047)(8121501046)(5005006)(3231101)(2400082)(944501161)(93006095)(93001095)(3002001)(10201501046)(6055026)(6041288)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123562045)(20161123564045)(6072148)(201708071742011); SRVR:AM3PR08MB0104; BCL:0; PCL:0; RULEID:; SRVR:AM3PR08MB0104; x-forefront-prvs: 0576145E86 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(366004)(376002)(346002)(396003)(39860400002)(39380400002)(377424004)(54534003)(199004)(189003)(53936002)(2351001)(33656002)(3846002)(106356001)(2900100001)(316002)(6116002)(8676002)(14454004)(36756003)(26005)(478600001)(72206003)(59450400001)(86362001)(6916009)(575784001)(6506007)(102836004)(186003)(81166006)(3660700001)(81156014)(97736004)(1857600001)(6436002)(99286004)(3280700002)(4326008)(8936002)(5660300001)(7736002)(6486002)(25786009)(5250100002)(82746002)(2501003)(66066001)(305945005)(2906002)(105586002)(83716003)(5640700003)(68736007)(6512007); DIR:OUT; SFP:1101; SCL:1; SRVR:AM3PR08MB0104; H:AM3PR08MB0101.eurprd08.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; received-spf: None (protection.outlook.com: arm.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: 2F30UPAfcGOLj/oF7FqkeIWvc97mMb1TNOp1au6larbo29ygkXmioU6nFSav30tQOl/JUrJ2sPt1Av6Sav4Ggw== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-ID: <509DA73D5083D34A82DAFB847175FF68@eurprd08.prod.outlook.com> MIME-Version: 1.0 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-Network-Message-Id: cfd4a194-8f98-44e9-2afc-08d56e1a99e6 X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Feb 2018 11:04:47.2059 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM3PR08MB0104 X-IsSubscribed: yes In the build directory for gdb, there are directories for arch/, mi/, cli/, guile/ etc. These all contain the .o files for the matching directories in the source tree. However, all the .c files from common/ end up in the root of the gdb build directory. This means that gdb/common/agent.c has to have a special build rule in gdb so that it does not clash with gdb/agent.c Gdbserver is similar - it has an arch/ directory, but not a common/ directory. This patch simply adds a common/ directory in the build tree for both gdb and gdbserver. I've used the existing mechanisms to add them. I had to move around the rules in the gdbserver makefile, otherwise the build gets confused. Reordered file lists where appropriate. The special agent.c rule is removed. Original motivation for this patch is that eventually I want to add common/tdesc.c, but this will clash with gdbserver/tdesc.c. This patch has spun from the discussion in "[PATCH] Move arch/tdesc.h to common/common-tdesc.h". Testing by building x86 and aarch64. Ran make-check on x86 build with target boards unix and native-gdbserver. Alan. gdb/ChangeLog: 2018-02-07 Alan Hayward * Makefile.in: Add common directory in build. * common/common.host: Add common reference. * configure: Likewise. * configure.ac: Likewise. gdb/gdbserver/ChangeLog: 2018-02-07 Alan Hayward * Makefile.in: Add common directory in build. * configure: Add common reference. * configure.ac: Likewise. gdb/Makefile.in | 60 +++++++++++++++++++++++++++--------------------------------- gdb/common/common.host | 2 +- gdb/configure | 2 +- gdb/configure.ac | 2 +- gdb/gdbserver/Makefile.in | 98 +++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------- gdb/gdbserver/configure | 4 ++-- gdb/gdbserver/configure.ac | 4 ++-- 7 files changed, 83 insertions(+), 89 deletions(-) diff --git a/gdb/Makefile.in b/gdb/Makefile.in index 0f87398fbd87690522c3e3113c8a0fa4b67489f4..a99e71466fcb2ea85b57ef2e66976f4c5de674c3 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -522,7 +522,7 @@ CONFIG_INSTALL = @CONFIG_INSTALL@ CONFIG_UNINSTALL = @CONFIG_UNINSTALL@ HAVE_NATIVE_GCORE_TARGET = @HAVE_NATIVE_GCORE_TARGET@ -CONFIG_SRC_SUBDIR = arch cli mi compile tui unittests guile python target +CONFIG_SRC_SUBDIR = arch cli mi common compile tui unittests guile python target CONFIG_DEP_SUBDIR = $(addsuffix /$(DEPDIR),$(CONFIG_SRC_SUBDIR)) # -I. for config files. @@ -1531,35 +1531,35 @@ TAGFILES_NO_SRCDIR = $(SFILES) $(HFILES_NO_SRCDIR) $(ALLDEPFILES) \ TAGFILES_WITH_SRCDIR = $(HFILES_WITH_SRCDIR) COMMON_OBS = $(DEPFILES) $(CONFIG_OBS) $(YYOBJ) \ - btrace-common.o \ - buffer.o \ - cleanups.o \ - common-agent.o \ - common-debug.o \ - common-exceptions.o \ - job-control.o \ - common-regcache.o \ - common-utils.o \ - environ.o \ - errors.o \ + common/btrace-common.o \ + common/buffer.o \ + common/cleanups.o \ + common/agent.o \ + common/common-debug.o \ + common/common-exceptions.o \ + common/job-control.o \ + common/common-regcache.o \ + common/common-utils.o \ + common/environ.o \ + common/errors.o \ + common/fileio.o \ + common/filestuff.o \ + common/format.o \ + common/gdb_tilde_expand.o \ + common/gdb_vecs.o \ + common/new-op.o \ + common/print-utils.o \ + common/ptid.o \ + common/rsp-low.o \ + common/run-time-clock.o \ + common/signals.o \ + common/signals-state-save-restore.o \ + common/vec.o \ + common/xml-utils.o \ exec.o \ - fileio.o \ - filestuff.o \ - format.o \ - gdb_tilde_expand.o \ - gdb_vecs.o \ mi/mi-common.o \ - new-op.o \ - print-utils.o \ - ptid.o \ - rsp-low.o \ - run-time-clock.o \ - signals.o \ - signals-state-save-restore.o \ - vec.o \ version.o \ xml-builtin.o \ - xml-utils.o \ $(patsubst %.c,%.o,$(COMMON_SFILES)) \ $(SUBDIR_TARGET_OBS) \ $(SUBDIR_GCC_COMPILE_OBS) @@ -1627,7 +1627,7 @@ $(CONFIG_DEP_SUBDIR): python/%.o: INTERNAL_CFLAGS += $(PYTHON_CFLAGS) # Rules for compiling .c files in the various source subdirectories. -%.o: ${srcdir}/common/%.c +common/%.o: ${srcdir}/common/%.c $(COMPILE) $< $(POSTCOMPILE) @@ -1639,12 +1639,6 @@ python/%.o: INTERNAL_CFLAGS += $(PYTHON_CFLAGS) $(COMPILE) $< $(POSTCOMPILE) -# Specify an explicit rule for gdb/common/agent.c, to avoid a clash with the -# object file generate by gdb/agent.c. -common-agent.o: $(srcdir)/common/agent.c - $(COMPILE) $(srcdir)/common/agent.c - $(POSTCOMPILE) - installcheck: # The check target can not use subdir_do, because subdir_do does not diff --git a/gdb/common/common.host b/gdb/common/common.host index b7051d6eb7ab77dff989866a936a78b200e62d49..826088635937603c98f179184d4b97b41ccd760c 100644 --- a/gdb/common/common.host +++ b/gdb/common/common.host @@ -30,7 +30,7 @@ case "${host}" in *-mingw*) common_host_obs=mingw-strerror.o ;; *) - common_host_obs=posix-strerror.o + common_host_obs=common/posix-strerror.o ;; esac diff --git a/gdb/configure b/gdb/configure index 81b35af521e2704e2aca14011362971a030c49fe..ab58187853337c632af046adb589f9c8a5b9e8a3 100755 --- a/gdb/configure +++ b/gdb/configure @@ -17661,7 +17661,7 @@ if $development; then $as_echo "#define GDB_SELF_TEST 1" >>confdefs.h - CONFIG_OBS="$CONFIG_OBS \$(SUBDIR_UNITTESTS_OBS) selftest.o selftest-arch.o" + CONFIG_OBS="$CONFIG_OBS \$(SUBDIR_UNITTESTS_OBS) common/selftest.o selftest-arch.o" CONFIG_SRCS="$CONFIG_SRCS \$(SUBDIR_UNITTESTS_SRCS) common/selftest.c selftest-arch.c" fi diff --git a/gdb/configure.ac b/gdb/configure.ac index 125e5f30e65a7b046b5fab038bde3c5a2fe485c3..698fc7b83456f8c5a63ae0050dc8ec65069290f7 100644 --- a/gdb/configure.ac +++ b/gdb/configure.ac @@ -2299,7 +2299,7 @@ AC_DEFINE(GDB_DEFAULT_HOST_CHARSET, "UTF-8", if $development; then AC_DEFINE(GDB_SELF_TEST, 1, [Define if self-testing features should be enabled]) - CONFIG_OBS="$CONFIG_OBS \$(SUBDIR_UNITTESTS_OBS) selftest.o selftest-arch.o" + CONFIG_OBS="$CONFIG_OBS \$(SUBDIR_UNITTESTS_OBS) common/selftest.o selftest-arch.o" CONFIG_SRCS="$CONFIG_SRCS \$(SUBDIR_UNITTESTS_SRCS) common/selftest.c selftest-arch.c" fi diff --git a/gdb/gdbserver/Makefile.in b/gdb/gdbserver/Makefile.in index 3ce086d70f23df445b174c49c489ec8415d7614a..805129f6e31cd105d5fc5e8268a51a2ef1158f1b 100644 --- a/gdb/gdbserver/Makefile.in +++ b/gdb/gdbserver/Makefile.in @@ -231,48 +231,48 @@ SOURCES = $(SFILES) TAGFILES = $(SOURCES) ${HFILES} ${ALLPARAM} ${POSSLIBS} OBS = \ - agent.o \ ax.o \ - btrace-common.o \ - buffer.o \ - cleanups.o \ - common-debug.o \ - common-exceptions.o \ - job-control.o \ - common-regcache.o \ - common-utils.o \ + common/agent.o \ + common/btrace-common.o \ + common/buffer.o \ + common/cleanups.o \ + common/common-debug.o \ + common/common-exceptions.o \ + common/job-control.o \ + common/common-regcache.o \ + common/common-utils.o \ + common/errors.o \ + common/environ.o \ + common/fileio.o \ + common/filestuff.o \ + common/format.o \ + common/gdb_tilde_expand.o \ + common/gdb_vecs.o \ + common/new-op.o \ + common/print-utils.o \ + common/ptid.o \ + common/rsp-low.o \ + common/signals.o \ + common/signals-state-save-restore.o \ + common/vec.o \ + common/xml-utils.o \ debug.o \ dll.o \ - errors.o \ - environ.o \ event-loop.o \ - fileio.o \ - filestuff.o \ - format.o \ - gdb_tilde_expand.o \ - gdb_vecs.o \ hostio.o \ inferiors.o \ mem-break.o \ - new-op.o \ notif.o \ - print-utils.o \ - ptid.o \ regcache.o \ remote-utils.o \ - rsp-low.o \ server.o \ - signals.o \ - signals-state-save-restore.o \ symbol.o \ target.o \ tdesc.o \ tracepoint.o \ utils.o \ - vec.o \ version.o \ waitstatus.o \ - xml-utils.o \ $(DEPFILES) \ $(LIBOBJS) \ $(XML_BUILTIN) @@ -392,17 +392,17 @@ gdbreplay$(EXEEXT): $(GDBREPLAY_OBS) $(LIBGNU) $(LIBIBERTY) IPA_OBJS = \ ax-ipa.o \ - common-utils-ipa.o \ - errors-ipa.o \ - format-ipa.o \ - print-utils-ipa.o \ + common/common-utils-ipa.o \ + common/errors-ipa.o \ + common/format-ipa.o \ + common/print-utils-ipa.o \ + common/rsp-low-ipa.o \ + common/vec-ipa.o \ regcache-ipa.o \ remote-utils-ipa.o \ - rsp-low-ipa.o \ tdesc-ipa.o \ tracepoint-ipa.o \ utils-ipa.o \ - vec-ipa.o \ ${IPA_DEPFILES} IPA_LIB = libinproctrace.so @@ -537,10 +537,29 @@ ax.o: ax.c $(COMPILE) $(WARN_CFLAGS_NO_FORMAT) $< $(POSTCOMPILE) +# Note: Between two matching pattern rules, GNU Make 3.81 chooses the first one. +# Therefore, these need to be before "%.o: %.c" for it to be considered for +# files such as linux-amd64-ipa.o generated from linux-amd64-ipa.c. +# +# Later versions of GNU Make choose the rule with the shortest stem, so it would +# work in any order. + +arch/%-ipa.o: ../arch/%.c + $(IPAGENT_COMPILE) $< + $(POSTCOMPILE) + +common/%-ipa.o: ../common/%.c + $(IPAGENT_COMPILE) $< + $(POSTCOMPILE) + arch/%.o: ../arch/%.c $(COMPILE) $< $(POSTCOMPILE) +common/%.o: ../common/%.c + $(COMPILE) $< + $(POSTCOMPILE) + # Rules for objects that go in the in-process agent. %-ipa.o: %-generated.c @@ -551,25 +570,10 @@ arch/%.o: ../arch/%.c $(IPAGENT_COMPILE) $< $(POSTCOMPILE) -# Note: Between two matching pattern rules, GNU Make 3.81 chooses the first one. -# Therefore, this one needs to be before "%.o: %.c" for it to be considered for -# files such as linux-amd64-ipa.o generated from linux-amd64-ipa.c. -# -# Later versions of GNU Make choose the rule with the shortest stem, so it would -# work in any order. - %-ipa.o: %-ipa.c $(IPAGENT_COMPILE) $< $(POSTCOMPILE) -%-ipa.o: ../common/%.c - $(IPAGENT_COMPILE) $< - $(POSTCOMPILE) - -arch/%-ipa.o: ../arch/%.c - $(IPAGENT_COMPILE) $< - $(POSTCOMPILE) - # Rules for objects that go in the gdbserver binary. %.o: %-generated.c @@ -580,10 +584,6 @@ arch/%-ipa.o: ../arch/%.c $(COMPILE) $< $(POSTCOMPILE) -%.o: ../common/%.c - $(COMPILE) $< - $(POSTCOMPILE) - %.o: ../nat/%.c $(COMPILE) $< $(POSTCOMPILE) diff --git a/gdb/gdbserver/configure b/gdb/gdbserver/configure index 340ca7a19e5c0bc24ee2fc42226762185295d5ef..ab09261946442f77c85e7fd8d5ecc090527d1d4c 100755 --- a/gdb/gdbserver/configure +++ b/gdb/gdbserver/configure @@ -5815,7 +5815,7 @@ fi if $development; then - srv_selftest_objs="selftest.o" + srv_selftest_objs="common/selftest.o" $as_echo "#define GDB_SELF_TEST 1" >>confdefs.h @@ -5858,7 +5858,7 @@ ac_config_commands="$ac_config_commands depdir" # Create sub-directories for objects and dependencies. -CONFIG_SRC_SUBDIR="arch" +CONFIG_SRC_SUBDIR="arch common" ac_config_commands="$ac_config_commands gdbdepdir" diff --git a/gdb/gdbserver/configure.ac b/gdb/gdbserver/configure.ac index 6727959e61b656ddfc2101b830539fa18288ccb3..99801681ff47ee8dcd9ad2e5ae282dcd113c83e4 100644 --- a/gdb/gdbserver/configure.ac +++ b/gdb/gdbserver/configure.ac @@ -57,7 +57,7 @@ fi GDB_AC_LIBMCHECK(${libmcheck_default}) if $development; then - srv_selftest_objs="selftest.o" + srv_selftest_objs="common/selftest.o" AC_DEFINE(GDB_SELF_TEST, 1, [Define if self-testing features should be enabled]) fi @@ -69,7 +69,7 @@ ACX_NONCANONICAL_HOST ZW_CREATE_DEPDIR # Create sub-directories for objects and dependencies. -CONFIG_SRC_SUBDIR="arch" +CONFIG_SRC_SUBDIR="arch common" AC_SUBST(CONFIG_SRC_SUBDIR) AC_CONFIG_COMMANDS([gdbdepdir],[