Skip to content

Commit

Permalink
Merge pull request diffblue#2535 from tautschnig/debian7
Browse files Browse the repository at this point in the history
Use architecture-specific compiler flags to configure bit width during preprocessing
  • Loading branch information
Daniel Kroening authored Jul 7, 2018
2 parents 35ddf0b + be5f2ff commit 0acae08
Showing 1 changed file with 34 additions and 3 deletions.
37 changes: 34 additions & 3 deletions src/ansi-c/c_preprocess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -541,12 +541,43 @@ bool c_preprocess_gcc_clang(

command += " -E -D__CPROVER__";

const irep_idt &arch = config.ansi_c.arch;

if(config.ansi_c.pointer_width == 16)
command += " -m16";
{
if(arch == "i386" || arch == "x86_64" || arch == "x32")
command += " -m16";
else if(has_prefix(id2string(arch), "mips"))
command += " -mips16";
}
else if(config.ansi_c.pointer_width == 32)
command += " -m32";
{
if(arch == "i386" || arch == "x86_64")
command += " -m32";
else if(arch == "x32")
command += " -mx32";
else if(has_prefix(id2string(arch), "mips"))
command += " -mabi=32";
else if(arch == "powerpc" || arch == "ppc64" || arch == "ppc64le")
command += " -m32";
else if(arch == "s390" || arch == "s390x")
command += " -m31"; // yes, 31, not 32!
else if(arch == "sparc" || arch == "sparc64")
command += " -m32";
}
else if(config.ansi_c.pointer_width == 64)
command += " -m64";
{
if(arch == "i386" || arch == "x86_64" || arch == "x32")
command += " -m64";
else if(has_prefix(id2string(arch), "mips"))
command += " -mabi=64";
else if(arch == "powerpc" || arch == "ppc64" || arch == "ppc64le")
command += " -m64";
else if(arch == "s390" || arch == "s390x")
command += " -m64";
else if(arch == "sparc" || arch == "sparc64")
command += " -m64";
}

// The width of wchar_t depends on the OS!
if(config.ansi_c.wchar_t_width == config.ansi_c.short_int_width)
Expand Down

0 comments on commit 0acae08

Please sign in to comment.