Operating System - HP-UX
1753499 Members
4463 Online
108794 Solutions
New Discussion

Thread Local Storage mismatch symbol for: config_fd

 
sachi_naik
Occasional Contributor

Thread Local Storage mismatch symbol for: config_fd

Hello,

 

We have a executable file which gets HBA related data from HPUX machine.

 

The executable is created in two parts, one hba.c and another hbalib.cpp.

hba.c just calls functions inside hbalib.cpp and prints the details onto screen.

 

When we execute this on one specific HPUX machine, the program aborts with signal 6. And below error message is thrown on to screen :

Thread Local Storage mismatch symbol for: config_fd

 

We noticed that the moment first function call from hbalib.cpp is called, the core dump happens.

 

We also noticed that below similar issue is fixed in patch :

Patch Name: PHSS_35385

Patch Description: s700_800 11.11 ld(1) and linker tools cumulative patch

Issue fixed : /usr/lib/dld.sl: Thread Local Storage mismatch symbol for: HP_OGL_VAPI_TLS (coredump)

 

I've attached the stack trace details got via gdb with this thread...

 

This looks like linker problem. Can anyone please help me with this issue...

 

PS:

Both the build machine and the target machine are HPUX 11.31 PARISC boxes.

 

Thanks in advance

Sachi

9 REPLIES 9
Dennis Handly
Acclaimed Contributor

Re: Thread Local Storage mismatch symbol for: config_fd

Is config_fd declared as __thread in all sources?

 

>Patch Name: PHSS_35385

 

Do you have that patch or later installed?

 

>I've attached the stack trace details got via gdb with this thread.

 

Pretty useless, only the error message is useful.

sachi_naik
Occasional Contributor

Re: Thread Local Storage mismatch symbol for: config_fd

I do not have the source of the library.

 

But I have the nm output:

 

Symbols from /usr/lib/libhbaapifcdmt.sl:

Name                    Value   Scope  Type    Subspace
config_fd           |         0|extern|data   |$TDATA$

$$mul12U            |     15792|extern|milli  |$MILLICODE$
$$mul2U             |     15320|extern|milli  |$MILLICODE$
calloc              |     20692|uext  |stub   |
close               |          |undef |code   |
close               |     18912|uext  |stub   |
config              |1074327376|static|data   |$BSS$
config_fd           |         0|extern|data   |$TDATA$
create_tape_passthru|     31264|static|entry  |$CODE$
devnm               |          |undef |code   |
...
..
.

 

Does this help in figuring out why I am getting the error.

config_fd seems to be either undefined or it is defined somewhere else and during linking it will be resolved.

 

 

Thanks and Best Regards

Sachi

Dennis Handly
Acclaimed Contributor

Re: Thread Local Storage mismatch symbol for: config_fd

>config_fd seems to be either undefined or it is defined somewhere else

 

You need to find the definition and then compare.  You can use this to scan for mass quantities:

nm -pxNA path/lib* path2/lib* ... | grep config_fd

sachi_naik
Occasional Contributor

Re: Thread Local Storage mismatch symbol for: config_fd

I quickly ran this command and found the following :

 

