Message ID | 1509148689-6239-1-git-send-email-simon.marchi@ericsson.com |
---|---|
State | New, archived |
Headers |
Received: (qmail 16816 invoked by alias); 27 Oct 2017 23:58:32 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: <gdb-patches.sourceware.org> List-Unsubscribe: <mailto:gdb-patches-unsubscribe-##L=##H@sourceware.org> List-Subscribe: <mailto:gdb-patches-subscribe@sourceware.org> List-Archive: <http://sourceware.org/ml/gdb-patches/> List-Post: <mailto:gdb-patches@sourceware.org> List-Help: <mailto:gdb-patches-help@sourceware.org>, <http://sourceware.org/ml/#faqs> Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 16806 invoked by uid 89); 27 Oct 2017 23:58:30 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No 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 autolearn=ham version=3.3.2 spammy=H*Ad:D*mathworks.com X-HELO: sessmg22.ericsson.net Received: from sessmg22.ericsson.net (HELO sessmg22.ericsson.net) (193.180.251.58) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 27 Oct 2017 23:58:28 +0000 Received: from ESESSHC011.ericsson.se (Unknown_Domain [153.88.183.51]) by sessmg22.ericsson.net (Symantec Mail Security) with SMTP id 56.73.26775.228C3F95; Sat, 28 Oct 2017 01:58:26 +0200 (CEST) Received: from EUR01-HE1-obe.outbound.protection.outlook.com (153.88.183.145) by oa.msg.ericsson.com (153.88.183.51) with Microsoft SMTP Server (TLS) id 14.3.352.0; Sat, 28 Oct 2017 01:58:25 +0200 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=simon.marchi@ericsson.com; Received: from elxacz23q12.lan (192.222.251.162) by AMSPR07MB312.eurprd07.prod.outlook.com (2a01:111:e400:802f::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.178.3; Fri, 27 Oct 2017 23:58:22 +0000 From: Simon Marchi <simon.marchi@ericsson.com> To: <gdb-patches@sourceware.org> CC: Mike Gulick <mike.gulick@mathworks.com>, Simon Marchi <simon.marchi@ericsson.com> Subject: [PATCH] gdb_compile_shlib: Only consider shlib= options when building executables Date: Fri, 27 Oct 2017 19:58:09 -0400 Message-ID: <1509148689-6239-1-git-send-email-simon.marchi@ericsson.com> MIME-Version: 1.0 Content-Type: text/plain X-ClientProxiedBy: MWHPR1401CA0013.namprd14.prod.outlook.com (2603:10b6:301:4b::23) To AMSPR07MB312.eurprd07.prod.outlook.com (2a01:111:e400:802f::24) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2d07e9d4-1779-477e-5e39-08d51d969be3 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(4534020)(4602075)(2017052603199); SRVR:AMSPR07MB312; X-Microsoft-Exchange-Diagnostics: 1; AMSPR07MB312; 3:JElceUekEuQkL7QZfyk+vZJvyx5+FWi1xT5+6sARPpTM+Uq4/EdYsUKfzjNZd0XhhGssyojb2xnsiudjxDpM8nf/6DX9pc+iUJ603iV96JW0325Ka71LfgawLslX5IATI9ifUBaim/48YGTZqlUz2ZzvnA1q3W6dw6YNslcmBPI4g03786Hg6crw//cWQDkjKQK6espSZxUiH+UWWS8IT4nHPnrSpsD5fJiTWLM7tMkJK4KqEAWG1HhOuu9MwBTr; 25:EfcTM2h0do3JIje4MzIhstQ3EuyfVwjnwuh9a96HJhE2wuk6CFFszruzB92mqGFs9JSk68EaAZNkJOWSObOmmP3kwzTz5wb1mZxtnN3eliV2Dci7DUDv+2eTMJa8nBN0h0vFhpmSpD6yG58biCfGgJV+zc9oS4x6yHlghdT2xQbF29P53hQUbvHj1C+oPi6W2fv85s8l8CIF9JRuygOdlx04e2dk3Hs72bSE6Jzo5wA+TMzugAWh+7IY77cqw6l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v+0Rf+DylRD05cP8cOXaylpJD9NKUnpPCwRYVSxqYU+CQKhmEX/fsmHaUUEzyWsDK3EG6RFOhCaX74/H075MiTD1hBNFn0qCZgDAFmeMB5abnWEF6u3jjeNh/KLs/ep2Vm9Qj9OMwzG2UVDJslSIoldOgR9OYpQCvajJtdOzZxc96OFeXIVz7 X-Exchange-Antispam-Report-Test: UriScan:(17755550239193); X-Microsoft-Antispam-PRVS: <AMSPR07MB3124E6CF9DD29BAA6FE4110ED5A0@AMSPR07MB312.eurprd07.prod.outlook.com> X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(8121501046)(5005006)(93006095)(93001095)(3231020)(100000703101)(100105400095)(3002001)(10201501046)(6041248)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123560025)(20161123558100)(20161123564025)(20161123562025)(20161123555025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:AMSPR07MB312; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:AMSPR07MB312; X-Forefront-PRVS: 0473A03F3F X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(346002)(376002)(39860400002)(189002)(199003)(54534003)(50986999)(86362001)(4326008)(81166006)(8676002)(81156014)(5660300001)(6916009)(6512007)(25786009)(8936002)(6666003)(105586002)(3846002)(5003940100001)(33646002)(2351001)(97736004)(6116002)(101416001)(107886003)(2361001)(16526018)(53936002)(69596002)(106356001)(47776003)(189998001)(6486002)(16586007)(68736007)(66066001)(54906003)(48376002)(2906002)(305945005)(50226002)(6306002)(316002)(6506006)(478600001)(7736002)(966005)(21086003)(36756003)(50466002); DIR:OUT; SFP:1101; SCL:1; SRVR:AMSPR07MB312; H:elxacz23q12.lan; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: ericsson.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; AMSPR07MB312; 23:xzGo+tOw8phHCPknZoKK7aFIDzHMkC6JAQspWbVbpG?= =?us-ascii?Q?XITzYMJlqRV9553dzqhRHz8ZejLKbnF0reKm1FF0ycYEcxc83h4cSnB6Q/wO?= =?us-ascii?Q?2mu1V43N3PT/Ss1Gk4e1mceh/DMsMWCBOCKFS6TALvTlzIhZMV2nexSIebP4?= =?us-ascii?Q?ydptRvOl/AtP6ly1vRsWAXhwH9ckAHAdLBEQ3AEBXZZ2YM2Vhw0+yNtY/LuE?= =?us-ascii?Q?Y3ZlkuHZv6i7oafY9BS6nGziIIdIqGYI/HyhglWHk7+ZvNoftIGMJKce7zAp?= =?us-ascii?Q?lzrfNzb2J4EOwiy7jZkHL8kGA4GCmbe9+BOlvhEZoh9Zy6f0SDziak0K7uB3?= =?us-ascii?Q?I1xB1FnbhATeBywgPXli7CX8sUmbeZCdm4xNdPCqpSsLSpzBieJ70PV42f8Z?= =?us-ascii?Q?FoU7pZ3mtYF2ZBFfzwerYij/vTomy2LxAmWacQPFnfO02ck1+mtdrZ9FIUf8?= =?us-ascii?Q?nje2cOjGMwOOp0urQr3zQZuHjU/RH8x4QZuJSaETWyoh43KNYjCQ90PiojId?= =?us-ascii?Q?CfFfOFg71EV6rhBpIuVYhFPuE/ZH1AckRV1bgnWqngQIGutKJOdGGJDwayY6?= =?us-ascii?Q?dFQb9tTjGARfjVrIMx4lWRl0Tlm8b5ux6XXgeA4a8ixfyCKZpN4RnUzTAyzB?= =?us-ascii?Q?PYzZ2Titdj9T83NIeB9enrJ+4NcdnsNpRdSZhwBzD+uZ7Vv2IoPJl/QyjkWY?= =?us-ascii?Q?uBAX/OzrKS+Yx4A4pKPDpOyS5x0+XXmcwfEKNxIsbQG6bmsHvqrQfGE0cUPE?= =?us-ascii?Q?7yAujmatkoYrw/pd2yXA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1gYRKr3YlfY1X6p/VWtMnKzJX68tuP4ILHQXg2eOThYr0siy6SCoE6fGDX0zFSEaMEVM=; 24:j4fFS7q5Mcmm/XaiwJwgQCx5c811Bi7y0J2sCWEydR2mSqWji0zIP4xX40y6G7rwG9oxF2Zrg2oiibqAsq95vnvTIsLn4cwAMn+YK5OLR9g=; 7:8AwW4CVWx/K8w4mb9hrTmPwN0cj/brup3aT+LxpibQBaWkqQcNtMfUMjHNM5YuHQR3eWVEdO44WVm0Oh17PuSRRyAq4e4oTgHkzoqherwFQtVwvhDwXgguiFhoD/J/CjzIqofo/3U/py3mv8l91sq6ZIbVWTDMuIP69a6+2cHGtFX29RuGSzMWkyQtOw3I6suoaFeX6WHZ/qsie1IRB2ofCLYZDKvfJxr/DRql2Yj8hpCuzCuOyDGBeca2wMKBSC SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Oct 2017 23:58:22.8899 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2d07e9d4-1779-477e-5e39-08d51d969be3 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 92e84ceb-fbfd-47ab-be52-080c6b87953f X-MS-Exchange-Transport-CrossTenantHeadersStamped: AMSPR07MB312 X-OriginatorOrg: ericsson.com X-IsSubscribed: yes |
Commit Message
Simon Marchi
Oct. 27, 2017, 11:58 p.m. UTC
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 (which includes 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/lib/gdb.exp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
Comments
On 2017-10-27 19:58, Simon Marchi wrote: > 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 > (which includes 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/lib/gdb.exp | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp > index 548cb06..19a286b 100644 > --- a/gdb/testsuite/lib/gdb.exp > +++ b/gdb/testsuite/lib/gdb.exp > @@ -3506,7 +3506,8 @@ proc gdb_compile {source dest type options} { > set shlib_found 0 > set shlib_load 0 > foreach opt $options { > - if [regexp {^shlib=(.*)} $opt dummy_var shlib_name] { > + if {[regexp {^shlib=(.*)} $opt dummy_var shlib_name] > + && $type == "executable"} { > if [test_compiler_info "xlc-*"] { > # IBM xlc compiler doesn't accept shared library named other > # than .so: use "-Wl," to bypass this > @@ -3532,7 +3533,7 @@ proc gdb_compile {source dest type options} { > lappend new_options "early_flags=-Wl,--no-as-needed" > } > } > - } elseif { $opt == "shlib_load" } { > + } elseif { $opt == "shlib_load" && $type == "executable" } { > set shlib_load 1 > } else { > lappend new_options $opt I pushed this patch. Simon
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index 548cb06..19a286b 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -3506,7 +3506,8 @@ proc gdb_compile {source dest type options} { set shlib_found 0 set shlib_load 0 foreach opt $options { - if [regexp {^shlib=(.*)} $opt dummy_var shlib_name] { + if {[regexp {^shlib=(.*)} $opt dummy_var shlib_name] + && $type == "executable"} { if [test_compiler_info "xlc-*"] { # IBM xlc compiler doesn't accept shared library named other # than .so: use "-Wl," to bypass this @@ -3532,7 +3533,7 @@ proc gdb_compile {source dest type options} { lappend new_options "early_flags=-Wl,--no-as-needed" } } - } elseif { $opt == "shlib_load" } { + } elseif { $opt == "shlib_load" && $type == "executable" } { set shlib_load 1 } else { lappend new_options $opt