* options.cc (General_options::parse_section_start): New function.
	(General_options::section_start): New function.
	(General_options::General_options): Initialize all members.
	* options.h: Include <map>
	(class General_options): Add --section-start.  Add section_starts_
	member.
	* layout.cc (Layout::attach_allocated_section_to_segment): If
	--section-start was used, set the address of the segment.  Remove
	local sort_sections.
	(Layout::relaxation_loop_body): If the address of the load segment
	has been set by --section-start, don't use it.
	* output.h (Output_segment::update_flags_for_output_section): New
	function.
	* output.cc (Output_segment::add_output_section): Call
	update_flags_for_output_section.
This commit is contained in:
Ian Lance Taylor 2010-01-06 22:37:18 +00:00
parent d5551862df
commit a192ba0508
6 changed files with 141 additions and 15 deletions

View file

@ -39,6 +39,7 @@
#include <cstdlib>
#include <cstring>
#include <list>
#include <map>
#include <string>
#include <vector>
@ -845,6 +846,9 @@ class General_options
N_("Add DIR to link time shared library search path"),
N_("DIR"));
DEFINE_special(section_start, options::TWO_DASHES, '\0',
N_("Set address of section"), N_("SECTION=ADDRESS"));
DEFINE_optional_string(sort_common, options::TWO_DASHES, '\0', NULL,
N_("Sort common symbols by alignment"),
N_("[={ascending,descending}]"));
@ -1174,6 +1178,12 @@ class General_options
bool
check_excluded_libs (const std::string &s) const;
// If an explicit start address was given for section SECNAME with
// the --section-start option, return true and set *PADDR to the
// address. Otherwise return false.
bool
section_start(const char* secname, uint64_t* paddr) const;
private:
// Don't copy this structure.
General_options(const General_options&);
@ -1261,6 +1271,8 @@ class General_options
Unordered_set<std::string> excluded_libs_;
// List of symbol-names to keep, via -retain-symbol-info.
Unordered_set<std::string> symbols_to_retain_;
// Map from section name to address from --section-start.
std::map<std::string, uint64_t> section_starts_;
};
// The position-dependent options. We use this to store the state of