From patchwork Fri Dec 14 18:03:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 30670 Received: (qmail 17201 invoked by alias); 14 Dec 2018 18:03:46 -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 17186 invoked by uid 89); 14 Dec 2018 18:03:45 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 spammy=strerror, Hx-spam-relays-external:15.20.1404.22, H*RU:15.20.1404.22, nongnu X-HELO: EUR03-VE1-obe.outbound.protection.outlook.com Received: from mail-eopbgr50048.outbound.protection.outlook.com (HELO EUR03-VE1-obe.outbound.protection.outlook.com) (40.107.5.48) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 14 Dec 2018 18:03:43 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector1-arm-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=IZWrLZVYqHjGJTd4YYnEnYz05LFQrM22eBgzm4jOn1o=; b=n8DwYSymW/ALz9vWiK12NTNNk7YVG4CBTpIxchyrb/XREPxaNK3y6AmpNX/WUe4h1+U7ca7FmO5cvBmk0i8NoYuBgZq5eHMEGUYvmTdoEQiDY9HGjj+JTTFa1sPKcuRU4OBh3wQQX+1PXAMpY8l8TH/FItJhwZ+fj1cedQEWl3E= Received: from VI1PR08MB4223.eurprd08.prod.outlook.com (20.178.13.96) by VI1PR08MB3214.eurprd08.prod.outlook.com (52.133.15.154) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1404.22; Fri, 14 Dec 2018 18:03:39 +0000 Received: from VI1PR08MB4223.eurprd08.prod.outlook.com ([fe80::b9e5:694c:a7d1:d37b]) by VI1PR08MB4223.eurprd08.prod.outlook.com ([fe80::b9e5:694c:a7d1:d37b%4]) with mapi id 15.20.1404.026; Fri, 14 Dec 2018 18:03:39 +0000 From: Szabolcs Nagy To: "gdb-patches@sourceware.org" CC: nd , Pedro Alves Subject: [PATCH][PR gdb/23985] Fix libinproctrace.so build Date: Fri, 14 Dec 2018 18:03:39 +0000 Message-ID: user-agent: Mozilla/5.0 (X11; Linux aarch64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 authentication-results: spf=none (sender IP is ) smtp.mailfrom=Szabolcs.Nagy@arm.com; received-spf: None (protection.outlook.com: arm.com does not designate permitted sender hosts) MIME-Version: 1.0 X-IsSubscribed: yes The IPA objects currently may use gnulib replacement apis, which is wrong: gnulib is not linked into the produced dso and it cannot be because it is not built with -fPIC -fvisibility=hidden. The gnulib replacement detection is broken under cross compilation: for targets other than *-gnu*, replacements are enabled that depend on execution time detection. This causes unnecessary build failure when the target has proper support for the replaced api. This fix tries to undo the replacements, which is tricky because the gnulib headers are still used for various compile time fixups and there is no simple knob in gnulib to only turn the replacements off. Without this workaround gdb fails to cross build to non-gnu targets: ld: tracepoint-ipa.o: in function `gdb_agent_helper_thread(void*)': gdb/gdbserver/tracepoint.c:7221: undefined reference to `rpl_strerror' ... Makefile:434: recipe for target 'libinproctrace.so' failed gdb/gdbserver/ChangeLog: 2018-12-14 Szabolcs Nagy PR gdb/23985 * Makefile.in (IPAGENT_CFLAGS): Add UNDO_GNULIB_CFLAGS. (UNDO_GNULIB_CFLAGS): Undo gnulib replacements. diff --git a/gdb/gdbserver/Makefile.in b/gdb/gdbserver/Makefile.in index dfefff9155..b4eb6ca0fb 100644 --- a/gdb/gdbserver/Makefile.in +++ b/gdb/gdbserver/Makefile.in @@ -544,9 +544,15 @@ regdat_sh = $(srcdir)/../regformats/regdat.sh UST_CFLAGS = $(ustinc) -DCONFIG_UST_GDB_INTEGRATION +# Undo gnulib replacements for the IPA shared library build. +# The gnulib headers are still needed, but gnulib is not linked +# into the IPA lib so replacement apis don't work. +UNDO_GNULIB_CFLAGS = -Drpl_strerror=strerror + # Note, we only build the IPA if -fvisibility=hidden is supported in # the first place. IPAGENT_CFLAGS = $(INTERNAL_CFLAGS) $(UST_CFLAGS) \ + $(UNDO_GNULIB_CFLAGS) \ -fPIC -DIN_PROCESS_AGENT \ -fvisibility=hidden