Ancient libgcc_s.so from external

25 views
Skip to first unread message

Waldek Kozaczuk

unread,
Nov 28, 2019, 3:18:48 PM11/28/19
to OSv Development
This is related to https://github.com/cloudius-systems/osv/issues/743.

I have been trying to eliminate ancient libgcc_s.so from usr.manifest.skel and replace it with the version from host. When I do that most (C++ only?) apps fail like so:

Cmdline: /java_isolated.so -cp /tests/java/tests.jar io.osv.TestDomainPermissions
/usr/lib/libgcc_s.so.1: ignoring missing symbol __cpu_indicator_init
/usr/lib/libgcc_s.so.1: ignoring missing symbol __cpu_model
trying to execute or access missing symbol
[backtrace]
0x000000004039d6ab <page_fault+267>
0x000000004039c486 <???+1077527686>
0x00000000403528ca <elf::program::init_library(int, char**)+362>
0x0000000040223cdd <osv::application::main()+61>
0x000000004042deb8 <???+1078124216>
0x000000004045fdb5 <???+1078328757>
0x00000000403f9ce7 <thread_main_c+39>
0x000000004039d402 <???+1077531650>

I somehow discovered it has to do with versioning. So when I undo my commit that fixed libnuma (see https://github.com/cloudius-systems/osv/commit/ed1eed7a567ec17138c65f0a5628c2311603c712). 

So if I manually undo these changes the error disappears. It is obviously related to these warnings:
/usr/lib/libgcc_s.so.1: ignoring missing symbol __cpu_indicator_init
/usr/lib/libgcc_s.so.1: ignoring missing symbol __cpu_model

What is actually going on? And what is the right fix?

I found couple of the things that might be related:


Waldek




Waldek Kozaczuk

unread,
Nov 30, 2019, 12:34:44 AM11/30/19
to OSv Development
Here is the change made to libgcc.so 4 years ago that seems to be causing this problem - https://github.com/gcc-mirror/gcc/commit/4b5fb32aba30762e0d8c9e75d1b46b47bee5eeb4.

These 2 missing (hidden with versioning) are present in libgcc.a:
readelf -s /usr/lib/gcc/x86_64-linux-gnu/9/libgcc.a | grep __cpu_indicator_init
    13: 0000000000000290   905 FUNC    GLOBAL HIDDEN     4 __cpu_indicator_init

We stopped linking libgcc.a as whole-archive year ago but even if we still did it would not help us given this symbol is hidden.

I wonder how we should solve it.

Waldek Kozaczuk

unread,
Nov 30, 2019, 1:16:46 PM11/30/19
to OSv Development
Or is the issue that given that __cpu_indicator_init is a constructor function that is in symver and  deprecated > 4.8 we should also skip calling deprecated INIT functions ?

--
You received this message because you are subscribed to a topic in the Google Groups "OSv Development" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/osv-dev/HZHzeG_5IqM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to osv-dev+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/osv-dev/e5b7c460-b7d5-438f-9001-5546f65c4894%40googlegroups.com.

Waldek Kozaczuk

unread,
Nov 30, 2019, 4:48:58 PM11/30/19
to OSv Development
We the extra debug printouts the crash looks like this:

ELF [tid:42, /usr/lib/libgcc_s.so.1]: Instantiated
ELF [tid:42, /usr/lib/libgcc_s.so.1]: The base set to: 0x00000000000a7000 and end: 0x00000000000c0450
ELF [tid:42, /usr/lib/libgcc_s.so.1]: Loading segments
ELF [tid:42, /usr/lib/libgcc_s.so.1]: Loaded and mapped PT_LOAD segment at: 0x00000000000a7000 of size: 0x3000
ELF [tid:42, /usr/lib/libgcc_s.so.1]: Loaded and mapped PT_LOAD segment at: 0x00000000000aa000 of size: 0x11000
ELF [tid:42, /usr/lib/libgcc_s.so.1]: Loaded and mapped PT_LOAD segment at: 0x00000000000bb000 of size: 0x4000
ELF [tid:42, /usr/lib/libgcc_s.so.1]: Loaded and mapped PT_LOAD segment at: 0x00000000000bf000 of size: 0x2000
ELF [tid:42, /usr/lib/libgcc_s.so.1]: Loading DT_NEEDED object: libc.so.6 
/usr/lib/libgcc_s.so.1: ignoring missing symbol __cpu_indicator_init
/usr/lib/libgcc_s.so.1: ignoring missing symbol __cpu_model
ELF [tid:42, /usr/lib/libgcc_s.so.1]: Relocated 10 symbols in DT_RELA
ELF [tid:42, /usr/lib/libgcc_s.so.1]: Relocated 45 PLT symbols in DT_JMPREL
ELF [tid:42, /usr/lib/libgcc_s.so.1]: versioned symbol table
ELF [tid:42, /java_isolated.so]: Loading DT_NEEDED object: libc.so.6 
ELF [tid:42, /java_isolated.so]: Relocated 469 symbols in DT_RELA
ELF [tid:42, /java_isolated.so]: Relocated 246 PLT symbols in DT_JMPREL
ELF [tid:42, /java_isolated.so]: versioned symbol table
ELF [tid:253, /usr/lib/libgcc_s.so.1]: Executing DT_INIT function
ELF [tid:253, /usr/lib/libgcc_s.so.1]: Finished executing DT_INIT function
ELF [tid:253, /usr/lib/libgcc_s.so.1]: Executing 2 DT_INIT_ARRAYSZ functions
trying to execute or access missing symbol
[backtrace]
0x00000000403aeb19 <page_fault+297>
0x00000000403ad8d6 <???+1077598422>
0x00000000403609fa <elf::program::init_library(int, char**)+362>
0x0000000040226237 <osv::application::main()+71>
0x000000004044406c <???+1078214764>
0x00000000404782b9 <???+1078428345>
0x000000004040f29b <thread_main_c+43>
0x00000000403ae852 <???+1077602386>

It looks like one of the 2 functions in DT_INIT_ARRAYSZ references one of the missing symbols (per versym). Probably __cpu_indicator_init.

So I wonder that instead of skipping deprecated symbols, we should tweak the versioning logic to make it find symbols IF referenced by the object itself. Other part of the Drepper's text - https://www.akkadia.org/drepper/symbol-versioning - seems to suggest that:

"vna_other
    Contains version index unique for the file which is used in the
    version symbol table.  If the highest bit (bit 15) is set this
    is a hidden symbol which cannot be referenced from outside the
    object."

To unsubscribe from this group and all its topics, send an email to osv-dev+unsubscribe@googlegroups.com.

Nadav Har'El

unread,
Dec 1, 2019, 6:10:18 AM12/1/19
to Waldek Kozaczuk, OSv Development
Sounds right. In general, the phrase "hidden symbol" usually means that it is hidden from other objects - not that it is completely unusable.
 
To unsubscribe from this group and all its topics, send an email to osv-dev+u...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "OSv Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to osv-dev+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/osv-dev/ca3133df-a5bf-42bb-84da-b1963aef3d3d%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages