Re: [PATCH v5 1/5] Shared library support
From: Masahiro Yamada
Date: Wed Mar 16 2016 - 03:50:57 EST
2016-03-15 5:14 GMT+09:00 Emese Revfy <re.emese@xxxxxxxxx>:
> On Fri, 11 Mar 2016 15:19:33 +0900
> Masahiro Yamada <yamada.masahiro@xxxxxxxxxxxxx> wrote:
>> As an alternative, you can add needed build rules
>> into tools/gcc/Makefile, not scripts/Makefile.host
>> I guess these rule won't be used in other places.
> I think it is better if the rules stay under scripts/ because I expect that there will also be clang and llvm plugins
> in the future (e.g., clang plugins can access the frontend that gcc plugins can't do). In this case these rules would
> either have to be duplicated or moved back under scripts/ (which makes it difficult to backport).
>> > +# hostcc-option
>> > +# Usage: cflags-y += $(call hostcc-option,-march=winchip-c6,-march=i586)
>> > +
>> > +hostcc-option = $(call try-run,\
>> > + $(HOSTCC) $(HOSTCFLAGS) $(HOST_EXTRACFLAGS) $(1) -c -x c /dev/null -o "$$TMP",$(1),$(2))
>> > +
>> > __hostprogs := $(sort $(hostprogs-y) $(hostprogs-m))
>> > +__hostlibs := $(sort $(hostlibs-y) $(hostlibs-m))
>> > +__hostcxxlibs := $(sort $(hostcxxlibs-y) $(hostcxxlibs-m))
>> > # C code
>> > # Executables compiled from a single .c file
>> > @@ -42,6 +60,19 @@ host-cxxmulti := $(foreach m,$(__hostprogs),$(if $($(m)-cxxobjs),$(m)))
>> > # C++ Object (.o) files compiled from .cc files
>> > host-cxxobjs := $(sort $(foreach m,$(host-cxxmulti),$($(m)-cxxobjs)))
>> > +# Shared libaries (only .c supported)
>> > +# Shared libraries (.so) - all .so files referenced in "xxx-objs"
>> > +host-cshlib := $(sort $(filter %.so, $(host-cobjs)))
> Which part do you think is useless and why?
host-cshlib := $(sort $(filter %.so, $(host-cobjs)))
is useless because there is no host program that consists of .so files.
Your intention is to generate shared objects as final targets,
not host tools that call shared objects.