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
15 changes: 13 additions & 2 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -735,7 +735,11 @@ fn addCxxKnownPath(
) !void {
if (!std.process.can_spawn)
return error.RequiredLibraryNotFound;
const path_padded = b.exec(&.{ ctx.cxx_compiler, b.fmt("-print-file-name={s}", .{objname}) });

const path_padded = if (ctx.cxx_compiler_arg1.len > 0)
b.exec(&.{ ctx.cxx_compiler, ctx.cxx_compiler_arg1, b.fmt("-print-file-name={s}", .{objname}) })
else
b.exec(&.{ ctx.cxx_compiler, b.fmt("-print-file-name={s}", .{objname}) });
var tokenizer = mem.tokenizeAny(u8, path_padded, "\r\n");
const path_unpadded = tokenizer.next().?;
if (mem.eql(u8, path_unpadded, objname)) {
Expand Down Expand Up @@ -778,6 +782,7 @@ const CMakeConfig = struct {
cmake_static_library_prefix: []const u8,
cmake_static_library_suffix: []const u8,
cxx_compiler: []const u8,
cxx_compiler_arg1: []const u8,
lld_include_dir: []const u8,
lld_libraries: []const u8,
clang_libraries: []const u8,
Expand Down Expand Up @@ -844,6 +849,7 @@ fn parseConfigH(b: *std.Build, config_h_text: []const u8) ?CMakeConfig {
.cmake_static_library_prefix = undefined,
.cmake_static_library_suffix = undefined,
.cxx_compiler = undefined,
.cxx_compiler_arg1 = "",
.lld_include_dir = undefined,
.lld_libraries = undefined,
.clang_libraries = undefined,
Expand Down Expand Up @@ -875,6 +881,10 @@ fn parseConfigH(b: *std.Build, config_h_text: []const u8) ?CMakeConfig {
.prefix = "#define ZIG_CXX_COMPILER ",
.field = "cxx_compiler",
},
.{
.prefix = "#define ZIG_CXX_COMPILER_ARG1 ",
.field = "cxx_compiler_arg1",
},
.{
.prefix = "#define ZIG_LLD_INCLUDE_PATH ",
.field = "lld_include_dir",
Expand Down Expand Up @@ -917,7 +927,8 @@ fn parseConfigH(b: *std.Build, config_h_text: []const u8) ?CMakeConfig {
var it = mem.splitScalar(u8, line, '"');
_ = it.first(); // skip the stuff before the quote
const quoted = it.next().?; // the stuff inside the quote
@field(ctx, mapping.field) = toNativePathSep(b, quoted);
const trimmed = mem.trim(u8, quoted, " ");
@field(ctx, mapping.field) = toNativePathSep(b, trimmed);
}
}
if (mem.startsWith(u8, line, "#define ZIG_LLVM_LINK_MODE ")) {
Expand Down
8 changes: 8 additions & 0 deletions lib/libc/include/generic-glibc/features.h
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,11 @@
# define __GLIBC_USE_DEPRECATED_SCANF 0
#endif


/* support for ISO C2X strtol was added in 2.38
* glibc commit 64924422a99690d147a166b4de3103f3bf3eaf6c
*/
#if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 38) || __GLIBC__ > 2
/* ISO C2X added support for a 0b or 0B prefix on binary constants as
inputs to strtol-family functions (base 0 or 2). This macro is
used to condition redirection in headers to allow that redirection
Expand All @@ -479,6 +484,9 @@
#else
# define __GLIBC_USE_C2X_STRTOL 0
#endif
#else /* glibc 2.37 or lower */
# define __GLIBC_USE_C2X_STRTOL 0
#endif

/* Get definitions of __STDC_* predefined macros, if the compiler has
not preincluded this header automatically. */
Expand Down
1 change: 1 addition & 0 deletions stage1/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#define ZIG_CMAKE_STATIC_LIBRARY_PREFIX "@CMAKE_STATIC_LIBRARY_PREFIX@"
#define ZIG_CMAKE_STATIC_LIBRARY_SUFFIX "@CMAKE_STATIC_LIBRARY_SUFFIX@"
#define ZIG_CXX_COMPILER "@CMAKE_CXX_COMPILER@"
#define ZIG_CXX_COMPILER_ARG1 "@CMAKE_CXX_COMPILER_ARG1@"
#define ZIG_DIA_GUIDS_LIB "@ZIG_DIA_GUIDS_LIB_ESCAPED@"
#define ZIG_LLD_INCLUDE_PATH "@LLD_INCLUDE_DIRS@"
#define ZIG_LLD_LIBRARIES "@LLD_LIBRARIES@"
Expand Down