* [PATCH 0/3] HOSTCFLAGS and HOSTLDFLAGS from the environment @ 2018-03-29 0:48 Laura Abbott 2018-03-29 0:48 ` [PATCH 1/3] kbuild: Support HOSTLDFLAGS Laura Abbott ` (2 more replies) 0 siblings, 3 replies; 10+ messages in thread From: Laura Abbott @ 2018-03-29 0:48 UTC (permalink / raw) To: Masahiro Yamada, Michal Marek Cc: Laura Abbott, linux-kbuild, linux-kernel, Josh Poimboeuf Hi, Someone noted that scripts/tools userspace binaries packaged as part of the Fedora kernel were not picking up the recommended compiler flags (https://src.fedoraproject.org/rpms/redhat-rpm-config/blob/master/f/buildflags.md) This series lets the host ld and C flags be set on the command line similar to the kernel flags: make AFLAGS_HOSTCFLAGS="%{build_cflags}" AFLAGS_HOSTLDFLAGS="%{build_ldflags}" There's one more annoying case I didn't quite figure out with tools/objtool/fixdep since that's linked with ld directly but this covers the initial set of reports. Thanks, Laura Laura Abbott (3): kbuild: Support HOSTLDFLAGS objtool: Support HOSTCFLAGS and HOSTLDFLAGS kbuild: Allow passing additional HOSTCFLAGS and HOSTLDFLAGS Documentation/kbuild/kbuild.txt | 9 +++++++++ Makefile | 3 +++ scripts/Makefile.host | 6 +++--- tools/build/Makefile.build | 2 +- tools/objtool/Makefile | 5 +++-- 5 files changed, 19 insertions(+), 6 deletions(-) -- 2.16.2 ^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 1/3] kbuild: Support HOSTLDFLAGS 2018-03-29 0:48 [PATCH 0/3] HOSTCFLAGS and HOSTLDFLAGS from the environment Laura Abbott @ 2018-03-29 0:48 ` Laura Abbott 2018-04-05 5:13 ` Masahiro Yamada 2018-03-29 0:48 ` [PATCH 2/3] objtool: Support HOSTCFLAGS and HOSTLDFLAGS Laura Abbott 2018-03-29 0:48 ` [PATCH 3/3] kbuild: Allow passing additional " Laura Abbott 2 siblings, 1 reply; 10+ messages in thread From: Laura Abbott @ 2018-03-29 0:48 UTC (permalink / raw) To: Masahiro Yamada, Michal Marek Cc: Laura Abbott, linux-kbuild, linux-kernel, Josh Poimboeuf In addition to HOSTCFLAGS, there's HOSTLDFLAGS. Ensure these get passed to calls to build host binaries. Signed-off-by: Laura Abbott <labbott@redhat.com> --- scripts/Makefile.host | 6 +++--- tools/build/Makefile.build | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/Makefile.host b/scripts/Makefile.host index e6dc6ae2d7c4..a3a0e2282a56 100644 --- a/scripts/Makefile.host +++ b/scripts/Makefile.host @@ -84,7 +84,7 @@ hostcxx_flags = -Wp,-MD,$(depfile) $(__hostcxx_flags) # Create executable from a single .c file # host-csingle -> Executable quiet_cmd_host-csingle = HOSTCC $@ - cmd_host-csingle = $(HOSTCC) $(hostc_flags) -o $@ $< \ + cmd_host-csingle = $(HOSTCC) $(HOSTLDFLAGS) $(hostc_flags) -o $@ $< \ $(HOST_LOADLIBES) $(HOSTLOADLIBES_$(@F)) $(host-csingle): $(obj)/%: $(src)/%.c FORCE $(call if_changed_dep,host-csingle) @@ -102,7 +102,7 @@ $(call multi_depend, $(host-cmulti), , -objs) # Create .o file from a single .c file # host-cobjs -> .o quiet_cmd_host-cobjs = HOSTCC $@ - cmd_host-cobjs = $(HOSTCC) $(hostc_flags) -c -o $@ $< + cmd_host-cobjs = $(HOSTCC) $(HOSTLDFLAGS) $(hostc_flags) -c -o $@ $< $(host-cobjs): $(obj)/%.o: $(src)/%.c FORCE $(call if_changed_dep,host-cobjs) @@ -126,7 +126,7 @@ $(host-cxxobjs): $(obj)/%.o: $(src)/%.cc FORCE # Compile .c file, create position independent .o file # host-cshobjs -> .o quiet_cmd_host-cshobjs = HOSTCC -fPIC $@ - cmd_host-cshobjs = $(HOSTCC) $(hostc_flags) -fPIC -c -o $@ $< + cmd_host-cshobjs = $(HOSTCC) $(HOSTLDFLAGS) $(hostc_flags) -fPIC -c -o $@ $< $(host-cshobjs): $(obj)/%.o: $(src)/%.c FORCE $(call if_changed_dep,host-cshobjs) diff --git a/tools/build/Makefile.build b/tools/build/Makefile.build index cd72016c3cfa..cab55f0d90e1 100644 --- a/tools/build/Makefile.build +++ b/tools/build/Makefile.build @@ -64,7 +64,7 @@ quiet_cmd_cc_o_c = CC $@ cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $< quiet_cmd_host_cc_o_c = HOSTCC $@ - cmd_host_cc_o_c = $(HOSTCC) $(host_c_flags) -c -o $@ $< + cmd_host_cc_o_c = $(HOSTCC) $(HOSTLDFLAGS) $(host_c_flags) -c -o $@ $< quiet_cmd_cxx_o_c = CXX $@ cmd_cxx_o_c = $(CXX) $(cxx_flags) -c -o $@ $< -- 2.16.2 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 1/3] kbuild: Support HOSTLDFLAGS 2018-03-29 0:48 ` [PATCH 1/3] kbuild: Support HOSTLDFLAGS Laura Abbott @ 2018-04-05 5:13 ` Masahiro Yamada 0 siblings, 0 replies; 10+ messages in thread From: Masahiro Yamada @ 2018-04-05 5:13 UTC (permalink / raw) To: Laura Abbott Cc: Michal Marek, Linux Kbuild mailing list, Linux Kernel Mailing List, Josh Poimboeuf 2018-03-29 9:48 GMT+09:00 Laura Abbott <labbott@redhat.com>: > > In addition to HOSTCFLAGS, there's HOSTLDFLAGS. Ensure these get passed to > calls to build host binaries. > > Signed-off-by: Laura Abbott <labbott@redhat.com> > --- > scripts/Makefile.host | 6 +++--- > tools/build/Makefile.build | 2 +- > 2 files changed, 4 insertions(+), 4 deletions(-) > > diff --git a/scripts/Makefile.host b/scripts/Makefile.host > index e6dc6ae2d7c4..a3a0e2282a56 100644 > --- a/scripts/Makefile.host > +++ b/scripts/Makefile.host > @@ -84,7 +84,7 @@ hostcxx_flags = -Wp,-MD,$(depfile) $(__hostcxx_flags) > # Create executable from a single .c file > # host-csingle -> Executable > quiet_cmd_host-csingle = HOSTCC $@ > - cmd_host-csingle = $(HOSTCC) $(hostc_flags) -o $@ $< \ > + cmd_host-csingle = $(HOSTCC) $(HOSTLDFLAGS) $(hostc_flags) -o $@ $< \ > $(HOST_LOADLIBES) $(HOSTLOADLIBES_$(@F)) > $(host-csingle): $(obj)/%: $(src)/%.c FORCE > $(call if_changed_dep,host-csingle) This hunk is correct, but Robin posted this. https://patchwork.kernel.org/patch/10243073/ Somehow it fell into a crack, and I missed to pick it up. I will apply it lately. > @@ -102,7 +102,7 @@ $(call multi_depend, $(host-cmulti), , -objs) > # Create .o file from a single .c file > # host-cobjs -> .o > quiet_cmd_host-cobjs = HOSTCC $@ > - cmd_host-cobjs = $(HOSTCC) $(hostc_flags) -c -o $@ $< > + cmd_host-cobjs = $(HOSTCC) $(HOSTLDFLAGS) $(hostc_flags) -c -o $@ $< > $(host-cobjs): $(obj)/%.o: $(src)/%.c FORCE > $(call if_changed_dep,host-cobjs) > This does not involve the link stage. You should not do this. > @@ -126,7 +126,7 @@ $(host-cxxobjs): $(obj)/%.o: $(src)/%.cc FORCE > # Compile .c file, create position independent .o file > # host-cshobjs -> .o > quiet_cmd_host-cshobjs = HOSTCC -fPIC $@ > - cmd_host-cshobjs = $(HOSTCC) $(hostc_flags) -fPIC -c -o $@ $< > + cmd_host-cshobjs = $(HOSTCC) $(HOSTLDFLAGS) $(hostc_flags) -fPIC -c -o $@ $< > $(host-cshobjs): $(obj)/%.o: $(src)/%.c FORCE > $(call if_changed_dep,host-cshobjs) > > diff --git a/tools/build/Makefile.build b/tools/build/Makefile.build > index cd72016c3cfa..cab55f0d90e1 100644 > --- a/tools/build/Makefile.build > +++ b/tools/build/Makefile.build > @@ -64,7 +64,7 @@ quiet_cmd_cc_o_c = CC $@ > cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $< > > quiet_cmd_host_cc_o_c = HOSTCC $@ > - cmd_host_cc_o_c = $(HOSTCC) $(host_c_flags) -c -o $@ $< > + cmd_host_cc_o_c = $(HOSTCC) $(HOSTLDFLAGS) $(host_c_flags) -c -o $@ $< > > quiet_cmd_cxx_o_c = CXX $@ > cmd_cxx_o_c = $(CXX) $(cxx_flags) -c -o $@ $< -- Best Regards Masahiro Yamada ^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 2/3] objtool: Support HOSTCFLAGS and HOSTLDFLAGS 2018-03-29 0:48 [PATCH 0/3] HOSTCFLAGS and HOSTLDFLAGS from the environment Laura Abbott 2018-03-29 0:48 ` [PATCH 1/3] kbuild: Support HOSTLDFLAGS Laura Abbott @ 2018-03-29 0:48 ` Laura Abbott 2018-04-05 4:42 ` Masahiro Yamada 2018-04-06 17:27 ` Josh Poimboeuf 2018-03-29 0:48 ` [PATCH 3/3] kbuild: Allow passing additional " Laura Abbott 2 siblings, 2 replies; 10+ messages in thread From: Laura Abbott @ 2018-03-29 0:48 UTC (permalink / raw) To: Masahiro Yamada, Michal Marek, Josh Poimboeuf Cc: Laura Abbott, linux-kbuild, linux-kernel It may be useful to compile host programs with different flags (e.g. hardening). Ensure that objtool picks up the appropriate flags. Signed-off-by: Laura Abbott <labbott@redhat.com> --- tools/objtool/Makefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/objtool/Makefile b/tools/objtool/Makefile index e6acc281dd37..0ff3bcac1ca9 100644 --- a/tools/objtool/Makefile +++ b/tools/objtool/Makefile @@ -31,8 +31,9 @@ INCLUDES := -I$(srctree)/tools/include \ -I$(srctree)/tools/arch/$(HOSTARCH)/include/uapi \ -I$(srctree)/tools/objtool/arch/$(ARCH)/include WARNINGS := $(EXTRA_WARNINGS) -Wno-switch-default -Wno-switch-enum -Wno-packed -CFLAGS += -Wall -Werror $(WARNINGS) -fomit-frame-pointer -O2 -g $(INCLUDES) -LDFLAGS += -lelf $(LIBSUBCMD) +CFLAGS += -Wall -Werror $(WARNINGS) $(HOSTCFLAGS) -fomit-frame-pointer -O2 -g \ + $(INCLUDES) +LDFLAGS += -lelf $(LIBSUBCMD) $(HOSTLDFLAGS) # Allow old libelf to be used: elfshdr := $(shell echo '\#include <libelf.h>' | $(CC) $(CFLAGS) -x c -E - | grep elf_getshdr) -- 2.16.2 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 2/3] objtool: Support HOSTCFLAGS and HOSTLDFLAGS 2018-03-29 0:48 ` [PATCH 2/3] objtool: Support HOSTCFLAGS and HOSTLDFLAGS Laura Abbott @ 2018-04-05 4:42 ` Masahiro Yamada 2018-04-05 22:01 ` Laura Abbott 2018-04-06 17:27 ` Josh Poimboeuf 1 sibling, 1 reply; 10+ messages in thread From: Masahiro Yamada @ 2018-04-05 4:42 UTC (permalink / raw) To: Laura Abbott Cc: Michal Marek, Josh Poimboeuf, Linux Kbuild mailing list, Linux Kernel Mailing List 2018-03-29 9:48 GMT+09:00 Laura Abbott <labbott@redhat.com>: > It may be useful to compile host programs with different flags (e.g. > hardening). Ensure that objtool picks up the appropriate flags. > > Signed-off-by: Laura Abbott <labbott@redhat.com> > --- I saw some similar patches before. I thought they are fixing this way https://patchwork.kernel.org/patch/10251259/ but, I am not tacking the progress. > tools/objtool/Makefile | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/tools/objtool/Makefile b/tools/objtool/Makefile > index e6acc281dd37..0ff3bcac1ca9 100644 > --- a/tools/objtool/Makefile > +++ b/tools/objtool/Makefile > @@ -31,8 +31,9 @@ INCLUDES := -I$(srctree)/tools/include \ > -I$(srctree)/tools/arch/$(HOSTARCH)/include/uapi \ > -I$(srctree)/tools/objtool/arch/$(ARCH)/include > WARNINGS := $(EXTRA_WARNINGS) -Wno-switch-default -Wno-switch-enum -Wno-packed > -CFLAGS += -Wall -Werror $(WARNINGS) -fomit-frame-pointer -O2 -g $(INCLUDES) > -LDFLAGS += -lelf $(LIBSUBCMD) > +CFLAGS += -Wall -Werror $(WARNINGS) $(HOSTCFLAGS) -fomit-frame-pointer -O2 -g \ > + $(INCLUDES) > +LDFLAGS += -lelf $(LIBSUBCMD) $(HOSTLDFLAGS) > > # Allow old libelf to be used: > elfshdr := $(shell echo '\#include <libelf.h>' | $(CC) $(CFLAGS) -x c -E - | grep elf_getshdr) > -- > 2.16.2 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- Best Regards Masahiro Yamada ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 2/3] objtool: Support HOSTCFLAGS and HOSTLDFLAGS 2018-04-05 4:42 ` Masahiro Yamada @ 2018-04-05 22:01 ` Laura Abbott 0 siblings, 0 replies; 10+ messages in thread From: Laura Abbott @ 2018-04-05 22:01 UTC (permalink / raw) To: Masahiro Yamada Cc: Michal Marek, Josh Poimboeuf, Linux Kbuild mailing list, Linux Kernel Mailing List On 04/04/2018 09:42 PM, Masahiro Yamada wrote: > 2018-03-29 9:48 GMT+09:00 Laura Abbott <labbott@redhat.com>: >> It may be useful to compile host programs with different flags (e.g. >> hardening). Ensure that objtool picks up the appropriate flags. >> >> Signed-off-by: Laura Abbott <labbott@redhat.com> >> --- > > > I saw some similar patches before. > > I thought they are fixing this way > https://patchwork.kernel.org/patch/10251259/ > > but, I am not tacking the progress. > > > That looks like a different issue since it's still not going to pick up the HOST{C,LD}FLAGS. > >> tools/objtool/Makefile | 5 +++-- >> 1 file changed, 3 insertions(+), 2 deletions(-) >> >> diff --git a/tools/objtool/Makefile b/tools/objtool/Makefile >> index e6acc281dd37..0ff3bcac1ca9 100644 >> --- a/tools/objtool/Makefile >> +++ b/tools/objtool/Makefile >> @@ -31,8 +31,9 @@ INCLUDES := -I$(srctree)/tools/include \ >> -I$(srctree)/tools/arch/$(HOSTARCH)/include/uapi \ >> -I$(srctree)/tools/objtool/arch/$(ARCH)/include >> WARNINGS := $(EXTRA_WARNINGS) -Wno-switch-default -Wno-switch-enum -Wno-packed >> -CFLAGS += -Wall -Werror $(WARNINGS) -fomit-frame-pointer -O2 -g $(INCLUDES) >> -LDFLAGS += -lelf $(LIBSUBCMD) >> +CFLAGS += -Wall -Werror $(WARNINGS) $(HOSTCFLAGS) -fomit-frame-pointer -O2 -g \ >> + $(INCLUDES) >> +LDFLAGS += -lelf $(LIBSUBCMD) $(HOSTLDFLAGS) >> >> # Allow old libelf to be used: >> elfshdr := $(shell echo '\#include <libelf.h>' | $(CC) $(CFLAGS) -x c -E - | grep elf_getshdr) >> -- >> 2.16.2 >> >> -- >> To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in >> the body of a message to majordomo@vger.kernel.org >> More majordomo info at http://vger.kernel.org/majordomo-info.html > > > ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 2/3] objtool: Support HOSTCFLAGS and HOSTLDFLAGS 2018-03-29 0:48 ` [PATCH 2/3] objtool: Support HOSTCFLAGS and HOSTLDFLAGS Laura Abbott 2018-04-05 4:42 ` Masahiro Yamada @ 2018-04-06 17:27 ` Josh Poimboeuf 1 sibling, 0 replies; 10+ messages in thread From: Josh Poimboeuf @ 2018-04-06 17:27 UTC (permalink / raw) To: Laura Abbott; +Cc: Masahiro Yamada, Michal Marek, linux-kbuild, linux-kernel On Wed, Mar 28, 2018 at 05:48:04PM -0700, Laura Abbott wrote: > It may be useful to compile host programs with different flags (e.g. > hardening). Ensure that objtool picks up the appropriate flags. > > Signed-off-by: Laura Abbott <labbott@redhat.com> > --- > tools/objtool/Makefile | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/tools/objtool/Makefile b/tools/objtool/Makefile > index e6acc281dd37..0ff3bcac1ca9 100644 > --- a/tools/objtool/Makefile > +++ b/tools/objtool/Makefile > @@ -31,8 +31,9 @@ INCLUDES := -I$(srctree)/tools/include \ > -I$(srctree)/tools/arch/$(HOSTARCH)/include/uapi \ > -I$(srctree)/tools/objtool/arch/$(ARCH)/include > WARNINGS := $(EXTRA_WARNINGS) -Wno-switch-default -Wno-switch-enum -Wno-packed > -CFLAGS += -Wall -Werror $(WARNINGS) -fomit-frame-pointer -O2 -g $(INCLUDES) > -LDFLAGS += -lelf $(LIBSUBCMD) > +CFLAGS += -Wall -Werror $(WARNINGS) $(HOSTCFLAGS) -fomit-frame-pointer -O2 -g \ > + $(INCLUDES) HOSTCFLAGS already has '-Wall', '-fomit-frame-pointer', and '-O2', so we can remove the setting of those in CFLAGS here. -- Josh ^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 3/3] kbuild: Allow passing additional HOSTCFLAGS and HOSTLDFLAGS 2018-03-29 0:48 [PATCH 0/3] HOSTCFLAGS and HOSTLDFLAGS from the environment Laura Abbott 2018-03-29 0:48 ` [PATCH 1/3] kbuild: Support HOSTLDFLAGS Laura Abbott 2018-03-29 0:48 ` [PATCH 2/3] objtool: Support HOSTCFLAGS and HOSTLDFLAGS Laura Abbott @ 2018-03-29 0:48 ` Laura Abbott 2018-04-05 4:59 ` Masahiro Yamada 2 siblings, 1 reply; 10+ messages in thread From: Laura Abbott @ 2018-03-29 0:48 UTC (permalink / raw) To: Masahiro Yamada, Michal Marek Cc: Laura Abbott, linux-kbuild, linux-kernel, Josh Poimboeuf Similar to AFLAGS_KBUILD, there may be uses (e.g. hardening) for passing in additional flags to host programs. Allow these to be passed in from the environment. Signed-off-by: Laura Abbott <labbott@redhat.com> --- Documentation/kbuild/kbuild.txt | 9 +++++++++ Makefile | 3 +++ 2 files changed, 12 insertions(+) diff --git a/Documentation/kbuild/kbuild.txt b/Documentation/kbuild/kbuild.txt index ac2363ea05c5..3751a4bc8596 100644 --- a/Documentation/kbuild/kbuild.txt +++ b/Documentation/kbuild/kbuild.txt @@ -24,6 +24,15 @@ KAFLAGS -------------------------------------------------- Additional options to the assembler (for built-in and modules). +AFLAGS_HOSTCFLAGS +-------------------------------------------------- +Additional options passed to the compiler when building host programs. + +AFLAGS_HOSTLDFLAGS +-------------------------------------------------- +Additional options passed to the linker (through the compiler) when buidling +host programs. + AFLAGS_MODULE -------------------------------------------------- Additional module specific options to use for $(AS). diff --git a/Makefile b/Makefile index 7ba478ab8c82..2cab3f8d489c 100644 --- a/Makefile +++ b/Makefile @@ -367,6 +367,9 @@ HOSTCXXFLAGS := -O2 $(HOST_LFS_CFLAGS) HOSTLDFLAGS := $(HOST_LFS_LDFLAGS) HOST_LOADLIBES := $(HOST_LFS_LIBS) +HOSTCFLAGS += $(AFLAGS_HOSTCFLAGS) +HOSTLDFLAGS += $(AFLAGS_HOSTLDFLAGS) + # Make variables (CC, etc...) AS = $(CROSS_COMPILE)as LD = $(CROSS_COMPILE)ld -- 2.16.2 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 3/3] kbuild: Allow passing additional HOSTCFLAGS and HOSTLDFLAGS 2018-03-29 0:48 ` [PATCH 3/3] kbuild: Allow passing additional " Laura Abbott @ 2018-04-05 4:59 ` Masahiro Yamada 2018-04-05 21:51 ` Laura Abbott 0 siblings, 1 reply; 10+ messages in thread From: Masahiro Yamada @ 2018-04-05 4:59 UTC (permalink / raw) To: Laura Abbott Cc: Michal Marek, Linux Kbuild mailing list, Linux Kernel Mailing List, Josh Poimboeuf 2018-03-29 9:48 GMT+09:00 Laura Abbott <labbott@redhat.com>: > > Similar to AFLAGS_KBUILD, there may be uses (e.g. hardening) for passing in > additional flags to host programs. Allow these to be passed in from the > environment. > > Signed-off-by: Laura Abbott <labbott@redhat.com> > --- > Documentation/kbuild/kbuild.txt | 9 +++++++++ > Makefile | 3 +++ > 2 files changed, 12 insertions(+) > > diff --git a/Documentation/kbuild/kbuild.txt b/Documentation/kbuild/kbuild.txt > index ac2363ea05c5..3751a4bc8596 100644 > --- a/Documentation/kbuild/kbuild.txt > +++ b/Documentation/kbuild/kbuild.txt > @@ -24,6 +24,15 @@ KAFLAGS > -------------------------------------------------- > Additional options to the assembler (for built-in and modules). > > +AFLAGS_HOSTCFLAGS > +-------------------------------------------------- > +Additional options passed to the compiler when building host programs. > + > +AFLAGS_HOSTLDFLAGS > +-------------------------------------------------- > +Additional options passed to the linker (through the compiler) when buidling > +host programs. > + I am afraid you misunderstood the meaning of 'AFLAGS'. AFLAGS is not 'Additional flags', but 'Assembler flags' that are used for compiling *.S files. AFLAGS for host programs is weird. I see similar proposals from different people. I replied like follows: https://lkml.org/lkml/2018/2/28/178 However, Robin seems busy lately. I will wait a bit, then if nobody does this, I may do it. > AFLAGS_MODULE > -------------------------------------------------- > Additional module specific options to use for $(AS). > diff --git a/Makefile b/Makefile > index 7ba478ab8c82..2cab3f8d489c 100644 > --- a/Makefile > +++ b/Makefile > @@ -367,6 +367,9 @@ HOSTCXXFLAGS := -O2 $(HOST_LFS_CFLAGS) > HOSTLDFLAGS := $(HOST_LFS_LDFLAGS) > HOST_LOADLIBES := $(HOST_LFS_LIBS) > > +HOSTCFLAGS += $(AFLAGS_HOSTCFLAGS) > +HOSTLDFLAGS += $(AFLAGS_HOSTLDFLAGS) > + > # Make variables (CC, etc...) > AS = $(CROSS_COMPILE)as > LD = $(CROSS_COMPILE)ld > -- > 2.16.2 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- Best Regards Masahiro Yamada ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 3/3] kbuild: Allow passing additional HOSTCFLAGS and HOSTLDFLAGS 2018-04-05 4:59 ` Masahiro Yamada @ 2018-04-05 21:51 ` Laura Abbott 0 siblings, 0 replies; 10+ messages in thread From: Laura Abbott @ 2018-04-05 21:51 UTC (permalink / raw) To: Masahiro Yamada Cc: Michal Marek, Linux Kbuild mailing list, Linux Kernel Mailing List, Josh Poimboeuf On 04/04/2018 09:59 PM, Masahiro Yamada wrote: > 2018-03-29 9:48 GMT+09:00 Laura Abbott <labbott@redhat.com>: >> >> Similar to AFLAGS_KBUILD, there may be uses (e.g. hardening) for passing in >> additional flags to host programs. Allow these to be passed in from the >> environment. >> >> Signed-off-by: Laura Abbott <labbott@redhat.com> >> --- >> Documentation/kbuild/kbuild.txt | 9 +++++++++ >> Makefile | 3 +++ >> 2 files changed, 12 insertions(+) >> >> diff --git a/Documentation/kbuild/kbuild.txt b/Documentation/kbuild/kbuild.txt >> index ac2363ea05c5..3751a4bc8596 100644 >> --- a/Documentation/kbuild/kbuild.txt >> +++ b/Documentation/kbuild/kbuild.txt >> @@ -24,6 +24,15 @@ KAFLAGS >> -------------------------------------------------- >> Additional options to the assembler (for built-in and modules). >> >> +AFLAGS_HOSTCFLAGS >> +-------------------------------------------------- >> +Additional options passed to the compiler when building host programs. >> + >> +AFLAGS_HOSTLDFLAGS >> +-------------------------------------------------- >> +Additional options passed to the linker (through the compiler) when buidling >> +host programs. >> + > > > I am afraid you misunderstood the meaning of 'AFLAGS'. > > AFLAGS is not 'Additional flags', but 'Assembler flags' > that are used for compiling *.S files. > > AFLAGS for host programs is weird. > > > > I see similar proposals from different people. > > I replied like follows: > https://lkml.org/lkml/2018/2/28/178 > > However, Robin seems busy lately. > > I will wait a bit, then > if nobody does this, I may do it. > Thanks for the pointer. I'll keep an eye out for those patches. > > > >> AFLAGS_MODULE >> -------------------------------------------------- >> Additional module specific options to use for $(AS). >> diff --git a/Makefile b/Makefile >> index 7ba478ab8c82..2cab3f8d489c 100644 >> --- a/Makefile >> +++ b/Makefile >> @@ -367,6 +367,9 @@ HOSTCXXFLAGS := -O2 $(HOST_LFS_CFLAGS) >> HOSTLDFLAGS := $(HOST_LFS_LDFLAGS) >> HOST_LOADLIBES := $(HOST_LFS_LIBS) >> >> +HOSTCFLAGS += $(AFLAGS_HOSTCFLAGS) >> +HOSTLDFLAGS += $(AFLAGS_HOSTLDFLAGS) >> + >> # Make variables (CC, etc...) >> AS = $(CROSS_COMPILE)as >> LD = $(CROSS_COMPILE)ld >> -- >> 2.16.2 >> >> -- >> To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in >> the body of a message to majordomo@vger.kernel.org >> More majordomo info at http://vger.kernel.org/majordomo-info.html > > > ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2018-04-06 17:27 UTC | newest] Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2018-03-29 0:48 [PATCH 0/3] HOSTCFLAGS and HOSTLDFLAGS from the environment Laura Abbott 2018-03-29 0:48 ` [PATCH 1/3] kbuild: Support HOSTLDFLAGS Laura Abbott 2018-04-05 5:13 ` Masahiro Yamada 2018-03-29 0:48 ` [PATCH 2/3] objtool: Support HOSTCFLAGS and HOSTLDFLAGS Laura Abbott 2018-04-05 4:42 ` Masahiro Yamada 2018-04-05 22:01 ` Laura Abbott 2018-04-06 17:27 ` Josh Poimboeuf 2018-03-29 0:48 ` [PATCH 3/3] kbuild: Allow passing additional " Laura Abbott 2018-04-05 4:59 ` Masahiro Yamada 2018-04-05 21:51 ` Laura Abbott
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.