diff mbox

[3/3] kbuild: Allow passing additional HOSTCFLAGS and HOSTLDFLAGS

Message ID 20180329004805.7278-4-labbott@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Laura Abbott March 29, 2018, 12:48 a.m. UTC
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(+)

Comments

Masahiro Yamada April 5, 2018, 4:59 a.m. UTC | #1
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
Laura Abbott April 5, 2018, 9:51 p.m. UTC | #2
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
> 
> 
> 

--
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
diff mbox

Patch

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