summaryrefslogtreecommitdiffstats
path: root/src/build/linker/linker.C
diff options
context:
space:
mode:
Diffstat (limited to 'src/build/linker/linker.C')
-rw-r--r--src/build/linker/linker.C30
1 files changed, 28 insertions, 2 deletions
diff --git a/src/build/linker/linker.C b/src/build/linker/linker.C
index a9a9d0f5e..6a8854d83 100644
--- a/src/build/linker/linker.C
+++ b/src/build/linker/linker.C
@@ -112,6 +112,8 @@ struct Section
size_t size;
bfd_byte* data;
+
+ Section() : name(""), vma_offset(0), size(0), data(NULL) {}
};
/**
@@ -123,6 +125,7 @@ struct Object
string name; //!< full path name of file
bfd* image; //!< bfd image of object
Section text; //!< text section of binary
+ Section sfpr; //!< sfpr section of binary
Section rodata; //!< rodata section of binary
Section data; //!< data section of binary
map<string, Symbol> symbols; //!< symbol map
@@ -203,7 +206,7 @@ struct Object
/**
* CTOR default
*/
- Object() : image(NULL), text(), rodata(), data(), offset(0),
+ Object() : image(NULL), text(), rodata(), data(), sfpr(), offset(0),
base_addr(0), iv_output(NULL), tls_module(-1) {}
@@ -213,7 +216,7 @@ struct Object
* @param[in] i_out : output FILE handle
*/
Object(unsigned long i_baseAddr, FILE* i_out)
- : image(NULL), text(), rodata(), data(), offset(0),
+ : image(NULL), text(), rodata(), data(), sfpr(), offset(0),
base_addr(i_baseAddr), iv_output(i_out), tls_module(-1) {}
};
@@ -439,6 +442,8 @@ int main(int argc, char** argv)
// A contained member value might be something like
// _ZZ3fooE3bar.
string sym_name = string((i->c_str())+1);
+ const char* gcovstr = "__gcov";
+ size_t gcovstrlen = strlen(gcovstr);
cout << "Checking weak symbol: " << *i << endl;
@@ -451,6 +456,12 @@ int main(int argc, char** argv)
== j->find("traceData_codeInfo"))
&& (*i != *j))
{
+ if (strncmp((*j).c_str(),
+ gcovstr,
+ gcovstrlen)==0)
+ {
+ continue;
+ }
cout << "\tDuplicate member found: " << *j << endl;
throw std::runtime_error(
string("Duplicate weak symbol with contained "
@@ -586,6 +597,11 @@ bool Object::read_object(const char* i_file)
{
s = &this->text;
}
+ else if (string(".sfpr") ==
+ bfd_get_section_name(image, image_section))
+ {
+ s = &this->sfpr;
+ }
else if (string(".rodata") ==
bfd_get_section_name(image, image_section))
{
@@ -640,6 +656,16 @@ bool Object::write_object()
cout << strerror(error) << endl;
}
+ // Output sfpr section.
+ fseek(iv_output, offset + sfpr.vma_offset, SEEK_SET);
+ if ((0 != sfpr.size) &&
+ (sfpr.size != fwrite(sfpr.data, 1, sfpr.size, iv_output)))
+ {
+ int error = errno;
+ cout << "Error writing to output for sfpr." << endl;
+ cout << strerror(error) << endl;
+ }
+
// Output RODATA section.
fseek(iv_output, offset + rodata.vma_offset, SEEK_SET);
if ((0 != rodata.size) &&
OpenPOWER on IntegriCloud