Skip to contentSkip to conversation

Bug: LDFLAGS is not cleared for kernel devshell

DISCUSSION Björn Stenberg 2 participants 2 messages Sep 12, 2012

lore
Share & tools
lore
#0 lore raw

Hi.

I couldn't figure out where to properly patch this, so I'll just raise the issue:

LDFLAGS is configured in bitbake.conf as linker flags to be passed to gcc, not to ld. Hence it uses the -Wl prefix.

The linux kernel build system inherits LDFLAGS from the environment and passes it directly to 'ld', in conflict with the bitbake view. This problem is avoided by clearing LDFLAGS and some other enviroment variables in kernel.bbclass:kernel_do_compile().

However this clearing is not done for do_devshell, resulting in errors when trying to compile the kernel in devshell:

-----
sestofb10:linux>make
scripts/kconfig/conf --silentoldconfig Kconfig

  WRAP    arch/arm/include/generated/asm/auxvec.h
  WRAP    arch/arm/include/generated/asm/bitsperlong.h
  WRAP    arch/arm/include/generated/asm/cputime.h
  WRAP    arch/arm/include/generated/asm/emergency-restart.h
  WRAP    arch/arm/include/generated/asm/errno.h
  WRAP    arch/arm/include/generated/asm/ioctl.h
  WRAP    arch/arm/include/generated/asm/irq_regs.h
  WRAP    arch/arm/include/generated/asm/kdebug.h
  WRAP    arch/arm/include/generated/asm/local.h
  WRAP    arch/arm/include/generated/asm/local64.h
  WRAP    arch/arm/include/generated/asm/percpu.h
  WRAP    arch/arm/include/generated/asm/poll.h
  WRAP    arch/arm/include/generated/asm/resource.h
  WRAP    arch/arm/include/generated/asm/sections.h
  WRAP    arch/arm/include/generated/asm/siginfo.h
  WRAP    arch/arm/include/generated/asm/sizes.h
  CHK     include/linux/version.h
  UPD     include/linux/version.h
  CHK     include/generated/utsrelease.h
  UPD     include/generated/utsrelease.h
  Generating include/generated/mach-types.h
  CC      kernel/bounds.s
  GEN     include/generated/bounds.h
  CC      arch/arm/kernel/asm-offsets.s
  GEN     include/generated/asm-offsets.h
  CALL    scripts/checksyscalls.sh
  CC      scripts/mod/empty.o
  HOSTCC  scripts/mod/mk_elfconfig
  MKELF   scripts/mod/elfconfig.h
  HOSTCC  scripts/mod/file2alias.o
  HOSTCC  scripts/mod/modpost.o
  HOSTCC  scripts/mod/sumversion.o
  HOSTLD  scripts/mod/modpost
  HOSTCC  scripts/kallsyms
  HOSTCC  scripts/conmakehash
  CC      init/main.o
  CHK     include/generated/compile.h
  UPD     include/generated/compile.h
  CC      init/version.o
  CC      init/do_mounts.o
  LD      init/mounts.o

arm-oe-linux-gnueabi-ld: unrecognized option '-Wl,-O1'
arm-oe-linux-gnueabi-ld: use the --help option for usage information make[1]: *** [init/mounts.o] Error 1
make: *** [init] Error 2
sestofb10:linux>
-----

Signature · 1 line
Björn
#1 lore raw
Quoted 7 lines · Björn Stenberg

I couldn't figure out where to properly patch this, so I'll just raise the issue:

LDFLAGS is configured in bitbake.conf as linker flags to be passed to gcc, not to ld. Hence it uses the -Wl prefix.

The linux kernel build system inherits LDFLAGS from the environment and passes it directly to 'ld', in conflict with the bitbake view. This problem is avoided by clearing LDFLAGS and some other enviroment variables in kernel.bbclass:kernel_do_compile().

However this clearing is not done for do_devshell, resulting in errors when trying to compile the kernel in devshell:

We could unexport the appropriate variables rather than unsetting them in the task.
E.g.
LDFLAGS[unexport] = "1"

Signature · 1 line
Christopher Larson