summaryrefslogtreecommitdiffstats
path: root/src/build/linker/linker.C
diff options
context:
space:
mode:
authorStephen Cprek <smcprek@us.ibm.com>2016-12-06 10:42:23 -0600
committerDaniel M. Crowell <dcrowell@us.ibm.com>2017-01-30 11:18:51 -0500
commit6b650f5428297e8dde075d25e7862a20c8d47f04 (patch)
treeb268ac9fb258732a7aea73179c2f09992b76cc36 /src/build/linker/linker.C
parentaff3f67b49b87d5e2755b364ecb512641bbb4540 (diff)
downloadtalos-hostboot-6b650f5428297e8dde075d25e7862a20c8d47f04.tar.gz
talos-hostboot-6b650f5428297e8dde075d25e7862a20c8d47f04.zip
Compile ROM code within Hostboot
Additionally added version id to resolve story 135747 RTC: 143902 Change-Id: I67ad4b28b76464aaa58ec2c344cd1f9ceef9ff73 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/33608 Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Reviewed-by: Nicholas E. Bofferding <bofferdn@us.ibm.com> Reviewed-by: Michael Baiocchi <mbaiocch@us.ibm.com> Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com> Reviewed-by: Martin Gloff <mgloff@us.ibm.com> Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/build/linker/linker.C')
-rw-r--r--src/build/linker/linker.C63
1 files changed, 37 insertions, 26 deletions
diff --git a/src/build/linker/linker.C b/src/build/linker/linker.C
index fb154d989..d00b56a98 100644
--- a/src/build/linker/linker.C
+++ b/src/build/linker/linker.C
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2011,2015 */
+/* Contributors Listed Below - COPYRIGHT 2011,2017 */
/* [+] International Business Machines Corp. */
/* */
/* */
@@ -288,6 +288,7 @@ map<string,size_t> weak_symbols;
set<string> all_symbols;
set<string> weak_symbols_to_check;
bool includes_extended_image = false;
+bool relocation = true;
size_t next_tls_id = 0;
@@ -304,7 +305,7 @@ int main(int argc, char** argv)
if (argc <= 2)
{
cout << argv[0] << " <output> <kernel> <modules>"
- " [--extended=<page_addr> <output> <modules>]" << endl;
+ " [--no-relocation] [--extended=<page_addr> <output> <modules>]" << endl;
return -1;
}
@@ -317,7 +318,11 @@ int main(int argc, char** argv)
for (int files = 1; files < argc; files++)
{
string fname(argv[files]);
- if(isOutput)
+ if (0 == fname.compare(0,15,"--no-relocation"))
+ {
+ relocation = false;
+ }
+ else if(isOutput)
{
isOutput = false;
output = fopen(fname.c_str(), "w+");
@@ -444,35 +449,39 @@ int main(int argc, char** argv)
// Only appies to base binary file
//
- cout << "Updating last address..." << std::hex;
- const Symbol& last_address_symbol =
- objects[0].symbols[VFS_TOSTRING(VFS_LAST_ADDRESS)];
- uint64_t last_address_entry_address =
- last_address_symbol.address + last_address_symbol.base +
- objects[0].offset;
-
- fseek(objects[0].iv_output, last_address_entry_address, SEEK_SET);
-
- char last_addr_data[sizeof(uint64_t)];
- bfd_putb64(last_address, last_addr_data);
- fwrite(last_addr_data, sizeof(uint64_t), 1, objects[0].iv_output);
+ // Ignore if relocation not needed for image.
+ if (relocation)
+ {
+ cout << "Updating last address..." << std::hex;
+ const Symbol& last_address_symbol =
+ objects[0].symbols[VFS_TOSTRING(VFS_LAST_ADDRESS)];
+ uint64_t last_address_entry_address =
+ last_address_symbol.address + last_address_symbol.base +
+ objects[0].offset;
- cout << last_address << " to " << last_address_entry_address << endl;
+ fseek(objects[0].iv_output, last_address_entry_address, SEEK_SET);
- // Output relocation data for single file images. (non-extended)
- if (!includes_extended_image)
- {
- fseek(objects[0].iv_output, 0, SEEK_END);
- char temp64[sizeof(uint64_t)];
+ char last_addr_data[sizeof(uint64_t)];
+ bfd_putb64(last_address, last_addr_data);
+ fwrite(last_addr_data, sizeof(uint64_t), 1, objects[0].iv_output);
- uint64_t count = all_relocations.size();
- bfd_putb64(count, temp64);
- fwrite(temp64, sizeof(uint64_t), 1, objects[0].iv_output);
+ cout << last_address << " to " << last_address_entry_address << endl;
- for (int i = 0; i < all_relocations.size(); i++)
+ // Output relocation data for single file images. (non-extended)
+ if (!includes_extended_image)
{
- bfd_putb64(all_relocations[i], temp64);
+ fseek(objects[0].iv_output, 0, SEEK_END);
+ char temp64[sizeof(uint64_t)];
+
+ uint64_t count = all_relocations.size();
+ bfd_putb64(count, temp64);
fwrite(temp64, sizeof(uint64_t), 1, objects[0].iv_output);
+
+ for (int i = 0; i < all_relocations.size(); i++)
+ {
+ bfd_putb64(all_relocations[i], temp64);
+ fwrite(temp64, sizeof(uint64_t), 1, objects[0].iv_output);
+ }
}
}
}
@@ -571,6 +580,8 @@ bool Object::write_object()
if(isELF())
{
+ // @TODO RTC: 166850 skip text, rodata, data if .size() is 0. It appears
+ // fseek messes up the offset, if there is 0 size.
// Output TEXT section.
fseek(iv_output, text.vma_offset, SEEK_CUR);
if (text.size != fwrite(text.data, 1, text.size, iv_output))
OpenPOWER on IntegriCloud