Error when using KCFLAGS+="-ffunction-sections -fdata-sections" LDFLAGS+="--gc-section" to reduce kernel size

Yue Yu

New Member
I was trying to compile in the folder kernel 4.4 using the following commands to reduce kernel size for embedded Linux:
make menuconfig ARCH=arm64
make -j 4 ARCH=arm64 CC=aarch64-linux-gnu-gcc KCFLAGS+="-ffunction-sections -fdata-sections" LDFLAGS+="--gc-section"


It results in an Error as below:
5168


However, if I use commends excluding "--gc -section", it works:
make menuconfig ARCH=arm64
make -j 4 ARCH=arm64 CC=aarch64-linux-gnu-gcc KCFLAGS+="-ffunction-sections -fdata-sections"


I guess the problem is arising when linking subdirectory .o to built-in.o.
Can anyone please help me with this problem? I really appreciate any suggestion you provide!
 


JasKinasis

Well-Known Member
I’m not sure offhand.
I know more or less what the —gc-sections linker flag does, but I’ve never used it.
I’ll take a look when I can and will try to get back to you.

But if you manage to find an answer before then, please feel free to share it here, so the rest of the community can benefit from it!
 


Staff online

Members online


Latest posts

Top