This is the mail archive of the libc-help@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Adding a function to glibc?


Actually, it looks like no!

I'm compiling this way:
gcc -nostdinc -I/usr/src/libc/inst2/include
-I/usr/lib/gcc/i586-redhat-linux/4.4.0/include test.c

My installation folder is called "inst2". But, the -Wl,--verbose
option shows that it's trying with the old ones:

==================================================
attempt to open /usr/lib/gcc/i586-redhat-linux/4.4.0/../../../crt1.o succeeded
/usr/lib/gcc/i586-redhat-linux/4.4.0/../../../crt1.o
attempt to open /usr/lib/gcc/i586-redhat-linux/4.4.0/../../../crti.o succeeded
/usr/lib/gcc/i586-redhat-linux/4.4.0/../../../crti.o
attempt to open /usr/lib/gcc/i586-redhat-linux/4.4.0/crtbegin.o succeeded
/usr/lib/gcc/i586-redhat-linux/4.4.0/crtbegin.o
attempt to open /tmp/ccaVfOMm.o succeeded
/tmp/ccaVfOMm.o
attempt to open /usr/lib/gcc/i586-redhat-linux/4.4.0/libgcc.so failed
attempt to open /usr/lib/gcc/i586-redhat-linux/4.4.0/libgcc.a succeeded
attempt to open /usr/lib/gcc/i586-redhat-linux/4.4.0/libgcc_s.so succeeded
-lgcc_s (/usr/lib/gcc/i586-redhat-linux/4.4.0/libgcc_s.so)
attempt to open /usr/lib/gcc/i586-redhat-linux/4.4.0/libc.so failed
attempt to open /usr/lib/gcc/i586-redhat-linux/4.4.0/libc.a failed
attempt to open /usr/lib/gcc/i586-redhat-linux/4.4.0/libc.so failed
attempt to open /usr/lib/gcc/i586-redhat-linux/4.4.0/libc.a failed
attempt to open /usr/lib/gcc/i586-redhat-linux/4.4.0/../../../libc.so succeeded
opened script file /usr/lib/gcc/i586-redhat-linux/4.4.0/../../../libc.so
opened script file /usr/lib/gcc/i586-redhat-linux/4.4.0/../../../libc.so
attempt to open /lib/libc.so.6 succeeded
/lib/libc.so.6
attempt to open /usr/lib/libc_nonshared.a succeeded
(/usr/lib/libc_nonshared.a)elf-init.oS
attempt to open /lib/ld-linux.so.2 succeeded
/lib/ld-linux.so.2
attempt to open /usr/lib/gcc/i586-redhat-linux/4.4.0/libgcc.so failed
attempt to open /usr/lib/gcc/i586-redhat-linux/4.4.0/libgcc.a succeeded
attempt to open /usr/lib/gcc/i586-redhat-linux/4.4.0/libgcc_s.so succeeded
-lgcc_s (/usr/lib/gcc/i586-redhat-linux/4.4.0/libgcc_s.so)
attempt to open /usr/lib/gcc/i586-redhat-linux/4.4.0/crtend.o succeeded
/usr/lib/gcc/i586-redhat-linux/4.4.0/crtend.o
attempt to open /usr/lib/gcc/i586-redhat-linux/4.4.0/../../../crtn.o succeeded
/usr/lib/gcc/i586-redhat-linux/4.4.0/../../../crtn.o
ld-linux.so.2 needed by /lib/libc.so.6
found ld-linux.so.2 at /lib/ld-linux.so.2
/tmp/ccaVfOMm.o: In function `main':
test.c:(.text+0x11): undefined reference to `putct'
collect2: ld returned 1 exit status


On Wed, Oct 21, 2009 at 6:51 PM, Mike Frysinger <vapier@gentoo.org> wrote:
> On Wednesday 21 October 2009 18:45:31 Almohri, Hussain wrote:
>> I'm doing some tests on glibc. I'd like to add new functions to it. For a
>> test, I create a file and put a simple function putct in it and just for
>> testing I put it in stdlib folder.
>> I added the function name to the routines section of the Makefile. In the
>> header file stdlib/stdlib.h, I added this line: extern int putct(int c);
>>
>> I also added the function in stdlib/Versions
>>
>> I run make and make install. Everything was OK. But when I write a sample
>> program to test this function, gcc says:
>>
>> /tmp/ccq6R9BD.o: In function `main':
>> test.c:(.text+0x11): undefined reference to `putct'
>> collect2: ld returned 1 exit status
>
> make sure the function is exported in the new libc.so (use `readelf -s` to
> see)
>
>> I already pointed to the modified library when running gcc.
>
> are you sure you're linking against the new one ? ?use -Wl,--verbose to see
> the files that the linker is actually using.
> -mike
>

Am I compiling the wrong way?


-- 
Hussain Almohri


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]