From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755970AbcEESc7 (ORCPT ); Thu, 5 May 2016 14:32:59 -0400 Received: from mail-wm0-f49.google.com ([74.125.82.49]:37341 "EHLO mail-wm0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751844AbcEESc5 (ORCPT ); Thu, 5 May 2016 14:32:57 -0400 Date: Thu, 5 May 2016 20:40:08 +0200 From: Emese Revfy To: Masahiro Yamada Cc: Linux Kbuild mailing list , PaX Team , Brad Spengler , kernel-hardening@lists.openwall.com, Michal Marek , Kees Cook , Rasmus Villemoes , Fengguang Wu , Dmitry Vyukov , Linux Kernel Mailing List , David Brown Subject: Re: [PATCH v7 1/6] Shared library support Message-Id: <20160505204008.863221b34f9b7c6111e4e7f9@gmail.com> In-Reply-To: References: <20160422201957.97ce16f0e67377d0ce613d19@gmail.com> <20160422202138.d50937e812b30aaba4f38a92@gmail.com> <20160502195617.9b2b7e07ced214a8f2136364@gmail.com> <20160503232932.706dd3bb081df5d04a390de9@gmail.com> X-Mailer: Sylpheed 3.5.0 (GTK+ 2.24.30; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 4 May 2016 13:09:05 +0900 Masahiro Yamada wrote: > Hi Emese, > > > 2016-05-04 6:29 GMT+09:00 Emese Revfy : > > On Tue, 3 May 2016 11:00:56 +0900 > > Masahiro Yamada wrote: > > > > Hi, > > > >> # Compile .c file, create position independent .o file > >> # host-cxxshobjs -> .o > >> quiet_cmd_host-cxxshobjs = HOSTCXX -fPIC $@ > >> cmd_host-cxxshobjs = $(HOSTCXX) $(hostcxx_flags) -fPIC -c -o $@ $< > >> $(host-cxxshobjs): $(obj)/%.o: $(src)/%.c FORCE > >> $(call if_changed_dep,host-cxxshobjs) > >> > >> > >> > >> > >> We generally use HOSTCC to compile *.c files, > >> and HOSTCXX to compile *.cc files. > >> > >> > >> But, here, you mention to use HOSTCXX to compile .c files > >> such as cyc_complexity_plugin.c, sancov_plugin.c, etc. > >> > >> This is not straight-forward. It is worthwhile to comment the reason. > > > > I wrote a comment about it here: > > https://github.com/ephox-gcc-plugins/gcc-plugins_linux-next/commit/74f6343a7f13c071e00c417332051e25f15009ea > > > > > > +# Note that plugin capable gcc versions can be either C or C++ based > +# therefore plugin source files have to be compilable in both C and C++ mode. > +# This is why a C++ compiler is invoked on a .c file. > > Thanks. > > Please let me confirm if I understood correctly. > > > We generally have to do something with the name-space conflict > (with 'extern "C"') in the mixture of C/C++. > > Depending on the GCC version, > GCC-plugin-related libraries could be built for C or C++. > > So, we need to check the GCC version and choose correct one > from C or C++. The plugin source files have to be compilable by both versions because gcc versions 4.5 and 4.6 are compiled by a C compiler, gcc-4.7 can be compiled by a C or a C++ compiler, and versions 4.8+ can only be compiled by a C++ compiler. -- Emese