Commit f43edca7 authored by Ralf Baechle's avatar Ralf Baechle Committed by Linus Torvalds

ELF/MIPS build fix

CONFIG_MIPS32_N32=y but CONFIG_BINFMT_ELF disabled results in the
following linker errors:

  arch/mips/built-in.o: In function `elf_core_dump':
  binfmt_elfn32.c:(.text+0x23dbc): undefined reference to `elf_core_extra_phdrs'
  binfmt_elfn32.c:(.text+0x246e4): undefined reference to `elf_core_extra_data_size'
  binfmt_elfn32.c:(.text+0x248d0): undefined reference to `elf_core_write_extra_phdrs'
  binfmt_elfn32.c:(.text+0x24ac4): undefined reference to `elf_core_write_extra_data'

CONFIG_MIPS32_O32=y but CONFIG_BINFMT_ELF disabled results in the following
linker errors:

  arch/mips/built-in.o: In function `elf_core_dump':
  binfmt_elfo32.c:(.text+0x28a04): undefined reference to `elf_core_extra_phdrs'
  binfmt_elfo32.c:(.text+0x29330): undefined reference to `elf_core_extra_data_size'
  binfmt_elfo32.c:(.text+0x2951c): undefined reference to `elf_core_write_extra_phdrs'
  binfmt_elfo32.c:(.text+0x29710): undefined reference to `elf_core_write_extra_data'

This is because binfmt_elfn32 and binfmt_elfo32 are using symbols from
elfcore but for these configurations elfcore will not be built.

Fixed by making elfcore selectable by a separate config symbol which
unlike the current mechanism can also be used from other directories
than kernel/, then having each flavor of ELF that relies on elfcore.o,
select it in Kconfig, including CONFIG_MIPS32_N32 and CONFIG_MIPS32_O32
which fixes this issue.

Link: http://lkml.kernel.org/r/20160520141705.GA1913@linux-mips.orgSigned-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
Reviewed-by: default avatarJames Hogan <james.hogan@imgtec.com>
Cc: "Maciej W. Rozycki" <macro@linux-mips.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent ededb49a
...@@ -3117,6 +3117,7 @@ config MIPS32_N32 ...@@ -3117,6 +3117,7 @@ config MIPS32_N32
config BINFMT_ELF32 config BINFMT_ELF32
bool bool
default y if MIPS32_O32 || MIPS32_N32 default y if MIPS32_O32 || MIPS32_N32
select ELFCORE
endmenu endmenu
......
config BINFMT_ELF config BINFMT_ELF
bool "Kernel support for ELF binaries" bool "Kernel support for ELF binaries"
depends on MMU && (BROKEN || !FRV) depends on MMU && (BROKEN || !FRV)
select ELFCORE
default y default y
---help--- ---help---
ELF (Executable and Linkable Format) is a format for libraries and ELF (Executable and Linkable Format) is a format for libraries and
...@@ -26,6 +27,7 @@ config BINFMT_ELF ...@@ -26,6 +27,7 @@ config BINFMT_ELF
config COMPAT_BINFMT_ELF config COMPAT_BINFMT_ELF
bool bool
depends on COMPAT && BINFMT_ELF depends on COMPAT && BINFMT_ELF
select ELFCORE
config ARCH_BINFMT_ELF_STATE config ARCH_BINFMT_ELF_STATE
bool bool
...@@ -34,6 +36,7 @@ config BINFMT_ELF_FDPIC ...@@ -34,6 +36,7 @@ config BINFMT_ELF_FDPIC
bool "Kernel support for FDPIC ELF binaries" bool "Kernel support for FDPIC ELF binaries"
default y default y
depends on (FRV || BLACKFIN || (SUPERH32 && !MMU) || C6X) depends on (FRV || BLACKFIN || (SUPERH32 && !MMU) || C6X)
select ELFCORE
help help
ELF FDPIC binaries are based on ELF, but allow the individual load ELF FDPIC binaries are based on ELF, but allow the individual load
segments of a binary to be located in memory independently of each segments of a binary to be located in memory independently of each
...@@ -43,6 +46,11 @@ config BINFMT_ELF_FDPIC ...@@ -43,6 +46,11 @@ config BINFMT_ELF_FDPIC
It is also possible to run FDPIC ELF binaries on MMU linux also. It is also possible to run FDPIC ELF binaries on MMU linux also.
config ELFCORE
bool
help
This option enables kernel/elfcore.o.
config CORE_DUMP_DEFAULT_ELF_HEADERS config CORE_DUMP_DEFAULT_ELF_HEADERS
bool "Write ELF core dumps with partial segments" bool "Write ELF core dumps with partial segments"
default y default y
......
...@@ -91,9 +91,7 @@ obj-$(CONFIG_TASK_DELAY_ACCT) += delayacct.o ...@@ -91,9 +91,7 @@ obj-$(CONFIG_TASK_DELAY_ACCT) += delayacct.o
obj-$(CONFIG_TASKSTATS) += taskstats.o tsacct.o obj-$(CONFIG_TASKSTATS) += taskstats.o tsacct.o
obj-$(CONFIG_TRACEPOINTS) += tracepoint.o obj-$(CONFIG_TRACEPOINTS) += tracepoint.o
obj-$(CONFIG_LATENCYTOP) += latencytop.o obj-$(CONFIG_LATENCYTOP) += latencytop.o
obj-$(CONFIG_BINFMT_ELF) += elfcore.o obj-$(CONFIG_ELFCORE) += elfcore.o
obj-$(CONFIG_COMPAT_BINFMT_ELF) += elfcore.o
obj-$(CONFIG_BINFMT_ELF_FDPIC) += elfcore.o
obj-$(CONFIG_FUNCTION_TRACER) += trace/ obj-$(CONFIG_FUNCTION_TRACER) += trace/
obj-$(CONFIG_TRACING) += trace/ obj-$(CONFIG_TRACING) += trace/
obj-$(CONFIG_TRACE_CLOCK) += trace/ obj-$(CONFIG_TRACE_CLOCK) += trace/
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment