mirror of
https://github.com/genodelabs/genode.git
synced 2025-02-20 17:52:52 +00:00
base: Ignore empty constructors array.
This does not affect default Genode builds as far as I can tell. There is always at least one global static CTOR which seems to be coming from one of the GCC runtime libs bundled in the toolchain. The problem became visible for me only after I've replated GCC runtime with LLVM based one. In such setup I often see binaries that do not have any static ctors. Such binaries end up crashing Genode ld.lib.so. Make sure the code does handle empty constructors array. Fixes #4422
This commit is contained in:
parent
05e4993d2e
commit
58e0b24006
@ -61,6 +61,11 @@ namespace Genode {
|
||||
*/
|
||||
void call_global_static_constructors()
|
||||
{
|
||||
/* Don't do anything if there are no constructors to call */
|
||||
addr_t const ctors_size = (addr_t)&_ctors_end - (addr_t)&_ctors_start;
|
||||
if (ctors_size == 0)
|
||||
return;
|
||||
|
||||
void (**func)();
|
||||
for (func = &_ctors_end; func != &_ctors_start; (*--func)());
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user