/opt/snia/demos - multix$ nm -pxNA /usr/lib/hpux32/lib* /usr/lib/hpux64/lib* /usr/lib/lib* /usr/lib/pa20_64/lib* | grep config_fd
/usr/lib/libIO.1:   0x40003350 D  config_fd
/usr/lib/libIO.sl:  0x40003350 D  config_fd
/usr/lib/libIOmt.1: 0x00000010 D  config_fd
/usr/lib/libIOmt.sl:0x00000010 D  config_fd
/usr/lib/libcra.1:  0x40004718 D  config_fd
/usr/lib/libcra.sl: 0x40004718 D  config_fd
/usr/lib/libhbaapifcd.sl:0x40005978 D  config_fd
/usr/lib/libhbaapihp.sl:0x400021c0 D  config_fd
/usr/lib/libicod.sl:0x4005e2e8 D  config_fd
/usr/lib/liblvml.sl:0x4002c758 D  config_fd
/usr/lib/libvparusr.1:0x40001bc0 D  config_fd
/usr/lib/libvparusr.sl:0x40001bc0 D  config_fd
/usr/lib/libvrascmd.sl:0x4003b710 D  config_fd
/usr/lib/libvxddl.sl:0x40026e60 D  config_fd
/usr/lib/libvxscsi.sl:0x400030f0 D  config_fd
0x8000000100002a08 d  /usr/lib/pa20_64/libIO.1:config_fd
0x8000000100002a08 d  /usr/lib/pa20_64/libIO.sl:config_fd
0x8000000100000010 l  /usr/lib/pa20_64/libIOmt.1:config_fd
0x8000000100000010 l  /usr/lib/pa20_64/libIOmt.sl:config_fd
0x8000000100003db8 D  /usr/lib/pa20_64/libcra.1:config_fd
0x8000000100003db8 D  /usr/lib/pa20_64/libcra.sl:config_fd
0x8000000100005268 D  /usr/lib/pa20_64/libhbaapifcd.sl:config_fd
0x80000001000019f0 D  /usr/lib/pa20_64/libhbaapihp.sl:config_fd
0x800000010002e0a0 D  /usr/lib/pa20_64/liblvml.sl:config_fd
0x8000000100001218 D  /usr/lib/pa20_64/libvparusr.1:config_fd
0x8000000100001218 D  /usr/lib/pa20_64/libvparusr.sl:config_fd
/opt/snia/demos - multix$

 

Does this mean the symbol is defined in libhbaapifcd.sl ?

 

In the code first shl_open is done for libhbaapifcd.sl and all the function pointers are loaded into a table and then we initialize the library using one of the function provided iniside the library.

 

Then the same is done for libhbaapifcdmt.sl.

 

At this point there is a core dump saying "/usr/lib/dld.sl: Thread Local Storage mismatch symbol for: config_fd"

 

Thanks and Best Regards

Sachi

Dennis Handly
Acclaimed Contributor

Re: Thread Local Storage mismatch symbol for: config_fd

>I quickly ran this command and found the following

 

If you have a 32 bit app, don't include the pa20_64 directories.

And leave out hpux32/ hpux64/ as these are Integrity only.

 

>Does this mean the symbol is defined in libhbaapifcd.sl?

 

Usually that's what "D" means but we need to do more commands.

I.e. leave out that -p, just use: -xNA

 

Also when linking use:  -Wl,-t -Wl,-yconfig_fd

 

Looking at my system, I see a whole bunch of shlibs where it is NOT TLS and some where it is:

/usr/lib/libIO.1:config_fd|0x40003350|extern|data   |$SHORTDATA$
/usr/lib/libIO.sl:config_fd|0x40003350|extern|data   |$SHORTDATA$
/usr/lib/libIOmt.1:config_fd|0x00000010|extern|data   |$TDATA$
/usr/lib/libIOmt.sl:config_fd|0x00000010|extern|data   |$TDATA$
/usr/lib/libcra.1:config_fd|0x40004800|extern|data   |$SHORTDATA$
/usr/lib/libcra.sl:config_fd|0x40004800|extern|data   |$SHORTDATA$
/usr/lib/libhbaapifcd.sl:config_fd|0x40005978|extern|data   |$SHORTDATA$
/usr/lib/libhbaapihp.sl:config_fd|0x400021c0|extern|data   |$SHORTDATA$
/usr/lib/libicod.sl:config_fd|0x4005e2e8|extern|data   |$SHORTDATA$
/usr/lib/liblvml.sl:config_fd|0x4002c758|extern|data   |$SHORTDATA$
/usr/lib/libvparusr.1:config_fd|0x40001cc0|extern|data   |$SHORTDATA$
/usr/lib/libvparusr.sl:config_fd|0x40001cc0|extern|data   |$SHORTDATA$

 

So /usr/lib/libIOmt.sl is the only shlib that will work with yours but that symbol isn't exported.

 

Also, since these are shlibs, nm(1) is the wrong tool to use, you need odump(1):

$ odump -slexportlist /usr/lib/lib* | grep -e config_fd -e "Export List from"
Export List from /usr/lib/libcra.1:
Export List from /usr/lib/libcra.sl:
000000003 -00000001  00002 0x40004800  Data  000000,155  00 config_fd
Export List from /usr/lib/libhbaapifcd.sl:
Export List from /usr/lib/libhbaapihp.sl:
000000003 -00000001  00001 0x400021c0  Data  000000,155  00 config_fd
Export List from /usr/lib/libicod.sl:
Export List from /usr/lib/liblvml.sl:
000000015 -00000001  00019 0x4002c758  Data  000000,155  00 config_fd
Export List from /usr/lib/libvparusr.1:
Export List from /usr/lib/libvparusr.sl:
000000003 -00000001  00003 0x40001cc0  Data  000000,155  00 config_fd

 

Unfortunately none of these are marked as TLS, so this may not be the right option.

It appears that "00" needs to be "10" before it is TLS.

 

You may want to use this only your shlibs:

odump -slimportlist /usr/lib/lib* | grep -e config_fd -e "Export List from" -e "Import List from"

sachi_naik
Occasional Contributor

Re: Thread Local Storage mismatch symbol for: config_fd

If you have a 32 bit app, don't include the pa20_64 directories.

And leave out hpux32/ hpux64/ as these are Integrity only.

 

> Not including both pa20_64 and hpux32/64 libraries

 

Also when linking use:  -Wl,-t -Wl,-yconfig_fd

 

> The executable shl_open the libraries in code and then call one of the function inside it to initialize the library.

First it opens /usr/lib/libhbaapihp.sl, then /usr/lib/libhbaapifcd.sl and then tries to shl_open the library /usr/lib/libhbaapifcdmt.sl and core dumps with the error:

/usr/lib/dld.sl: Thread Local Storage mismatch symbol for: config_fd

 None of the libraries are dynamically linked during the creation of the executable, they are simply shl_open'ed and a generica initializer function in them is called.

 

 

 

  You may want to use this only your shlibs:

odump -slimportlist /usr/lib/lib* | grep -e config_fd -e "Export List from" -e "Import List from"

 

> you mean to say, i can only shl_open the libraries which shows that it has config_fd when the above command is run ?

 

Thanks and Best Regards

Sachi

Dennis Handly
Acclaimed Contributor

Re: Thread Local Storage mismatch symbol for: config_fd

> I can only shl_open the libraries which shows that it has config_fd when the above command is run?

 

What I mean is some of the shlibs have config_fd as __thread and some do not.  This is the cause of the mismatch error.

sachi_naik
Occasional Contributor

Re: Thread Local Storage mismatch symbol for: config_fd

I understood.

 

You mean to say one library is saying its a external "shortdata" and another is saying its a external "tdata".

 

Hence the linker is throwing the error that symbol mismatch for config_fd.

 

We do not need to load the multithreaded version of libhbaapifcd.sl. I guess skipping it will resolve the issue.

 

Thanks and Best Regards

Sachi

 

 

 

 

Dennis Handly
Acclaimed Contributor

Re: Thread Local Storage mismatch symbol for: config_fd

>You mean to say one library is saying it's an external "shortdata" and another is saying it's an external "tdata".

 

Yes,  a mismatch.

 

>Hence the linker is throwing the error that symbol mismatch for config_fd.

 

(Actually dynamic loader, not linker.)

 

>We do not need to load the multithreaded version of libhbaapifcd.sl. 

 

Sounds good.