History log of /haiku/headers/os/kernel/elf.h
Revision Date Author Comments
# 3ddf0bbc 20-Jul-2019 Zoltán Mizsei <zmizsei@extrowerk.com>

BSD: Use elf.h from os/kernel

Platform-dependant defines for Elf_*

Change-Id: Ib86554eb497d20e60ad7c75de4321d5b516ad88c
Reviewed-on: https://review.haiku-os.org/c/1635
Reviewed-by: waddlesplash <waddlesplash@gmail.com>

# 076b1902 01-Jul-2019 Adrien Destugues <pulkomandy@pulkomandy.tk>

elf2aout: import from FreeBSD

The sparc openboot implementation can run executables in the a.out
format. We used to generate these using objcopy, but this does not work
anymore as binutils is deprecating a.out format support.

- Import elf2aout from FreeBSD
- Add some missing bits to our elf.h and have a copy of it in the build
headers so it can be used to build elf2aout for the host platform
(tested for Linux)
- Use it to generate the sparc haiku_loader
- Adjust the bootloader linker script to have two "program headers": one
that is not loadable and contains the ELF headers, and the second one
that is loadable and contains the actual code and data. Unlike
objcopy, elf2aout relies only on the program headers to know what to
put in its output file (sections are ignored), so this is required
otherwise we end up with the ELF header nested inside the a.out file,
and everything offset from the expected load address as a result.

Confirmed that this allows to build the loader and run it as far as
before, so I'm back to needing to implement some MMU support now.

FreeBSD commit: 7551d83c353e040b32c6ac205e577dbc5f2c8955

Change-Id: I90b48e578fa7f148aeddd8c5998fdddc5cfa73fa
Reviewed-on: https://review.haiku-os.org/c/1557
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>

# ef593f61 24-Nov-2018 Augustin Cavalier <waddlesplash@gmail.com>


This allows Clang builds (linked with our cross binutils) to
at least start runtime_loader and then try to load launch_daemon.
That fails with an infinite loop somewhere...

# fb4cc984 02-Aug-2018 Augustin Cavalier <waddlesplash@gmail.com>

build: Add initial ARM64 target.

It will probably be just stubs for the significant future, but,
here it is anyway.

Regarding the naming: Yes, the official name is "aarch64." However,
Linux, FreeBSD, and Zircon all call it "arm64", and so we will do the same.

I've configured it initially to be a Clang-only port, making no
changes to GCC buildtools whatsoever here. We'll see if that sticks,

# dd485ed4 02-May-2018 Alexander von Gluck IV <kallisti5@unixzen.com>

elf: Add aarch64 and riscv defines

* Add some additional defines as well.

Change-Id: I0a40f6b80a634ddaf83a8c22b9726a6e1f49bd34

# b68cf9d6 11-Apr-2017 Adrien Destugues <pulkomandy@pulkomandy.tk>

elf.h: add more architectures.

Mostly I need EM_AVR to build avrdude on Haiku.

# b32f51ce 01-Nov-2016 Adrien Destugues <pulkomandy@pulkomandy.tk>

elf.h: add ELFMAG* constants

Needed by libelf, when elf.h exists.

# 96658eae 27-Aug-2016 Adrien Destugues <pulkomandy@pulkomandy.tk>

elf.h: add some defines from Linux version

For completeness and compatibility.

# c2ddcb79 07-Aug-2016 Adrien Destugues <pulkomandy@gmail.com>

elf.h: also define SELFMAG

- Used by distcc when it detects elf.h.

# 8efb6db7 06-Aug-2016 Adrien Destugues <pulkomandy@gmail.com>

elf.h: rename ELF_MAGIC to ELFMAG

- This is how it is named in other versions of elf.h (Linux, glibc, possibly more)
- ELF_MAGIC is used by libelf for the same thing, and the defines conflicts,
breaking libelf build on Haiku.

# c60453fd 22-May-2016 Ingo Weinhold <ingo_weinhold@gmx.de>

Core dump: Add symbols for commpage to core file

# a0c364c7 29-Apr-2016 Ingo Weinhold <ingo_weinhold@gmx.de>

Core file images note: Add text delta field

# 5cde7a85 26-Apr-2016 Ingo Weinhold <ingo_weinhold@gmx.de>

Add symbol and string table addresses to core file

# 82185a52 26-Apr-2016 Ingo Weinhold <ingo_weinhold@gmx.de>

Future proofing core file format

* The Haiku specific notes contain a structure size field, now.
* Change the type of the count and size fields in the Haiku specific
notes to uint32 also for 64 bit ELF. The size field for a note is a
uint32 anyway.

# 467fe4ca 24-Apr-2016 Ingo Weinhold <ingo_weinhold@gmx.de>

kernel: Add core dump facility

* Add function core_dump_write_core_file(). It writes a core file for
the current thread's team. The file format is similar to that of
other OSs (i.e. ELF with PT_LOAD segments and a PT_NOTE segment), but
most of the notes are Haiku specific (infos for team, areas, images,
threads). More data will probably need to be added.
* Add team flag TEAM_FLAG_DUMP_CORE, thread flag
THREAD_FLAGS_TRAP_FOR_CORE_DUMP, and Team property coreDumpCondition,
a condition variable available while a core dump is progress. A
thread that finds its flag THREAD_FLAGS_TRAP_FOR_CORE_DUMP set before
exiting the kernel to userland calls core_dump_trap_thread(), which
blocks on the condition variable until the core dump has finished. We
need the team's threads to stop so we can get their CPU state (and
have a generally unchanging team state while writing the core file).
* Add user debugger message B_DEBUG_WRITE_CORE_FILE. It causes
core_dump_write_core_file() to be called for the team.
* Dumping core as an immediate effect of a terminal signal has not been
implemented yet, but that should be fairly straight forward.

# e3616ca1 25-Oct-2015 Simon South <ssouth@simonsouth.com>

system: Provide elf.h to applications

Make a version of elf.h (assembled from the private header files
elf_common.h, elf32.h and elf64.h, and including Haiku's extensions for
C++) available to applications ported from UNIX.

Signed-off-by: Jessica Hamilton <jessica.l.hamilton@gmail.com>