Error: LD: symbol not found: '__data_start'

Christian Helmuth christian.helmuth at genode-labs.com
Mon Jun 14 09:34:25 CEST 2021


Hello Alexander,

On Sat, Jun 12, 2021 at 23:21:50 CEST, Alexander Tormasov via users wrote:
> when running test application I encounter a new problem of dynamic linker
> 
> [init -> test-go]   0x1000000 .. 0x10ffffff: linker area
> [init -> test-go] Error: LD: symbol not found: '__data_start'
> [init -> test-go] Error: Uncaught exception of type 'Linker::Not_found'
> 
> any ideas how to fix?
> 
> seems that main binary test-go do have a weak ref to this symbol as nm show:
>                  w __data_start
> in some places of new code appeared after 10.3 gcc I found
> extern const char __data_start[] __attribute__ ((weak));
> 
> where I can add it, in what ld script?

The following patch adds the symbol right at the beginning of the data
segment. I'm not certain that this is correct for your use case. Do
you have any reference to an official documentation or source that
specifies the use of this symbol?


 repos/base/src/ld/genode.ld     | 1 +
 repos/base/src/ld/genode_dyn.ld | 1 +
 2 files changed, 2 insertions(+)

diff --git a/repos/base/src/ld/genode.ld b/repos/base/src/ld/genode.ld
index db72891a67c..ef657a27278 100644
--- a/repos/base/src/ld/genode.ld
+++ b/repos/base/src/ld/genode.ld
@@ -54,6 +54,7 @@ SECTIONS
 
 	. = ALIGN(0x1000);
 
+	__data_start = .;
 	.data : {
 		/*
 		 * Leave space for parent capability parameters at start of data
diff --git a/repos/base/src/ld/genode_dyn.ld b/repos/base/src/ld/genode_dyn.ld
index 57ec92f0f6e..6913ada0479 100644
--- a/repos/base/src/ld/genode_dyn.ld
+++ b/repos/base/src/ld/genode_dyn.ld
@@ -109,6 +109,7 @@ SECTIONS
    * the same address within the page on the next page up.
    */
   . = ALIGN(0x1000);
+  __data_start = .;
   .root_cap : {
     /*
      * Leave space for parent capability parameters at start of data


Regards
-- 
Christian Helmuth
Genode Labs

https://www.genode-labs.com/ · https://genode.org/
https://twitter.com/GenodeLabs · /ˈdʒiː.nəʊd/

Genode Labs GmbH · Amtsgericht Dresden · HRB 28424 · Sitz Dresden
Geschäftsführer: Dr.-Ing. Norman Feske, Christian Helmuth



More information about the users mailing list