#include <string>
#include <vector>
+#include "elfcpp.h"
#include "script.h"
namespace gold
class Command_line;
class Input_file_group;
class Position_dependent_options;
+class Target;
namespace options
{
{ return this->output_file_name_; }
// --oformat: Output format.
-
Object_format
output_format() const
{ return this->output_format_; }
+ // Return the default target.
+ Target*
+ default_target() const;
+
// -r: Whether we are doing a relocatable link.
bool
is_relocatable() const
version_script() const
{ return *this->script_options_->version_script_info(); }
+ // -Tbss: The address of the BSS segment
+ uint64_t
+ bss_segment_address() const
+ { return this->bss_segment_address_; }
+
+ // Whether -Tbss was used.
+ bool
+ user_set_bss_segment_address() const
+ { return this->bss_segment_address_ != -1U; }
+
+ // -Tdata: The address of the data segment
+ uint64_t
+ data_segment_address() const
+ { return this->data_segment_address_; }
+
+ // Whether -Tdata was used.
+ bool
+ user_set_data_segment_address() const
+ { return this->data_segment_address_ != -1U; }
+
// -Ttext: The address of the .text section
uint64_t
text_segment_address() const
{ this->sysroot_ = arg; }
void
- set_text_segment_address(const char* arg)
+ set_segment_address(const char* name, const char* arg, uint64_t* val)
{
char* endptr;
- this->text_segment_address_ = strtoull(arg, &endptr, 0);
- if (*endptr != '\0'
- || this->text_segment_address_ == -1U)
- gold_fatal(_("invalid argument to -Ttext: %s"), arg);
+ *val = strtoull(arg, &endptr, 0);
+ if (*endptr != '\0' || *val == -1U)
+ gold_fatal(_("invalid argument to %s: %s"), name, arg);
}
+ void
+ set_bss_segment_address(const char* arg)
+ { this->set_segment_address("-Tbss", arg, &this->bss_segment_address_); }
+
+ void
+ set_data_segment_address(const char* arg)
+ { this->set_segment_address("-Tdata", arg, &this->data_segment_address_); }
+
+ void
+ set_text_segment_address(const char* arg)
+ { this->set_segment_address("-Ttext", arg, &this->text_segment_address_); }
+
int
parse_thread_count(const char* arg)
{
int optimization_level_;
const char* output_file_name_;
Object_format output_format_;
+ const char* output_format_string_;
bool is_relocatable_;
Strip strip_;
bool allow_shlib_undefined_;
bool is_static_;
bool print_stats_;
std::string sysroot_;
+ uint64_t bss_segment_address_;
+ uint64_t data_segment_address_;
uint64_t text_segment_address_;
bool threads_;
int thread_count_initial_;