Bug 172810 - When using isspace etc from ctype.h the binary fails to link statically
Summary: When using isspace etc from ctype.h the binary fails to link statically
Keywords:
Status: CLOSED WORKSFORME
Alias: None
Product: Fedora
Classification: Fedora
Component: glibc
Version: 4
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Brian Brock
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2005-11-09 23:06 UTC by Håkon Løvdal
Modified: 2007-11-30 22:11 UTC (History)
0 users

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2005-11-18 10:32:58 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Håkon Løvdal 2005-11-09 23:06:41 UTC
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):
glibc-2.3.5-10.3

How reproducible:
Always

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'
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
gcc-4.0.1-4.fc4
prompt>rpm -qf /usr/include/ctype.h
glibc-headers-2.3.5-10.3
prompt>rpm -qf /lib/libc.so.6
glibc-2.3.5-10.3
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
prompt>


Actual Results:  link error

Expected Results:  no link error

Additional info:

Comment 1 Jakub Jelinek 2005-11-10 07:48:52 UTC
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);
}
0
glibc-2.3.5-10.3
glibc-devel-2.3.5-10.3

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 10:32:58 UTC
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.