Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -208,13 +208,13 @@ if (!is_android) {
# "loader/phys_dev_ext.c",
"loader/settings.c",
"loader/settings.h",
"loader/stack_allocation.h",
"loader/terminator.c",
"loader/trampoline.c",
"loader/unknown_function_handling.h",
"loader/unknown_function_handling.c",
"loader/vk_loader_layer.h",
"loader/vk_loader_platform.h",
"loader/vk_loader_platform.c",
"loader/wsi.c",
"loader/wsi.h",
]
Expand Down
2 changes: 1 addition & 1 deletion REUSE.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ path = [
"loader/generated/vk_layer_dispatch_table.h",
"loader/generated/vk_loader_extensions.h",
"loader/vk_loader_platform.h",
"loader/vk_loader_platform.c",
"scripts/generators/loader_extension_generator.py",
]
precedence = "closest"
Expand Down Expand Up @@ -219,7 +220,6 @@ path = [
"loader/debug_utils.c",
"loader/loader_windows.h",
"loader/allocation.h",
"loader/stack_allocation.h",
"loader/loader.h",
"loader/debug_utils.h",
"loader/loader_windows.c",
Expand Down
8 changes: 3 additions & 5 deletions loader/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,11 @@ if(WIN32)
configure_file(loader.rc.in ${CMAKE_CURRENT_BINARY_DIR}/loader.rc)
endif()
else()
# Used to make alloca() and secure_getenv() available
# Used to make secure_getenv() available
target_compile_definitions(loader_specific_options INTERFACE _GNU_SOURCE)
if(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
target_compile_definitions(loader_specific_options INTERFACE __BSD_VISIBLE=1)
endif()
check_include_file("alloca.h" HAVE_ALLOCA_H)
if(HAVE_ALLOCA_H)
target_compile_definitions(loader_specific_options INTERFACE HAVE_ALLOCA_H)
endif()

set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
Expand Down Expand Up @@ -90,6 +86,8 @@ set(NORMAL_LOADER_SRCS
trampoline.c
unknown_function_handling.c
unknown_function_handling.h
vk_loader_platform.c
vk_loader_platform.h
wsi.c
wsi.h
)
Expand Down
16 changes: 15 additions & 1 deletion loader/asm_offset.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,21 @@ int main(int argc, char **argv) {
// clang-format on
};

FILE *file = loader_fopen("gen_defines.asm", "w");
FILE *file = NULL;
#if defined(_WIN32)
errno_t err = fopen_s(&file, "gen_defines.asm", "w");
if (err != 0) {
fprintf(stderr, "Error: failed to open gen_defines.asm for writing\n");
return -1;
}
#else
file = fopen("gen_defines.asm", "w");
if (NULL == file) {
fprintf(stderr, "Error: failed to open gen_defines.asm for writing\n");
return -1;
}
#endif

// NOLINTBEGIN(cert-err33-c) - this is a build-time code generator run by developers, not part of the loader's
// runtime attack surface; a failed write here is immediately visible as a broken build, not worth per-call checks.
fprintf(file, "\n");
Expand Down
Loading
Loading