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")
97 compiler.object_file_extension =
"o";
119 compiler.output_file_executable =
"a.out";
125 if(arg.is_infile_name)
158 log.debug() <<
"RUN:";
159 for(std::size_t i = 0; i <
new_argv.size(); i++)
168 const std::list<std::string> &object_files)
193 catch(
const std::filesystem::filesystem_error &e)
208 log.debug() <<
"stripping goto-cc sections before building EFI binary"
214 std::ofstream out(
bin_name, std::ios::binary);
226 log.debug() <<
"EFI binary preparation: removing goto-cc section failed"
241 result =
ls_merge.add_linker_script_definitions();
250 log.debug() <<
"EFI binary preparation: restoring object files"
256 log.debug() <<
"Rename failed: " << std::strerror(
errno)
282 std::cout <<
"goto-ld understands the options of "
283 <<
"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)
void print_warnings_as_errors(bool yes)
With yes set to true, prefix warnings with "error:" instead of "warning:".
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.
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)