Bug 111298
Summary: | static linking results in warnings (and nonportable code) | ||||||
---|---|---|---|---|---|---|---|
Product: | Red Hat Enterprise Linux 3 | Reporter: | Need Real Name <rutt> | ||||
Component: | glibc | Assignee: | Jakub Jelinek <jakub> | ||||
Status: | CLOSED NOTABUG | QA Contact: | Brian Brock <bbrock> | ||||
Severity: | high | Docs Contact: | |||||
Priority: | medium | ||||||
Version: | 3.0 | CC: | barryn | ||||
Target Milestone: | --- | ||||||
Target Release: | --- | ||||||
Hardware: | i686 | ||||||
OS: | Linux | ||||||
Whiteboard: | |||||||
Fixed In Version: | Doc Type: | Bug Fix | |||||
Doc Text: | Story Points: | --- | |||||
Clone Of: | Environment: | ||||||
Last Closed: | 2003-12-01 22:49:41 UTC | Type: | --- | ||||
Regression: | --- | Mount Type: | --- | ||||
Documentation: | --- | CRM: | |||||
Verified Versions: | Category: | --- | |||||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
Cloudforms Team: | --- | Target Upstream Version: | |||||
Embargoed: | |||||||
Attachments: |
|
Description
Need Real Name
2003-12-01 20:24:53 UTC
Created attachment 96264 [details]
Example program
If a RHL9 built statically linked binary using NSS works on older glibcs, then you are just lucky, nothing else. It certainly will not work on all older glibcs, only on some and only under some circumstances. Statically linked programs which are not self-contained and depend on the installed glibc (be it because of using NSS or iconv (which both dlopen glibc internally), using dlopen directly or even using locale support) are really the least portable thing you can build. Dynamically linking is uncomparably more portable. You can link some libraries statically using -Bstatic -lfoo -lbar -Bdynamic, yet link against the crucial system libraries dynamically. The warnings were added so that everyone is aware of the problems with -static. For statically linked binaries using NSS/iconv/dlopen the dynamic linker needs to be compiled into the statically linked program, yet the shared libraries it loads come from a different glibc if the statically linked binary is moved onto a different system. This means the glibc private interface between the dynamic linker and libc.so/libpthread.so is exposed, but this interface is constantly changing (and has been changing for years in the past as well). So, the only supported way of using NSS/iconv/dlopen in statically linked programs is if they are compiled/linked against the same glibc as they are run with. |