Re: dynamic linking (broke in new snap)

Adam Lackorzynski <[email protected]>
Newsgroups gmane.comp.micro-kernel.l4.devel
Message-ID <[email protected]>
On Fri Apr 22, 2016 at 15:58:41 +0200, ba_f wrote:
> while migrating to the latest l4re-snapshot-2015123115, I run into an issue
> with dynamic linking.
> The code is tested on an older snapshot and works great, there.
> 
> Well, let's look at the simplified libmy.so and its output:

I tried to reproduce this but did not succeed. Here are the files that I
used. What do you see using those files?

Lib:
Makefile:
PKGDIR		?= ../..
L4DIR		?= $(PKGDIR)/../..

TARGET		= libt1.so
SRC_CC		= lib.cc

include $(L4DIR)/mk/lib.mk

lib.cc:
#include <l4/re/env>
#include <stdio.h>

int myInit();
int myInit(){
  
  L4::Cap<void> server = L4Re::Env::env()->get_cap<void>("123");
  printf("hi\n");
  return !server.is_valid();
} 


Program:
PKGDIR		?= ../..
L4DIR		?= $(PKGDIR)/../..

TARGET		= t1
MODE            = shared
SRC_CC		= main.cc
LIBS += -lt1

include $(L4DIR)/mk/prog.mk

main.cc:
int myInit();
int main()
{
  myInit();
  return 0;
}

> /* my.cc */
> #include <stdlib.h>
> #include <l4/sys/err.h>
> #include <l4/sys/types.h>
> #include <l4/re/env>
> #include <l4/re/util/cap_alloc>
> #include <l4/cxx/ipc_stream>
> #include <l4/re/dataspace>
> 
> #include "shared.h"
> 
> uint32_t myInit(){
> 
>   L4::Cap<Calc> server = L4Re::Env::env()->get_cap<Calc>("calc_server");
>   if (!server.is_valid())
>   {
> //  printf("Could not get server capability!\n");
>     return 1;
>   }
>   return 0;
> }
> 
> Ned says: Hi World!
> Ned: loading file: 'rom/my.cfg'
> Client  |
> Client  | : symbol 'l4re_global_env': can't resolve symbol
> 
> 
> When there is only one single printf() in myInit() I see this output:
> 
> Ned says: Hi World!
> Ned: loading file: 'rom/my.cfg'
> Client  |
> Client  | : symbol 'memcpy': can't resolve symbol
> Client  |
> Client  | : symbol 'puts': can't resolve symbol
> Client  |
> Client  | : symbol 'abort': can't resolve symbol
> 
> 
> Do I miss something in modules.list?

I think not because than there would be an earlier error.

> entry my
> roottask moe rom/my.cfg
> module ned
> module l4re
> module my.cfg
> module my_server
> module my_ldloader
> module libmy.so
> module libld-l4.so
> module libl4util.so
> module libl4sys.so
> module libl4sys-direct.so
> module libdl.so
> module lib4re.so
> module lib4re-util.so
> module libc_support_misc.so
> module libc_be_socket_noop.so
> module libc_be_l4refile.so
> module libc_be_l4re.so
> module libsupc++.so
> module libuc_c.so
> 



Adam
-- 
Adam                 [email protected]
  Lackorzynski         http://os.inf.tu-dresden.de/~adam/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.