162306a36Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0-only
262306a36Sopenharmony_ci
362306a36Sopenharmony_cimenu "Executable file formats"
462306a36Sopenharmony_ci
562306a36Sopenharmony_ciconfig BINFMT_ELF
662306a36Sopenharmony_ci	bool "Kernel support for ELF binaries"
762306a36Sopenharmony_ci	depends on MMU
862306a36Sopenharmony_ci	select ELFCORE
962306a36Sopenharmony_ci	default y
1062306a36Sopenharmony_ci	help
1162306a36Sopenharmony_ci	  ELF (Executable and Linkable Format) is a format for libraries and
1262306a36Sopenharmony_ci	  executables used across different architectures and operating
1362306a36Sopenharmony_ci	  systems. Saying Y here will enable your kernel to run ELF binaries
1462306a36Sopenharmony_ci	  and enlarge it by about 13 KB. ELF support under Linux has now all
1562306a36Sopenharmony_ci	  but replaced the traditional Linux a.out formats (QMAGIC and ZMAGIC)
1662306a36Sopenharmony_ci	  because it is portable (this does *not* mean that you will be able
1762306a36Sopenharmony_ci	  to run executables from different architectures or operating systems
1862306a36Sopenharmony_ci	  however) and makes building run-time libraries very easy. Many new
1962306a36Sopenharmony_ci	  executables are distributed solely in ELF format. You definitely
2062306a36Sopenharmony_ci	  want to say Y here.
2162306a36Sopenharmony_ci
2262306a36Sopenharmony_ci	  Information about ELF is contained in the ELF HOWTO available from
2362306a36Sopenharmony_ci	  <http://www.tldp.org/docs.html#howto>.
2462306a36Sopenharmony_ci
2562306a36Sopenharmony_ci	  If you find that after upgrading from Linux kernel 1.2 and saying Y
2662306a36Sopenharmony_ci	  here, you still can't run any ELF binaries (they just crash), then
2762306a36Sopenharmony_ci	  you'll have to install the newest ELF runtime libraries, including
2862306a36Sopenharmony_ci	  ld.so (check the file <file:Documentation/Changes> for location and
2962306a36Sopenharmony_ci	  latest version).
3062306a36Sopenharmony_ci
3162306a36Sopenharmony_ciconfig BINFMT_ELF_KUNIT_TEST
3262306a36Sopenharmony_ci	bool "Build KUnit tests for ELF binary support" if !KUNIT_ALL_TESTS
3362306a36Sopenharmony_ci	depends on KUNIT=y && BINFMT_ELF=y
3462306a36Sopenharmony_ci	default KUNIT_ALL_TESTS
3562306a36Sopenharmony_ci	help
3662306a36Sopenharmony_ci	  This builds the ELF loader KUnit tests, which try to gather
3762306a36Sopenharmony_ci	  prior bug fixes into a regression test collection. This is really
3862306a36Sopenharmony_ci	  only needed for debugging. Note that with CONFIG_COMPAT=y, the
3962306a36Sopenharmony_ci	  compat_binfmt_elf KUnit test is also created.
4062306a36Sopenharmony_ci
4162306a36Sopenharmony_ciconfig COMPAT_BINFMT_ELF
4262306a36Sopenharmony_ci	def_bool y
4362306a36Sopenharmony_ci	depends on COMPAT && BINFMT_ELF
4462306a36Sopenharmony_ci	select ELFCORE
4562306a36Sopenharmony_ci
4662306a36Sopenharmony_ciconfig ARCH_BINFMT_ELF_STATE
4762306a36Sopenharmony_ci	bool
4862306a36Sopenharmony_ci
4962306a36Sopenharmony_ciconfig ARCH_BINFMT_ELF_EXTRA_PHDRS
5062306a36Sopenharmony_ci	bool
5162306a36Sopenharmony_ci
5262306a36Sopenharmony_ciconfig ARCH_HAVE_ELF_PROT
5362306a36Sopenharmony_ci	bool
5462306a36Sopenharmony_ci
5562306a36Sopenharmony_ciconfig ARCH_USE_GNU_PROPERTY
5662306a36Sopenharmony_ci	bool
5762306a36Sopenharmony_ci
5862306a36Sopenharmony_ciconfig BINFMT_ELF_FDPIC
5962306a36Sopenharmony_ci	bool "Kernel support for FDPIC ELF binaries"
6062306a36Sopenharmony_ci	default y if !BINFMT_ELF
6162306a36Sopenharmony_ci	depends on ARM || ((M68K || RISCV || SUPERH || XTENSA) && !MMU)
6262306a36Sopenharmony_ci	select ELFCORE
6362306a36Sopenharmony_ci	help
6462306a36Sopenharmony_ci	  ELF FDPIC binaries are based on ELF, but allow the individual load
6562306a36Sopenharmony_ci	  segments of a binary to be located in memory independently of each
6662306a36Sopenharmony_ci	  other. This makes this format ideal for use in environments where no
6762306a36Sopenharmony_ci	  MMU is available as it still permits text segments to be shared,
6862306a36Sopenharmony_ci	  even if data segments are not.
6962306a36Sopenharmony_ci
7062306a36Sopenharmony_ci	  It is also possible to run FDPIC ELF binaries on MMU linux also.
7162306a36Sopenharmony_ci
7262306a36Sopenharmony_ciconfig ELFCORE
7362306a36Sopenharmony_ci	bool
7462306a36Sopenharmony_ci	help
7562306a36Sopenharmony_ci	  This option enables kernel/elfcore.o.
7662306a36Sopenharmony_ci
7762306a36Sopenharmony_ciconfig CORE_DUMP_DEFAULT_ELF_HEADERS
7862306a36Sopenharmony_ci	bool "Write ELF core dumps with partial segments"
7962306a36Sopenharmony_ci	default y
8062306a36Sopenharmony_ci	depends on BINFMT_ELF && ELF_CORE
8162306a36Sopenharmony_ci	help
8262306a36Sopenharmony_ci	  ELF core dump files describe each memory mapping of the crashed
8362306a36Sopenharmony_ci	  process, and can contain or omit the memory contents of each one.
8462306a36Sopenharmony_ci	  The contents of an unmodified text mapping are omitted by default.
8562306a36Sopenharmony_ci
8662306a36Sopenharmony_ci	  For an unmodified text mapping of an ELF object, including just
8762306a36Sopenharmony_ci	  the first page of the file in a core dump makes it possible to
8862306a36Sopenharmony_ci	  identify the build ID bits in the file, without paying the i/o
8962306a36Sopenharmony_ci	  cost and disk space to dump all the text.  However, versions of
9062306a36Sopenharmony_ci	  GDB before 6.7 are confused by ELF core dump files in this format.
9162306a36Sopenharmony_ci
9262306a36Sopenharmony_ci	  The core dump behavior can be controlled per process using
9362306a36Sopenharmony_ci	  the /proc/PID/coredump_filter pseudo-file; this setting is
9462306a36Sopenharmony_ci	  inherited.  See Documentation/filesystems/proc.rst for details.
9562306a36Sopenharmony_ci
9662306a36Sopenharmony_ci	  This config option changes the default setting of coredump_filter
9762306a36Sopenharmony_ci	  seen at boot time.  If unsure, say Y.
9862306a36Sopenharmony_ci
9962306a36Sopenharmony_ciconfig BINFMT_SCRIPT
10062306a36Sopenharmony_ci	tristate "Kernel support for scripts starting with #!"
10162306a36Sopenharmony_ci	default y
10262306a36Sopenharmony_ci	help
10362306a36Sopenharmony_ci	  Say Y here if you want to execute interpreted scripts starting with
10462306a36Sopenharmony_ci	  #! followed by the path to an interpreter.
10562306a36Sopenharmony_ci
10662306a36Sopenharmony_ci	  You can build this support as a module; however, until that module
10762306a36Sopenharmony_ci	  gets loaded, you cannot run scripts.  Thus, if you want to load this
10862306a36Sopenharmony_ci	  module from an initramfs, the portion of the initramfs before loading
10962306a36Sopenharmony_ci	  this module must consist of compiled binaries only.
11062306a36Sopenharmony_ci
11162306a36Sopenharmony_ci	  Most systems will not boot if you say M or N here.  If unsure, say Y.
11262306a36Sopenharmony_ci
11362306a36Sopenharmony_ciconfig ARCH_HAS_BINFMT_FLAT
11462306a36Sopenharmony_ci	bool
11562306a36Sopenharmony_ci
11662306a36Sopenharmony_ciconfig BINFMT_FLAT
11762306a36Sopenharmony_ci	bool "Kernel support for flat binaries"
11862306a36Sopenharmony_ci	depends on ARCH_HAS_BINFMT_FLAT
11962306a36Sopenharmony_ci	help
12062306a36Sopenharmony_ci	  Support uClinux FLAT format binaries.
12162306a36Sopenharmony_ci
12262306a36Sopenharmony_ciconfig BINFMT_FLAT_ARGVP_ENVP_ON_STACK
12362306a36Sopenharmony_ci	bool
12462306a36Sopenharmony_ci
12562306a36Sopenharmony_ciconfig BINFMT_FLAT_OLD_ALWAYS_RAM
12662306a36Sopenharmony_ci	bool
12762306a36Sopenharmony_ci
12862306a36Sopenharmony_ciconfig BINFMT_FLAT_NO_DATA_START_OFFSET
12962306a36Sopenharmony_ci	bool
13062306a36Sopenharmony_ci
13162306a36Sopenharmony_ciconfig BINFMT_FLAT_OLD
13262306a36Sopenharmony_ci	bool "Enable support for very old legacy flat binaries"
13362306a36Sopenharmony_ci	depends on BINFMT_FLAT
13462306a36Sopenharmony_ci	help
13562306a36Sopenharmony_ci	  Support decade old uClinux FLAT format binaries.  Unless you know
13662306a36Sopenharmony_ci	  you have some of those say N here.
13762306a36Sopenharmony_ci
13862306a36Sopenharmony_ciconfig BINFMT_ZFLAT
13962306a36Sopenharmony_ci	bool "Enable ZFLAT support"
14062306a36Sopenharmony_ci	depends on BINFMT_FLAT
14162306a36Sopenharmony_ci	select ZLIB_INFLATE
14262306a36Sopenharmony_ci	help
14362306a36Sopenharmony_ci	  Support FLAT format compressed binaries
14462306a36Sopenharmony_ci
14562306a36Sopenharmony_ciconfig BINFMT_MISC
14662306a36Sopenharmony_ci	tristate "Kernel support for MISC binaries"
14762306a36Sopenharmony_ci	help
14862306a36Sopenharmony_ci	  If you say Y here, it will be possible to plug wrapper-driven binary
14962306a36Sopenharmony_ci	  formats into the kernel. You will like this especially when you use
15062306a36Sopenharmony_ci	  programs that need an interpreter to run like Java, Python, .NET or
15162306a36Sopenharmony_ci	  Emacs-Lisp. It's also useful if you often run DOS executables under
15262306a36Sopenharmony_ci	  the Linux DOS emulator DOSEMU (read the DOSEMU-HOWTO, available from
15362306a36Sopenharmony_ci	  <http://www.tldp.org/docs.html#howto>). Once you have
15462306a36Sopenharmony_ci	  registered such a binary class with the kernel, you can start one of
15562306a36Sopenharmony_ci	  those programs simply by typing in its name at a shell prompt; Linux
15662306a36Sopenharmony_ci	  will automatically feed it to the correct interpreter.
15762306a36Sopenharmony_ci
15862306a36Sopenharmony_ci	  You can do other nice things, too. Read the file
15962306a36Sopenharmony_ci	  <file:Documentation/admin-guide/binfmt-misc.rst> to learn how to use this
16062306a36Sopenharmony_ci	  feature, <file:Documentation/admin-guide/java.rst> for information about how
16162306a36Sopenharmony_ci	  to include Java support. and <file:Documentation/admin-guide/mono.rst> for
16262306a36Sopenharmony_ci          information about how to include Mono-based .NET support.
16362306a36Sopenharmony_ci
16462306a36Sopenharmony_ci          To use binfmt_misc, you will need to mount it:
16562306a36Sopenharmony_ci		mount binfmt_misc -t binfmt_misc /proc/sys/fs/binfmt_misc
16662306a36Sopenharmony_ci
16762306a36Sopenharmony_ci	  You may say M here for module support and later load the module when
16862306a36Sopenharmony_ci	  you have use for it; the module is called binfmt_misc. If you
16962306a36Sopenharmony_ci	  don't know what to answer at this point, say Y.
17062306a36Sopenharmony_ci
17162306a36Sopenharmony_ciconfig COREDUMP
17262306a36Sopenharmony_ci	bool "Enable core dump support" if EXPERT
17362306a36Sopenharmony_ci	default y
17462306a36Sopenharmony_ci	help
17562306a36Sopenharmony_ci	  This option enables support for performing core dumps. You almost
17662306a36Sopenharmony_ci	  certainly want to say Y here. Not necessary on systems that never
17762306a36Sopenharmony_ci	  need debugging or only ever run flawless code.
17862306a36Sopenharmony_ci
17962306a36Sopenharmony_ciendmenu
180