diff mbox series

kbuild: Fix compilation error

Message ID tencent_3D7B0D368482B2602EC7559A5E1546171009@qq.com (mailing list archive)
State Changes Requested
Delegated to: BPF
Headers show
Series kbuild: Fix compilation error | expand

Checks

Context Check Description
netdev/tree_selection success Not a local patch
bpf/vmtest-bpf-PR success PR summary
bpf/vmtest-bpf-VM_Test-1 success Logs for ShellCheck
bpf/vmtest-bpf-VM_Test-2 success Logs for build for aarch64 with gcc
bpf/vmtest-bpf-VM_Test-3 success Logs for build for aarch64 with llvm-16
bpf/vmtest-bpf-VM_Test-4 success Logs for build for s390x with gcc
bpf/vmtest-bpf-VM_Test-5 success Logs for build for x86_64 with gcc
bpf/vmtest-bpf-VM_Test-6 success Logs for build for x86_64 with llvm-16
bpf/vmtest-bpf-VM_Test-7 success Logs for llvm-toolchain
bpf/vmtest-bpf-VM_Test-8 success Logs for set-matrix
bpf/vmtest-bpf-VM_Test-9 success Logs for test_maps on aarch64 with gcc
bpf/vmtest-bpf-VM_Test-10 success Logs for test_maps on aarch64 with llvm-16
bpf/vmtest-bpf-VM_Test-11 success Logs for test_maps on s390x with gcc
bpf/vmtest-bpf-VM_Test-12 success Logs for test_maps on x86_64 with gcc
bpf/vmtest-bpf-VM_Test-13 success Logs for test_maps on x86_64 with llvm-16
bpf/vmtest-bpf-VM_Test-14 success Logs for test_progs on aarch64 with gcc
bpf/vmtest-bpf-VM_Test-15 success Logs for test_progs on aarch64 with llvm-16
bpf/vmtest-bpf-VM_Test-16 success Logs for test_progs on s390x with gcc
bpf/vmtest-bpf-VM_Test-17 success Logs for test_progs on x86_64 with gcc
bpf/vmtest-bpf-VM_Test-18 success Logs for test_progs on x86_64 with llvm-16
bpf/vmtest-bpf-VM_Test-19 success Logs for test_progs_no_alu32 on aarch64 with gcc
bpf/vmtest-bpf-VM_Test-20 success Logs for test_progs_no_alu32 on aarch64 with llvm-16
bpf/vmtest-bpf-VM_Test-21 success Logs for test_progs_no_alu32 on s390x with gcc
bpf/vmtest-bpf-VM_Test-22 success Logs for test_progs_no_alu32 on x86_64 with gcc
bpf/vmtest-bpf-VM_Test-23 success Logs for test_progs_no_alu32 on x86_64 with llvm-16
bpf/vmtest-bpf-VM_Test-24 success Logs for test_progs_no_alu32_parallel on aarch64 with gcc
bpf/vmtest-bpf-VM_Test-25 success Logs for test_progs_no_alu32_parallel on aarch64 with llvm-16
bpf/vmtest-bpf-VM_Test-26 success Logs for test_progs_no_alu32_parallel on s390x with gcc
bpf/vmtest-bpf-VM_Test-27 success Logs for test_progs_no_alu32_parallel on x86_64 with gcc
bpf/vmtest-bpf-VM_Test-28 success Logs for test_progs_no_alu32_parallel on x86_64 with llvm-16
bpf/vmtest-bpf-VM_Test-29 success Logs for test_progs_parallel on aarch64 with gcc
bpf/vmtest-bpf-VM_Test-30 success Logs for test_progs_parallel on aarch64 with llvm-16
bpf/vmtest-bpf-VM_Test-31 success Logs for test_progs_parallel on s390x with gcc
bpf/vmtest-bpf-VM_Test-32 success Logs for test_progs_parallel on x86_64 with gcc
bpf/vmtest-bpf-VM_Test-33 success Logs for test_progs_parallel on x86_64 with llvm-16
bpf/vmtest-bpf-VM_Test-34 success Logs for test_verifier on aarch64 with gcc
bpf/vmtest-bpf-VM_Test-35 success Logs for test_verifier on aarch64 with llvm-16
bpf/vmtest-bpf-VM_Test-36 success Logs for test_verifier on s390x with gcc
bpf/vmtest-bpf-VM_Test-37 success Logs for test_verifier on x86_64 with gcc
bpf/vmtest-bpf-VM_Test-38 success Logs for test_verifier on x86_64 with llvm-16

Commit Message

Rong Tao Dec. 17, 2022, 7:03 a.m. UTC
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(+)

Comments

Masahiro Yamada Dec. 17, 2022, 7:59 a.m. UTC | #1
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
>
Rong Tao Dec. 17, 2022, 8:11 a.m. UTC | #2
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.
Masahiro Yamada Dec. 17, 2022, 8:44 a.m. UTC | #3
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 ]
Rong Tao Dec. 17, 2022, 9:53 a.m. UTC | #4
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
diff mbox series

Patch

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