• Ralf Baechle's avatar
    ELF/MIPS build fix · f43edca7
    Ralf Baechle authored
    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>
    f43edca7
Kconfig.binfmt 7.13 KB