summaryrefslogtreecommitdiffstats
path: root/src/build/linker/linker.C
diff options
context:
space:
mode:
authorJan Hlavac <jhlavac@redhat.com>2018-07-03 17:24:48 +0200
committerWilliam G. Hoffa <wghoffa@us.ibm.com>2018-07-19 15:46:51 -0500
commit9be05f401c09f8ecf978c210a10ccdf217b001cc (patch)
tree165abab0ef2e73db30c8e8db54dbae7b61bebb84 /src/build/linker/linker.C
parentbe6ed717c7a1de17f3934ed229b64c30f7a9e58b (diff)
downloadtalos-hostboot-9be05f401c09f8ecf978c210a10ccdf217b001cc.tar.gz
talos-hostboot-9be05f401c09f8ecf978c210a10ccdf217b001cc.zip
linker: fix compiler warnings
In Fedora 28 (x86_64) the linker binary, produced by GCC 8.1.1, always ended in an infinite loop in which it repeatedly appended some text to *.lnkout.bz2 file and *.bin.modinfo file. Example : .hbicore.lnkout.bz2: Error writing to output. Success hbicore.bin.modinfo: hbicore.elf,0x0 The GCC was also displaying warnings about missing return statements (-Wreturn-type). When these warnings were fixed, the problem with infinite loop disappeared. This problem also never appeared when the -O0 flag was used. While being there, also fix some warnings that happen with the -Wall flag. Resolves #143 Change-Id: Ia1ddfa07d3b22b151922de2df1db91ffc2aad2ca Signed-off-by: Jan Hlavac <jhlavac@redhat.com> Signed-off-by: Joel Stanley <joel.stanley@au1.ibm.com> Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/61862 Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com> Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com> Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com> Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/62830 Reviewed-by: William G. Hoffa <wghoffa@us.ibm.com>
Diffstat (limited to 'src/build/linker/linker.C')
-rw-r--r--src/build/linker/linker.C25
1 files changed, 16 insertions, 9 deletions
diff --git a/src/build/linker/linker.C b/src/build/linker/linker.C
index d00b56a98..fe5f651ea 100644
--- a/src/build/linker/linker.C
+++ b/src/build/linker/linker.C
@@ -5,8 +5,9 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2011,2017 */
+/* Contributors Listed Below - COPYRIGHT 2011,2018 */
/* [+] International Business Machines Corp. */
+/* [+] Jan Hlavac */
/* */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); */
@@ -198,8 +199,9 @@ struct Object
/**
* CTOR default
*/
- Object() : image(NULL), offset(0), base_addr(0), iv_output(NULL),
- text(), rodata(), data(), tls_module(-1) {}
+ Object() : image(NULL), text(), rodata(), data(), offset(0),
+ base_addr(0), iv_output(NULL), tls_module(-1) {}
+
/**
* CTOR
@@ -207,8 +209,8 @@ struct Object
* @param[in] i_out : output FILE handle
*/
Object(unsigned long i_baseAddr, FILE* i_out)
- : image(NULL), offset(0), base_addr(i_baseAddr), iv_output(i_out),
- text(), rodata(), data(), tls_module(-1) {}
+ : image(NULL), text(), rodata(), data(), offset(0),
+ base_addr(i_baseAddr), iv_output(i_out), tls_module(-1) {}
};
inline bool Object::isELF()
@@ -477,7 +479,7 @@ int main(int argc, char** argv)
bfd_putb64(count, temp64);
fwrite(temp64, sizeof(uint64_t), 1, objects[0].iv_output);
- for (int i = 0; i < all_relocations.size(); i++)
+ for (size_t i = 0; i < all_relocations.size(); i++)
{
bfd_putb64(all_relocations[i], temp64);
fwrite(temp64, sizeof(uint64_t), 1, objects[0].iv_output);
@@ -549,9 +551,9 @@ bool Object::read_object(const char* i_file)
}
if (NULL != s)
{
- s->name = bfd_get_section_name(image, image_section);
- s->vma_offset = bfd_get_section_vma(image, image_section);
- s->size = bfd_get_section_size(image_section);
+ s->name = bfd_get_section_name(image, image_section);
+ s->vma_offset = bfd_get_section_vma(image, image_section);
+ s->size = bfd_get_section_size(image_section);
bfd_malloc_and_get_section(image, image_section, &s->data);
@@ -635,6 +637,7 @@ bool Object::write_object()
modinfo << &name[(name.find_last_of("/")+1)] << ",0x"
<< std::hex << offset + base_addr << endl;
+ return true;
}
//-----------------------------------------------------------------------------
@@ -876,6 +879,8 @@ bool Object::perform_local_relocations()
cout << "\tRelocated " << i->addend << " at " << i->address << " to "
<< relocation << endl;
}
+
+ return true;
}
//-----------------------------------------------------------------------------
@@ -986,6 +991,8 @@ bool Object::perform_global_relocations()
throw range_error(oss.str());
}
}
+
+ return true;
}
//-----------------------------------------------------------------------------
OpenPOWER on IntegriCloud