Bug 172810 - When using isspace etc from ctype.h the binary fails to link statically
When using isspace etc from ctype.h the binary fails to link statically
Product: Fedora
Classification: Fedora
Component: glibc (Show other bugs)
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
Brian Brock
Depends On:
  Show dependency treegraph
Reported: 2005-11-09 18:06 EST by Håkon Løvdal
Modified: 2007-11-30 17:11 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2005-11-18 05:32:58 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Håkon Løvdal 2005-11-09 18:06:41 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.12) Gecko/20050922 Fedora/1.0.7-1.1.fc4 Firefox/1.0.7

Description of problem:
When using isspace etc from ctype.h the binary fails to link statically.

I have not tried to change from compat_symbol to versioned_symbol and recompile like suggested at http://nixdoc.net/files/forum/about49448.html, but I feel it would be an error if I had to recompile glibc in order to link statically.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
prompt>cat main.c
#include <ctype.h>

int main(int argc, char *argv[])
        return isspace('A');

prompt>gcc -Wall main.c -o main
prompt>gcc -Wall -static main.c -o main
/tmp/ccCeNztK.o(.text+0x1d): In function `main':
main.c: undefined reference to `__ctype_b@GLIBC_2.0'
collect2: ld returned 1 exit status
prompt>gcc -Wall main.c -E | grep isspace
extern int isspace (int) __attribute__ ((__nothrow__));
prompt>gcc -Wall -static main.c -E | grep isspace
extern int isspace (int) __attribute__ ((__nothrow__));
prompt>rpm -q gcc
prompt>rpm -qf /usr/include/ctype.h
prompt>rpm -qf /lib/libc.so.6
prompt>objdump -T /lib/libc.so.6 | grep __ctype_b
00a1aa58 g    DF .text  0000003e  GLIBC_2.3   __ctype_b_loc
00b1e428 g    DO .data  00000004 (GLIBC_2.0)  __ctype_b

Actual Results:  link error

Expected Results:  no link error

Additional info:
Comment 1 Jakub Jelinek 2005-11-10 02:48:52 EST
Can't reproduce.  Are you sure you aren't preprocessing or compiling on some
old system (more than a couple of years old) and then linking on FC4?

gcc -Wall -static a.c -E | grep -A3 main; gcc -static -o a a.c; ./a; echo $?; rpm
-q glibc glibc-devel
int main(int argc, char *argv[])
 return ((*__ctype_b_loc ())[(int) (('A'))] & (unsigned short int) _ISspace);

readelf -Ws /usr/lib/libc.a | grep __ctype_b
     6: 00000000    50 FUNC    GLOBAL DEFAULT    1 __ctype_b_loc
Comment 2 Jakub Jelinek 2005-11-18 05:32:58 EST
No feedback provided, closing as WORKSFORME, as I can't reproduce it.

Note You need to log in before you can comment on or make changes to this bug.