@@ -22,6 +22,7 @@ Author: CM Wintersteiger, 2006
22
22
#include < fstream>
23
23
24
24
#include < util/string2int.h>
25
+ #include < util/invariant.h>
25
26
#include < util/tempdir.h>
26
27
#include < util/config.h>
27
28
#include < util/prefix.h>
@@ -502,7 +503,7 @@ int gcc_modet::doit()
502
503
else if (cmdline.isset (' E' ))
503
504
{
504
505
compiler.mode =compilet::PREPROCESS_ONLY;
505
- assert ( false ) ;
506
+ UNREACHABLE ;
506
507
}
507
508
else if (cmdline.isset (" shared" ) ||
508
509
cmdline.isset (' r' )) // really not well documented
@@ -524,7 +525,6 @@ int gcc_modet::doit()
524
525
debug () << " Compiling and linking a library" << eom; break ;
525
526
case compilet::COMPILE_LINK_EXECUTABLE:
526
527
debug () << " Compiling and linking an executable" << eom; break ;
527
- default : assert (false );
528
528
}
529
529
530
530
if (cmdline.isset (" i386-win32" ) ||
@@ -778,7 +778,7 @@ int gcc_modet::preprocess(
778
778
new_argv.push_back (src);
779
779
780
780
// overwrite argv[0]
781
- assert (new_argv.size ()>=1 );
781
+ INVARIANT (new_argv.size ()>=1 , " No program name in argv " );
782
782
new_argv[0 ]=native_tool_name.c_str ();
783
783
784
784
debug () << " RUN:" ;
@@ -792,7 +792,7 @@ int gcc_modet::preprocess(
792
792
// / run gcc or clang with original command line
793
793
int gcc_modet::run_gcc ()
794
794
{
795
- assert (!cmdline.parsed_argv .empty ());
795
+ PRECONDITION (!cmdline.parsed_argv .empty ());
796
796
797
797
// build new argv
798
798
std::vector<std::string> new_argv;
@@ -879,6 +879,11 @@ int gcc_modet::gcc_hybrid_binary()
879
879
objcopy_cmd=linker_name (cmdline, base_name);
880
880
objcopy_cmd.erase (objcopy_cmd.size ()-2 );
881
881
}
882
+ else if (has_suffix (compiler_name (cmdline, base_name), " -gcc" ))
883
+ {
884
+ objcopy_cmd=compiler_name (cmdline, base_name);
885
+ objcopy_cmd.erase (objcopy_cmd.size ()-3 );
886
+ }
882
887
objcopy_cmd+=" objcopy" ;
883
888
884
889
int result=run_gcc ();
0 commit comments