nathanchance / android-kernel-clang

Information on compiling Android kernels with Clang
291 stars 83 forks source link

Facing the compilation error after following the mentioned steps #17

Open ManuAryan111 opened 4 years ago

ManuAryan111 commented 4 years ago

Hi

I am getting the following error after compiling the kernel using the mentioned steps

./drivers/firmware/efi/libstub/lib.a(arm64-stub.stub.o): In function __efistub_handle_kernel_image': __efistub_arm64-stub.c:(.init.init.text+0x1c): undefined reference toefistub_stack_chk_guard' efistub_arm64-stub.c:(.init.init.text+0x20): undefined reference to `efistub_stack_chk_guard' __efistub_arm64-stub.c:(.init.init.text+0x1d0): undefined reference to `efistub_stack_chk_guard' __efistub_arm64-stub.c:(.init.init.text+0x1d8): undefined reference to `efistub_stack_chk_guard' __efistub_arm64-stub.c:(.init.init.text+0x21c): undefined reference to `efistub_stack_chk_fail' ./drivers/firmware/efi/libstub/lib.a(arm-stub.stub.o): In function `__efistub_efi_open_volume': efistub_arm-stub.c:(.init.text+0x14): undefined reference to __efistub___stack_chk_guard' __efistub_arm-stub.c:(.init.text+0x18): undefined reference toefistub_stack_chk_guard' efistub_arm-stub.c:(.init.text+0xa0): undefined reference to `efistub_stack_chk_guard' __efistub_arm-stub.c:(.init.text+0xa8): undefined reference to `efistub_stack_chk_guard' __efistub_arm-stub.c:(.init.text+0xd0): undefined reference to `efistub_stack_chk_fail' ./drivers/firmware/efi/libstub/lib.a(arm-stub.stub.o): In function `__efistub_efi_file_size': efistub_arm-stub.c:(.init.text+0x11c): undefined reference to __efistub___stack_chk_guard' __efistub_arm-stub.c:(.init.text+0x120): undefined reference toefistub_stack_chk_guard' efistub_arm-stub.c:(.init.text+0x258): undefined reference to `efistub_stack_chk_guard' __efistub_arm-stub.c:(.init.text+0x260): undefined reference to `efistub_stack_chk_guard' __efistub_arm-stub.c:(.init.text+0x2b8): undefined reference to `efistub_stack_chk_fail' ./drivers/firmware/efi/libstub/lib.a(arm-stub.stub.o): In function __efistub_efi_entry': __efistub_arm-stub.c:(.init.text+0x2f0): undefined reference toefistub_stack_chk_guard' __efistub_arm-stub.c:(.init.text+0x2f4): undefined reference to `efistub_stack_chk_guard' __efistub_arm-stub.c:(.init.text+0x388): undefined reference to `efistub_stack_chk_guard' __efistub_arm-stub.c:(.init.text+0x390): undefined reference to `efistub_stack_chk_guard' __efistub_arm-stub.c:(.init.text+0x618): undefined reference to `efistub_stack_chk_fail' ./drivers/firmware/efi/libstub/lib.a(random.stub.o): In function __efistub_efi_get_random_bytes': __efistub_random.c:(.init.text+0x10): undefined reference toefistub_stack_chk_guard' __efistub_random.c:(.init.text+0x14): undefined reference to `efistub_stack_chk_guard' __efistub_random.c:(.init.text+0x6c): undefined reference to `efistub_stack_chk_guard' __efistub_random.c:(.init.text+0x74): undefined reference to `efistub_stack_chk_guard' __efistub_random.c:(.init.text+0x94): undefined reference to `efistub_stack_chk_fail' ./drivers/firmware/efi/libstub/lib.a(random.stub.o): In function `__efistub_efi_random_alloc': efistub_random.c:(.init.text+0xb0): undefined reference to __efistub___stack_chk_guard' __efistub_random.c:(.init.text+0xb4): undefined reference toefistub_stack_chk_guard' efistub_random.c:(.init.text+0x1d8): undefined reference to `efistub_stack_chk_guard' __efistub_random.c:(.init.text+0x1e0): undefined reference to `efistub_stack_chk_guard' __efistub_random.c:(.init.text+0x260): undefined reference to `efistub_stack_chk_fail' ./drivers/firmware/efi/libstub/lib.a(efi-stub-helper.stub.o): In function __efistub_efi_printk': __efistub_efi-stub-helper.c:(.init.text+0x20): undefined reference toefistub_stack_chk_guard' __efistub_efi-stub-helper.c:(.init.text+0x24): undefined reference to `efistub_stack_chk_guard' __efistub_efi-stub-helper.c:(.init.text+0x80): undefined reference to `efistub___stack_chk_guard'

Then I commented out the CONFIG_CC_STACKPROTECTOR_STRONG=y in config file, compilation is successful , Is it okay to do that? any implications from that?

nathanchance commented 4 years ago

How are you compiling it?

Maybe you are missing this or something? https://git.kernel.org/linus/ce279d374ff315264efcbcef75cc21b9fef8b36f

ManuAryan111 commented 4 years ago

Hi Nathan,

This is how I compiled

make O=out ARCH=arm64 helios_defconfig

PATH="/build/mhs/kernel_to_qcom/prebuilts/prebuilts/clang/host/linux-x86/clang-r353983c/bin:/build/mhs/kernel_to_qcom/prebuilts/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin:${PATH}" \

make -j$(nproc --all) O=out ARCH=arm64 CC=clang CLANG_TRIPLE=aarch64-linux-gnu- CROSS_COMPILE=aarch64-linux-android-

I have tried with the aforementioned patch :https://git.kernel.org/linus/ce279d374ff315264efcbcef75cc21b9fef8b36f and I am still seeing the same error, May I know what is the implication of disabling CONFIG_CC_STACKPROTECTOR_STRONG=y ? or is there any possible way to rectify this issue.