linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kbuild: Fix compilation error
@ 2022-12-17  7:03 Rong Tao
  2022-12-17  7:59 ` Masahiro Yamada
  0 siblings, 1 reply; 5+ messages in thread
From: Rong Tao @ 2022-12-17  7:03 UTC (permalink / raw)
  To: masahiroy
  Cc: linux-kbuild, Rong Tao, Nathan Chancellor, Nick Desaulniers,
	Nicolas Schier, open list, open list:BPF [MISC]

From: Rong Tao <rongtao@cestc.cn>

In the absence of a CONFIG_FUNCTION_ALIGNMENT defined, -falign-functions=
will be given a null value, which results in a compilation error, as
follows:

    $ make -C samples/bpf/
    ...
    CC      /home/sdb/Git/linux/samples/bpf/syscall_nrs.s
    gcc: error: missing argument to ‘-falign-functions=’
    make[2]: *** [scripts/Makefile.build:118: /home/sdb/Git/linux/samples
        /bpf/syscall_nrs.s] Error 1
    make[1]: *** [Makefile:1996: /home/sdb/Git/linux/samples/bpf] Error 2
    make[1]: Leaving directory '/home/sdb/Git/linux'
    make: *** [Makefile:269: all] Error 2

Signed-off-by: Rong Tao <rongtao@cestc.cn>
---
 Makefile | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Makefile b/Makefile
index 6aa709df6bde..57cce4c8f8a2 100644
--- a/Makefile
+++ b/Makefile
@@ -1006,9 +1006,11 @@ KBUILD_CFLAGS	+= $(CC_FLAGS_CFI)
 export CC_FLAGS_CFI
 endif
 
+ifdef CONFIG_FUNCTION_ALIGNMENT
 ifneq ($(CONFIG_FUNCTION_ALIGNMENT),0)
 KBUILD_CFLAGS += -falign-functions=$(CONFIG_FUNCTION_ALIGNMENT)
 endif
+endif
 
 # arch Makefile may override CC so keep this after arch Makefile is included
 NOSTDINC_FLAGS += -nostdinc
-- 
2.38.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] kbuild: Fix compilation error
  2022-12-17  7:03 [PATCH] kbuild: Fix compilation error Rong Tao
@ 2022-12-17  7:59 ` Masahiro Yamada
  2022-12-17  8:11   ` Rong Tao
  0 siblings, 1 reply; 5+ messages in thread
From: Masahiro Yamada @ 2022-12-17  7:59 UTC (permalink / raw)
  To: Rong Tao
  Cc: linux-kbuild, Rong Tao, Nathan Chancellor, Nick Desaulniers,
	Nicolas Schier, open list, open list:BPF [MISC]

On Sat, Dec 17, 2022 at 4:07 PM Rong Tao <rtoax@foxmail.com> wrote:
>
> From: Rong Tao <rongtao@cestc.cn>
>
> In the absence of a CONFIG_FUNCTION_ALIGNMENT defined,

Does it happen in the mainline kernel?


CONFIG_FUNCTION_ALIGNMENT is always defined
as far as I understood arch/Kconfig.












> -falign-functions=
> will be given a null value, which results in a compilation error, as
> follows:
>
>     $ make -C samples/bpf/
>     ...
>     CC      /home/sdb/Git/linux/samples/bpf/syscall_nrs.s
>     gcc: error: missing argument to ‘-falign-functions=’
>     make[2]: *** [scripts/Makefile.build:118: /home/sdb/Git/linux/samples
>         /bpf/syscall_nrs.s] Error 1
>     make[1]: *** [Makefile:1996: /home/sdb/Git/linux/samples/bpf] Error 2
>     make[1]: Leaving directory '/home/sdb/Git/linux'
>     make: *** [Makefile:269: all] Error 2
>
> Signed-off-by: Rong Tao <rongtao@cestc.cn>
> ---
>  Makefile | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/Makefile b/Makefile
> index 6aa709df6bde..57cce4c8f8a2 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -1006,9 +1006,11 @@ KBUILD_CFLAGS    += $(CC_FLAGS_CFI)
>  export CC_FLAGS_CFI
>  endif
>
> +ifdef CONFIG_FUNCTION_ALIGNMENT
>  ifneq ($(CONFIG_FUNCTION_ALIGNMENT),0)
>  KBUILD_CFLAGS += -falign-functions=$(CONFIG_FUNCTION_ALIGNMENT)
>  endif
> +endif
>
>  # arch Makefile may override CC so keep this after arch Makefile is included
>  NOSTDINC_FLAGS += -nostdinc
> --
> 2.38.1
>


-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Re: [PATCH] kbuild: Fix compilation error
  2022-12-17  7:59 ` Masahiro Yamada
