Skip to content

Commit 79adeb6

Browse files
implicitfieldawesomekling
authored andcommitted
LibC+LibELF: Move ELF definitions from LibC to LibELF
This is needed to avoid including LibC headers in Lagom builds. Unfortunately, we cannot rely on the build machine to provide a fully POSIX-compatible ELF header for Lagom builds, so we have to use our own.
1 parent 7d19abd commit 79adeb6

File tree

16 files changed

+850
-836
lines changed

16 files changed

+850
-836
lines changed

Kernel/Prekernel/init.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#include <Kernel/Memory/PhysicalAddress.h>
1212
#include <Kernel/Memory/VirtualAddress.h>
1313
#include <Kernel/Prekernel/Prekernel.h>
14-
#include <LibC/elf.h>
14+
#include <LibELF/ELFABI.h>
1515
#include <LibELF/Relocation.h>
1616

1717
#if ARCH(X86_64)

Kernel/Tasks/Coredump.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
#include <Kernel/Memory/ScopedAddressSpaceSwitcher.h>
2020
#include <Kernel/Tasks/Coredump.h>
2121
#include <Kernel/Tasks/Process.h>
22-
#include <LibC/elf.h>
2322
#include <LibELF/Core.h>
23+
#include <LibELF/ELFABI.h>
2424

2525
#define INCLUDE_USERSPACE_HEAP_MEMORY_IN_COREDUMPS 0
2626

Kernel/Tasks/Process.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
#include <Kernel/Tasks/ProcessGroup.h>
3737
#include <Kernel/Tasks/Thread.h>
3838
#include <Kernel/UnixTypes.h>
39-
#include <LibC/elf.h>
39+
#include <LibELF/ELFABI.h>
4040

4141
namespace Kernel {
4242

Meta/check-style.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
'AK/Checked.h',
2525
'AK/Function.h',
2626
'Userland/Libraries/LibJS/SafeFunction.h',
27-
'Userland/Libraries/LibC/elf.h',
27+
'Userland/Libraries/LibELF/ELFABI.h',
2828
'Userland/Libraries/LibCodeComprehension/Cpp/Tests/',
2929
'Userland/Libraries/LibCpp/Tests/parser/',
3030
'Userland/Libraries/LibCpp/Tests/preprocessor/'

Toolchain/BuildClang.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,7 @@ SRC_ROOT=$($REALPATH "$DIR"/..)
250250
FILES=$(find \
251251
"$SRC_ROOT"/Kernel/API \
252252
"$SRC_ROOT"/Userland/Libraries/LibC \
253+
"$SRC_ROOT"/Userland/Libraries/LibELF/ELFABI.h \
253254
"$SRC_ROOT"/Userland/Libraries/LibRegex/RegexDefs.h \
254255
-name '*.h' -print)
255256
for arch in $ARCHS; do
@@ -260,6 +261,7 @@ for arch in $ARCHS; do
260261
target=$(echo "$header" | "$SED" \
261262
-e "s|$SRC_ROOT/Userland/Libraries/LibC||" \
262263
-e "s|$SRC_ROOT/Kernel/|Kernel/|" \
264+
-e "s|$SRC_ROOT/Userland/Libraries/LibELF/|LibELF/|" \
263265
-e "s|$SRC_ROOT/Userland/Libraries/LibRegex/|LibRegex/|")
264266
buildstep "system_headers" "$INSTALL" -D "$header" "Root/usr/include/$target"
265267
done

Toolchain/BuildGNU.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,13 +270,15 @@ pushd "$DIR/Build/$ARCH"
270270
"$SRC_ROOT"/Kernel/API \
271271
"$SRC_ROOT"/Kernel/Arch \
272272
"$SRC_ROOT"/Userland/Libraries/LibC \
273+
"$SRC_ROOT"/Userland/Libraries/LibELF/ELFABI.h \
273274
"$SRC_ROOT"/Userland/Libraries/LibRegex/RegexDefs.h \
274275
-name '*.h' -print)
275276
for header in $FILES; do
276277
target=$(echo "$header" | sed \
277278
-e "s|$SRC_ROOT/AK/|AK/|" \
278279
-e "s|$SRC_ROOT/Userland/Libraries/LibC||" \
279280
-e "s|$SRC_ROOT/Kernel/|Kernel/|" \
281+
-e "s|$SRC_ROOT/Userland/Libraries/LibELF/|LibELF/|" \
280282
-e "s|$SRC_ROOT/Userland/Libraries/LibRegex/|LibRegex/|")
281283
buildstep "system_headers" mkdir -p "$(dirname "Root/usr/include/$target")"
282284
buildstep "system_headers" $INSTALL "$header" "Root/usr/include/$target"

0 commit comments

Comments
 (0)