Bug 209885 - sparc64: build error due to unmet dependency for COMPAT_BINFMT_ELF by COMPAT
Summary: sparc64: build error due to unmet dependency for COMPAT_BINFMT_ELF by COMPAT
Status: NEW
Alias: None
Product: Platform Specific/Hardware
Classification: Unclassified
Component: SPARC64 (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: platform_sparc64
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-10-26 21:37 UTC by Necip Fazil Yildiran
Modified: 2020-10-26 21:37 UTC (History)
3 users (show)

See Also:
Kernel Version: 5.10rc1
Subsystem:
Regression: No
Bisected commit-id:


Attachments
reproduce.tar.gz (100.44 KB, application/gzip)
2020-10-26 21:37 UTC, Necip Fazil Yildiran
Details

Description Necip Fazil Yildiran 2020-10-26 21:37:03 UTC
Created attachment 293231 [details]
reproduce.tar.gz

Attachment (reproduce.tar.gz) content:
 - sample.config: Config file to reproduce the bug.
 - build_out.txt: Output of Kbuild including the error messages.

When COMPAT_BINFMT_ELF is enabled and BINFMT_ELF is disabled, it results in the
following Kbuild warning:

WARNING: unmet direct dependencies detected for COMPAT_BINFMT_ELF
  Depends on [n]: COMPAT [=y] && BINFMT_ELF [=n]
  Selected by [y]:
  - COMPAT [=y] && SPARC64 [=y]

Building the kernel fails due to this unmet direct dependency issue as follows:

[...]
  LD      vmlinux
/home/necip/0day/gcc-9.3.0-nolibc/sparc64-linux/bin/sparc64-linux-ld: fs/compat_binfmt_elf.o: in function `elf_core_dump':
/home/necip/linux/clean-linux-5.4.4/fs/binfmt_elf.c:2221: undefined reference to `elf_core_extra_phdrs'
/home/necip/0day/gcc-9.3.0-nolibc/sparc64-linux/bin/sparc64-linux-ld: /home/necip/linux/clean-linux-5.4.4/fs/binfmt_elf.c:2283: undefined reference to `elf_core_extra_data_size'
/home/necip/0day/gcc-9.3.0-nolibc/sparc64-linux/bin/sparc64-linux-ld: /home/necip/linux/clean-linux-5.4.4/fs/binfmt_elf.c:2324: undefined reference to `elf_core_write_extra_phdrs'
/home/necip/0day/gcc-9.3.0-nolibc/sparc64-linux/bin/sparc64-linux-ld: /home/necip/linux/clean-linux-5.4.4/fs/binfmt_elf.c:2363: undefined reference to `elf_core_write_extra_data'
Makefile:1077: recipe for target 'vmlinux' failed
make: *** [vmlinux] Error 1


Steps to reproduce the bug for v5.4.4:
  1. wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
  2. chmod +x ~/bin/make.cross
  3. tar -xvf reproduce.tar.gz # sample.config and build_out.txt
  4. cp sample.config path/to/linux-source-v5.4.4/.config
  5. cd path/to/linux-source-v5.4.4/
  6. ~/bin/make.cross ARCH=sparc64 clean
  7. ~/bin/make.cross ARCH=sparc64 olddefconfig # unmet direct dependency warning
  8. ~/bin/make.cross ARCH=sparc64 # should have a build error

The output for the steps [6-8] can be found in build_out.txt.

The bug is reproducible for v5.10-rc1 as well with the same steps.

Kernel successfully builds when the unmet direct dependencies are resolved
by enabling them in the configuration. Depending on instead of selecting
the symbols, or selecting the dependencies of the selected symbols as well
should fix the bug.

Thanks,
Necip

Note You need to log in before you can comment on or make changes to this bug.