Undefinded symbol __msync13

54 views
Skip to first unread message

Pierre Métras

unread,
Aug 12, 2016, 11:23:28 PM8/12/16
to minix3
Hello,

I get an "undefined reference to `__msync13'" error message when compiling the OCaml test suite and I've pinpointed the origin of this message to the use of the mmap function msync().

I've tried to understand Minix source code to understand how this function is defined and why it is not exported in the libraries but I must declare that's not clear in my mind and I'm reaching the limits of my knowledge on system calls.

Take the following small program:

~~ toto.c ~~~~~~~~~~

#include <stdio.h>
#include <sys/mman.h>

void toto(void * addr, unsigned int len)
{
  msync(addr, len, MS_ASYNC);
  printf("Hello Minix World!");
}

~~ end toto.c ~~~~~~~~~~

Compile it to create a shared library:

$ clang -fPIC -shared toto.c -o toto.so

and try to link it:

$ ld toto.so
ld: warning: cannot find entry symbol _start; defaulting to 08048171
toto.so: undefined reference to `__msync13'

If you remove the msync() call to keep only the printf() line, the "undefined reference" message disappears.

$ ld toto.so
ld: warning: cannot find entry symbol _start; defaulting to 08048171


What is the reason for this error and how can I correct it?

Thanks for any idea.
--
Pierre Métras

Sambuc Lionel

unread,
Aug 13, 2016, 2:07:22 AM8/13/16
to MINIX3 Google Group
Hello,


After a quick check, even on the latest development version, the msync system call has not yet been implemented on MINIX.
You can see the missing system calls list, which should be up to date:

https://github.com/Stichting-MINIX-Research-Foundation/minix/blob/master/minix/lib/libc/sys/MISSING_SYSCALLS

I can't say how much work it would be to add this system call. As far as I can see, this is basically a hook for user land
code to trigger a flush, which the system is already able to do.

At this point I don't know what is the simplest among:
1. get that implemented,
2. configure Ocaml so that it doesn't use this feature (if there is already a knob for that this would be for sure the fastest & simplest)
3. patch Ocaml to have a knob to disable the use of this.


Kind regards,

Lionel Sambuc
> --
> You received this message because you are subscribed to the Google Groups "minix3" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to minix3+un...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

David van Moolenbroek

unread,
Aug 13, 2016, 7:37:42 AM8/13/16
to minix3
Hello,


On Saturday, August 13, 2016 at 5:23:28 AM UTC+2, Pierre Métras wrote:
I get an "undefined reference to `__msync13'" error message when compiling the OCaml test suite and I've pinpointed the origin of this message to the use of the mmap function msync().

The msync(2) system call is not implemented on MINIX3 because this call only makes sense in the context of shared-writable file mappings (i.e.: memory-map a file and write into the mapped memory, and the changes will be written back to the file), and MINIX3 does not (yet) support shared-writable file mappings. As such, the fact that an application attempts to use msync(2) may indicate that it is not going to work on MINIX3 altogether at this point.

Regards,
David

Pierre Métras

unread,
Aug 14, 2016, 10:38:50 PM8/14/16
to minix3
Thanks Lionel and David,

I've been able to adapt OCaml code for a limited but usable support of mmap. One can't mmap shared files but is able to use private memory maps. 
I think I have a satisfying OCaml version now, presently running OCaml tests suite. Next step will be to have opam package manager and common libraries working and I'll document it on Minix3 wiki.

--
Pierre Métras

Sambuc Lionel

unread,
Aug 15, 2016, 2:31:56 AM8/15/16
to MINIX3 Google Group
Hi Pierre,


Awesome results! I can't wait to see the documentation / changes required. I might try to import them into pkgsrc[1], if this is possible.


Kind regards,

Lionel

[1] https://github.com/Stichting-MINIX-Research-Foundation/pkgsrc-ng/tree/3.4.0
Reply all
Reply to author
Forward
0 new messages