mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-21 23:20:20 +00:00
Build: Include headers from LibC, LibM, and LibPthread with -isystem
Make sure that userspace is always referencing "system" headers in a way that would build on target :). This means removing the explicit include_directories of Libraries/LibC in favor of having it export its headers as SYSTEM. Also remove a redundant include_directories of Libraries in the 'serenity build' part of the build script. It's already set at the top. This causes issues for the Kernel, and for crt0.o. These special cases are handled individually.
This commit is contained in:
parent
cdbbe14062
commit
c1eb744ff0
Notes:
sideshowbarker
2024-07-19 06:20:21 +09:00
Author: https://github.com/ADKaster Commit: https://github.com/SerenityOS/serenity/commit/c1eb744ff0a Pull-request: https://github.com/SerenityOS/serenity/pull/2242 Reviewed-by: https://github.com/bugaevc
11 changed files with 15 additions and 10 deletions
|
@ -30,7 +30,6 @@
|
|||
#include <AK/LogStream.h>
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <AK/kmalloc.h>
|
||||
#include <LibC/sys/arch/i386/regs.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibDebug/DebugInfo.h>
|
||||
#include <LibDebug/DebugSession.h>
|
||||
|
@ -41,6 +40,7 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/arch/i386/regs.h>
|
||||
#include <unistd.h>
|
||||
|
||||
static Line::Editor editor {};
|
||||
|
|
|
@ -52,6 +52,7 @@ function(serenity_libc target_name fs_name)
|
|||
add_library(${target_name} ${SOURCES})
|
||||
install(TARGETS ${target_name} ARCHIVE DESTINATION usr/lib)
|
||||
set_target_properties(${target_name} PROPERTIES OUTPUT_NAME ${fs_name})
|
||||
target_include_directories(${target_name} SYSTEM PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
target_link_directories(LibC PUBLIC ${CMAKE_CURRENT_BINARY_DIR})
|
||||
endfunction()
|
||||
|
||||
|
@ -101,8 +102,9 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Os -Wno-sized-deallocation -fno-sized-d
|
|||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DDEBUG -DSANITIZE_PTRS")
|
||||
add_link_options(--sysroot ${CMAKE_BINARY_DIR}/Root)
|
||||
|
||||
include_directories(Libraries/LibC)
|
||||
# Source directory relative service headers
|
||||
include_directories(Services)
|
||||
# Generated Service/Library Headers
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR}/Services)
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR}/Libraries)
|
||||
|
||||
|
|
|
@ -161,6 +161,9 @@ if (${CMAKE_HOST_SYSTEM_NAME} MATCHES SerenityOS)
|
|||
else()
|
||||
include_directories(../Toolchain/Local/i686-pc-serenity/include/c++/10.1.0/)
|
||||
include_directories(../Toolchain/Local/i686-pc-serenity/include/c++/10.1.0/i686-pc-serenity/)
|
||||
# FIXME: Many files include <LibC/sys/ioctl_numbers.h> and <LibC/errno_numbers.h>
|
||||
# With -nostdinc, this makes it interesting to include these headers properly
|
||||
include_directories(../Libraries/LibC)
|
||||
endif()
|
||||
|
||||
add_executable(Kernel ${SOURCES})
|
||||
|
|
|
@ -52,6 +52,8 @@ file(GLOB ELF_SOURCES "../LibELF/*.cpp")
|
|||
set(ELF_SOURCES ${ELF_SOURCES} ../LibELF/Arch/i386/plt_trampoline.S)
|
||||
|
||||
add_library(crt0 STATIC crt0.cpp)
|
||||
# We need include headers from LibC in crt0. namely, <assert.h>
|
||||
target_include_directories(crt0 PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
add_custom_command(
|
||||
TARGET crt0
|
||||
COMMAND install -D $<TARGET_OBJECTS:crt0> ${CMAKE_INSTALL_PREFIX}/usr/lib/crt0.o
|
||||
|
|
|
@ -33,11 +33,11 @@
|
|||
#include <AK/Optional.h>
|
||||
#include <AK/OwnPtr.h>
|
||||
#include <AK/String.h>
|
||||
#include <LibC/sys/arch/i386/regs.h>
|
||||
#include <LibDebug/DebugInfo.h>
|
||||
#include <LibELF/Loader.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/arch/i386/regs.h>
|
||||
#include <sys/ptrace.h>
|
||||
#include <sys/wait.h>
|
||||
#include <unistd.h>
|
||||
|
|
|
@ -3,5 +3,4 @@ set(SOURCES
|
|||
)
|
||||
|
||||
serenity_libc(LibM m)
|
||||
target_include_directories(LibM PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
target_link_libraries(LibM LibC)
|
||||
|
|
|
@ -24,8 +24,8 @@
|
|||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <LibC/assert.h>
|
||||
#include <LibM/math.h>
|
||||
#include <assert.h>
|
||||
#include <math.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
|
|
|
@ -4,4 +4,3 @@ set(SOURCES
|
|||
|
||||
serenity_libc(LibPthread pthread)
|
||||
target_link_libraries(LibPthread LibC)
|
||||
target_include_directories(LibPthread PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
|
|
@ -33,7 +33,6 @@
|
|||
#include <AK/StringBuilder.h>
|
||||
#include <AK/kmalloc.h>
|
||||
#include <Kernel/Syscall.h>
|
||||
#include <LibC/sys/arch/i386/regs.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibDebug/DebugSession.h>
|
||||
#include <LibELF/Image.h>
|
||||
|
@ -44,6 +43,7 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/arch/i386/regs.h>
|
||||
#include <unistd.h>
|
||||
|
||||
static int usage()
|
||||
|
|
|
@ -28,11 +28,11 @@
|
|||
#include <AK/LogStream.h>
|
||||
#include <AK/Types.h>
|
||||
#include <Kernel/Syscall.h>
|
||||
#include <LibC/sys/arch/i386/regs.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/arch/i386/regs.h>
|
||||
#include <sys/ptrace.h>
|
||||
#include <sys/wait.h>
|
||||
#include <unistd.h>
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <LibC/limits.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/EventLoop.h>
|
||||
#include <LibCore/File.h>
|
||||
|
@ -37,6 +36,7 @@
|
|||
#include <LibCrypto/PK/RSA.h>
|
||||
#include <LibLine/Editor.h>
|
||||
#include <LibTLS/TLSv12.h>
|
||||
#include <limits.h>
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
|
||||
|
|
Loading…
Reference in a new issue