40 if(cmdline.
isset(
"native-linker"))
41 return cmdline.
get_value(
"native-linker");
43 std::string::size_type
pos = base_name.find(
"goto-ld");
46 pos == std::string::npos || base_name ==
"goto-gcc" ||
47 base_name ==
"goto-ld")
50 std::string result = base_name;
51 result.replace(
pos, 7,
"ld");
58 goto_binary_tmp_suffix(
".goto-cc-saved")
92 compiler.object_file_extension =
"o";
114 compiler.output_file_executable =
"a.out";
120 if(arg.is_infile_name)
153 log.debug() <<
"RUN:";
154 for(std::size_t i = 0; i <
new_argv.size(); i++)
163 const std::list<std::string> &object_files)
178 log.debug() <<
"Running " <<
native_tool_name <<
" to generate hybrid binary"
203 log.debug() <<
"stripping goto-cc sections before building EFI binary"
209 std::ofstream out(
bin_name, std::ios::binary);
221 log.debug() <<
"EFI binary preparation: removing goto-cc section failed"
236 result =
ls_merge.add_linker_script_definitions();
242 log.debug() <<
"arch set with " << object_files.size() <<
messaget::eom;
245 log.debug() <<
"EFI binary preparation: restoring object files"
251 log.debug() <<
"Rename failed: " << std::strerror(
errno)
277 std::cout <<
"goto-ld understands the options of "
278 <<
"ld plus the following.\n\n";
virtual void clear()
Reset the abstract state.
ait supplies three of the four components needed: an abstract interpreter (in this case handling func...
std::string get_value(char option) const
virtual bool isset(char option) const
const std::list< std::string > & get_values(const std::string &option) const
@ COMPILE_LINK_EXECUTABLE
bool set(const cmdlinet &cmdline)
Base class for exceptions thrown in the cprover project.
virtual std::string what() const
A human readable description of what went wrong.
goto_cc_cmdlinet & cmdline
message_handlert & message_handler
const std::string base_name
void help()
display command line help
void help_mode() final
display command line help
const std::string goto_binary_tmp_suffix
std::string native_tool_name
gcc_message_handlert gcc_message_handler
int run_ld()
call ld with original command line
ld_modet(goto_cc_cmdlinet &_cmdline, const std::string &_base_name)
int ld_hybrid_binary(bool building_executable, const std::list< std::string > &object_files)
Build an ELF or Mach-O binary containing a goto-cc section.
Synthesise definitions of symbols that are defined in linker scripts.
Class that provides messages with a built-in verbosity 'level'.
static unsigned eval_verbosity(const std::string &user_input, const message_levelt default_verbosity, message_handlert &dest)
Parse a (user-)provided string as a verbosity level and set it as the verbosity of dest.
Compile and link source and object files.
void file_rename(const std::string &old_path, const std::string &new_path)
Rename a file.
static std::string linker_name(const cmdlinet &cmdline, const std::string &base_name)
Command line interpretation for goto-cc.
int hybrid_binary(const std::string &compiler_or_linker, const std::string &goto_binary_file, const std::string &output_file, bool building_executable, message_handlert &message_handler, bool linking_efi)
Merges a goto binary into an object file (e.g.
std::string objcopy_command(const std::string &compiler_or_linker)
Return the name of the objcopy tool matching the chosen compiler or linker command.
Create hybrid binary with goto-binary section.
static std::string linker_name(const cmdlinet &cmdline, const std::string &base_name)
Base class for command line interpretation.
Merge linker script-defined symbols into a goto-program.
int run(const std::string &what, const std::vector< std::string > &argv)
#define PRECONDITION(CONDITION)