Skip to contentSkip to conversation

Build shared library (.so) for Mini-OS

DISCUSSION Yiming Zhang 2 participants 2 messages Apr 8, 2013 – Apr 9, 2013

lore
Share & tools
lore
#0 lore raw

Dear all,

I want to realize dynamic library linking/loading for Mini-OS. The first step is to build a shared libc library (.so) from newlib-1.16.0. To achieve this, I modified the stubdom/Makefile to:

(i) build all obj files (libc_objs = *.o) with -fPIC option, and (ii) tried to do "gcc -shared -o libc.so $(libc_objs)"

However, the 2nd step cannot work because "string/memcpy.o" and "machine/x86_64/memcpy.o" both have a memcpy() function. Is there any way to build a shared libc library (.so) from newlib? (and how this problem is addressed for standard glibc?) Thank you!

Cheers,
Yiming

#1 lore raw
Quoted 3 lines · Yiming Zhang

Dear all,

I want to realize dynamic library linking/loading for Mini-OS.

Why? What is your eventual aim?

Quoted 11 lines

The first
step is to build a shared libc library (.so) from newlib-1.16.0. To achieve this, I modified the stubdom/Makefile to:

(i) build all obj files (libc_objs = *.o) with -fPIC option, and (ii) tried to do "gcc -shared -o libc.so $(libc_objs)"

However, the 2nd step cannot work because "string/memcpy.o" and "machine/x86_64/memcpy.o" both have a memcpy() function. Is there any way to build a shared libc library (.so) from newlib? (and how this problem is addressed for standard glibc?) Thank you!

I think you perhaps need to ask the newlib developers questions about newlib?

I don't know much about newlib but mini-os at least implements a single/static/monolithic kernel+application binary so I'm not sure how much use shared libraries will be -- minios has no filesystem support for one thing so I'm not sure where they would live.

Ian.