Replacing assembly-implemented glibc functions to C-implemented, how to

Journeyer J. Joh oosaprogrammer@gmail.com
Sun Jul 1 12:51:00 GMT 2012


Hello list,

I am now checking all assembly-implemented parts from glibc.
I need to replace all of them with C funcions so that I can prepare an
architecture independent glibc.

In the header file cdefs.h ,in misc/sys of glibc, I found the macro __REDIRECT.

It seems that __REDIRECT redirects C function name to the Assembly
function name.

And there is a comment about this.

175 /* __asm__ ("xyz") is used throughout the headers to rename functions
176    at the assembly language level.  This is wrapped by the __REDIRECT
177    macro, in order to support compilers that can do this some other
178    way.  When compilers don't support asm-names at all, we have to do
179    preprocessor tricks instead (which don't have exactly the right
180    semantics, but it's the best we can do).
181
182    Example:
183    int __REDIRECT(setpgrp, (__pid_t pid, __pid_t pgrp), setpgid); */


But I cannot understand the exact meaning of the comment above.

Could someone explain me how I can get rid of all assembly-implemented
functions from glibc?

Should I enable the part below and add some plugin to the compiler?

202 /*
203 #elif __SOME_OTHER_COMPILER__
204
205 # define __REDIRECT(name, proto, alias) name proto; \
206         _Pragma("let " #name " = " #alias)
207 */
208 #endif


Thank you in advance!

Regards
Journeyer J. Joh

-- 
----------------------------------------
Journeyer J. Joh
o o s a p r o g r a m m e r
a t
g m a i l  d o t  c o m
----------------------------------------



More information about the Libc-help mailing list