glibc: i386: make glibc not use invalid inline asm syntax

This commit is contained in:
Andrew Kelley 2021-12-15 22:27:11 -07:00
parent bf2bd8e722
commit afb1652c50

View file

@ -269,6 +269,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile) !void {
return comp.build_crt_file("Scrt1", .Obj, &[_]Compilation.CSourceFile{ start_os, abi_note_o }); return comp.build_crt_file("Scrt1", .Obj, &[_]Compilation.CSourceFile{ start_os, abi_note_o });
}, },
.libc_nonshared_a => { .libc_nonshared_a => {
const target = comp.getTarget();
const s = path.sep_str; const s = path.sep_str;
const linux_prefix = lib_libc_glibc ++ const linux_prefix = lib_libc_glibc ++
"sysdeps" ++ s ++ "unix" ++ s ++ "sysv" ++ s ++ "linux" ++ s; "sysdeps" ++ s ++ "unix" ++ s ++ "sysv" ++ s ++ "linux" ++ s;
@ -354,6 +355,13 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile) !void {
}); });
try add_include_dirs(comp, arena, &args); try add_include_dirs(comp, arena, &args);
if (target.cpu.arch == .i386) {
// This prevents i386/sysdep.h from trying to do some
// silly and unnecessary inline asm hack that uses weird
// syntax that clang does not support.
try args.append("-DCAN_USE_REGISTER_ASM_EBP");
}
const shared_def = switch (dep.flavor) { const shared_def = switch (dep.flavor) {
.shared => "-DSHARED", .shared => "-DSHARED",
.nonshared => "-DLIBC_NONSHARED=1", .nonshared => "-DLIBC_NONSHARED=1",