Symbols are not stripped from arm64 modules when building the kernel with clang |
|||
Issue descriptionWhen building an arm64 kernel with clang symbol information is not stripped from modules. For gcc builds aarch64-cros-linux-gnu-strip is used for stripping: strip: aarch64-cros-linux-gnu-strip --strip-unneeded -R .comment -R .GCC.command.line -R .note.gnu.gold-version lib/modules/4.4.70/kernel/crypto/af_alg.ko lib/modules/4.4.70/kernel/crypto/algif_hash.ko ... However for clang the 32-bit version armv7a-cros-linux-gnueabi-strip/objcopy is used, which fails for many modules: strip: armv7a-cros-linux-gnueabi-strip --strip-unneeded -R .comment -R .GCC.command.line -R .note.gnu.gold-version lib/modules/4.4.70/kernel/crypto/algif_hash.ko lib/modules/4.4.70/kernel/crypto/algif_skcipher.ko ... armv7a-cros-linux-gnueabi-objcopy:/build/kevin/tmp/portage/sys-kernel/chromeos-kernel-4_4-9999/image/lib/modules/4.4.70/kernel/crypto/af_alg.ko: File format not recognized armv7a-cros-linux-gnueabi-objcopy:/build/kevin/tmp/portage/sys-kernel/chromeos-kernel-4_4-9999/image/lib/modules/4.4.70/kernel/crypto/cmac.ko: File format not recognized I did some digging trying to figure out where this is configured, but it's probably more efficient having someone familiar with this area to take a look.
,
Jul 10 2017
#1: I earlier looked in that area (third_party/chromiumos-overlay/eclass/cros-kernel2.eclass), by default STRIP is not set after the call to clang-setup-env. I added 'tc-export STRIP OBJCOPY' call in that branch to see if that helps, however with that STRIP is set to armv7a-cros-linux-gnueabi-strip.
,
Jul 10 2017
clang-setup-env only sets CC and CXX.
Can you add this line after clang-setup-env:
CHOST=${cross} tc-export LD STRIP OBJCOPY
,
Jul 10 2017
#3: That does the trick, thanks!
,
Jul 11 2017
,
Jul 12 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromiumos/overlays/chromiumos-overlay/+/6ba15e442db356a428c07c7add9cec142f6a16b3 commit 6ba15e442db356a428c07c7add9cec142f6a16b3 Author: Matthias Kaehlcke <mka@chromium.org> Date: Wed Jul 12 00:48:00 2017 cros-kernel: Set additional environment variables for clang builds Some environment variables aren't exported when building the kernel with clang. This doesn't cause build failures, however symbol information isn't stripped from modules for arm64 kernels built with clang. Make sure that for clang builds the same env variables are exported as for gcc. BUG= chromium:740719 TEST=USE=clang emerge-kevin chromeos-kernel-4_4 ls -l /build/kevin/lib/modules/4.4.70/kernel/drivers/bluetooth/btusb.ko => size < 60k Change-Id: I8c8f6d7729d8dbbb00effb1b8f80d36f97e40d5a Reviewed-on: https://chromium-review.googlesource.com/566018 Commit-Ready: Matthias Kaehlcke <mka@chromium.org> Tested-by: Matthias Kaehlcke <mka@chromium.org> Reviewed-by: Manoj Gupta <manojgupta@chromium.org> [modify] https://crrev.com/6ba15e442db356a428c07c7add9cec142f6a16b3/eclass/cros-kernel2.eclass
,
Jul 12 2017
,
Oct 5 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromiumos/overlays/chromiumos-overlay/+/6ae3c9a5d382cfefc219e17c456053d058c39eb5 commit 6ae3c9a5d382cfefc219e17c456053d058c39eb5 Author: Douglas Anderson <dianders@chromium.org> Date: Thu Oct 05 20:19:43 2017 cros-kernel2: Properly build host tools with the host compiler Right now we're not giving HOSTCC to the kernel makefile so it defaults to "gcc". We should specify it. Presumably this will be useful to clang folks. BUG= chromium:740719 , chromium:767565 TEST=Compile a bunch of kernels Change-Id: Ia69ae0f22be65d8e82ebdc5c06dfd93a5c595be3 Reviewed-on: https://chromium-review.googlesource.com/696186 Commit-Ready: Douglas Anderson <dianders@chromium.org> Tested-by: Guenter Roeck <groeck@chromium.org> Reviewed-by: Guenter Roeck <groeck@chromium.org> Reviewed-by: Mike Frysinger <vapier@chromium.org> [modify] https://crrev.com/6ae3c9a5d382cfefc219e17c456053d058c39eb5/sys-kernel/chromeos-kernel-3_8/chromeos-kernel-3_8-9999.ebuild [modify] https://crrev.com/6ae3c9a5d382cfefc219e17c456053d058c39eb5/sys-kernel/chromeos-kernel-4_4/chromeos-kernel-4_4-9999.ebuild [modify] https://crrev.com/6ae3c9a5d382cfefc219e17c456053d058c39eb5/sys-kernel/chromeos-kernel-3_18/chromeos-kernel-3_18-9999.ebuild [modify] https://crrev.com/6ae3c9a5d382cfefc219e17c456053d058c39eb5/eclass/cros-kernel2.eclass [modify] https://crrev.com/6ae3c9a5d382cfefc219e17c456053d058c39eb5/sys-kernel/chromeos-kernel-3_14/chromeos-kernel-3_14-9999.ebuild [modify] https://crrev.com/6ae3c9a5d382cfefc219e17c456053d058c39eb5/sys-kernel/chromeos-kernel-4_12/chromeos-kernel-4_12-9999.ebuild [modify] https://crrev.com/6ae3c9a5d382cfefc219e17c456053d058c39eb5/sys-kernel/chromeos-kernel-3_10/chromeos-kernel-3_10-9999.ebuild |
|||
►
Sign in to add a comment |
|||
Comment 1 by manojgupta@chromium.org
, Jul 10 2017