Bug 1433347
Summary: | glibc: Selective static linking of libm.a fails due to unresolved _dl_x86_cpu_features symbol | ||
---|---|---|---|
Product: | Red Hat Enterprise Linux 7 | Reporter: | Piyush Bhoot <pbhoot> |
Component: | glibc | Assignee: | glibc team <glibc-bugzilla> |
Status: | CLOSED WONTFIX | QA Contact: | qe-baseos-tools-bugs |
Severity: | medium | Docs Contact: | |
Priority: | unspecified | ||
Version: | 7.3 | CC: | ashankar, codonell, cww, fweimer, mnewsome, pbhoot, pfrankli |
Target Milestone: | rc | ||
Target Release: | --- | ||
Hardware: | x86_64 | ||
OS: | Linux | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | If docs needed, set a value | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2017-06-22 18:40:07 UTC | Type: | Bug |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: |
Description
Piyush Bhoot
2017-03-17 12:46:04 UTC
This is an upstream issue which we incorporated with x86_64-specific math library backports. Note that static linking is unsupported on Red Hat Enterprise Linux (as glibc-static is in the Optional channels). (In reply to Piyush Bhoot from comment #0) > Description of problem: > > In RHEL 7.3 libm fails to link statically > Demo program provided > > Version-Release number of selected component (if applicable): > glibc-static-2.17-157.el7.x86_64 > glibc-devel-2.17-157.el7.x86_64 > glibc-2.17-157.el7.x86_64 > > How reproducible: > Always > > Steps to Reproduce: > 1. > > #include <stdio.h> > #include <stdlib.h> > #include <math.h> > > int main(int argc, char **argv) > { > printf("string:%s\n",argv[1]); > float input=strtof(argv[1],NULL); > printf("input:%f\n",input); > float result; > result = sin(input); > printf("%f\n",result); > return 0; > } > > > 2. gcc test.c -Wl,-Bstatic -lm -Wl,-Bdynamic -lc > > Actual results: > > >gcc test.c -Wl,-Bstatic -lm -Wl,-Bdynamic -lc > /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libm.a(s_sin.o): In > function `__cos': > >gcc test.c -Wl,-Bstatic -lm -Wl,-Bdynamic -lc > /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libm.a(s_sin.o): In > function `__cos': > (.text+0x4682): undefined reference to `_dl_x86_cpu_features' > /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libm.a(s_sin.o): In > function `__sin': > (.text+0x46b2): undefined reference to `_dl_x86_cpu_features' > collect2: error: ld returned 1 exit status This is not supported. You would be mixing a static libm.a with future libc.so.6 and ld.so and that breaks the interdependencies between the core libraries which form "the implemetnation of the C runtime." Either the entire implementation of the runtime is statically linked or none of it is statically linked. You can't choose to link parts of it statically and not others because each part depends on the other to form a complete implementation. The math library is not a thin you can link against statically, it happens we have a libm.a, but that's an implementation detail. Please use '-static' for the entire application. What use case do you have for this? |