@ 2022-12-17  8:11   ` Rong Tao
  2022-12-17  8:44     ` Masahiro Yamada
  0 siblings, 1 reply; 5+ messages in thread
From: Rong Tao @ 2022-12-17  8:11 UTC (permalink / raw)
  To: masahiroy
  Cc: bpf, linux-kbuild, linux-kernel, nathan, ndesaulniers, nicolas,
	rongtao, rtoax

Yes, It's happen in the mainline kernel.

I pulled the latest code and habitually compiled samples/bpf, 

$ git remote get-url origin 
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
$ make -C samples/bpf

and the compilation error occurred. I applied this patch and can
fix this compilation error.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Re: [PATCH] kbuild: Fix compilation error
  2022-12-17  8:11   ` Rong Tao
@ 2022-12-17  8:44     ` Masahiro Yamada
  2022-12-17  9:53       ` Rong Tao
  0 siblings, 1 reply; 5+ messages in thread
From: Masahiro Yamada @ 2022-12-17  8:44 UTC (permalink / raw)
  To: Rong Tao
  Cc: bpf, linux-kbuild, linux-kernel, nathan, ndesaulniers, nicolas, rongtao

On Sat, Dec 17, 2022 at 5:11 PM Rong Tao <rtoax@foxmail.com> wrote:
>
> Yes, It's happen in the mainline kernel.
>
> I pulled the latest code and habitually compiled samples/bpf,
>
> $ git remote get-url origin
> git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
> $ make -C samples/bpf
>
> and the compilation error occurred. I applied this patch and can
> fix this compilation error.




I want you to describe the steps to reproduce the issue from the pristine
source tree instead of printing the URL of your origin.



I prepared a template for you.
Please fill the following 3 square brackets.



$ git log --oneline  -1
 [ Fill the commit hash you are working on ]
$ git clean -dfx

 [ Fill steps between "git clean -dfx" and "make -C samples/bpf" ]

$ make -C samples/bpf
 [ Fill the error message you get ]





-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Re: [PATCH] kbuild: Fix compilation error
  2022-12-17  8:44     ` Masahiro Yamada
@ 2022-12-17  9:53       ` Rong Tao
  0 siblings, 0 replies; 5+ messages in thread
From: Rong Tao @ 2022-12-17  9:53 UTC (permalink / raw)
  To: masahiroy
  Cc: bpf, linux-kbuild, linux-kernel, nathan, ndesaulniers, nicolas,
	rongtao, rtoax

Thanks, Masahiro Yamada, I compile again from scrach. the compilation
error not happen anymore. I think i miss 'make menuconfig' before.

Thanks again!

$ git log --oneline  -1
77856d911a8c
$ git clean -dfx
$ make menuconfig <<== Which i miss
$ make -j8
$ make -C samples/bpf



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-12-17  9:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-17  7:03 [PATCH] kbuild: Fix compilation error Rong Tao
2022-12-17  7:59 ` Masahiro Yamada
2022-12-17  8:11   ` Rong Tao
2022-12-17  8:44     ` Masahiro Yamada
2022-12-17  9:53       ` Rong Tao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).