7 Jul 21:24
Re: GSoC ShlibMemLoad
From: Andreas Kupries <andreask@...>
Subject: Re: GSoC ShlibMemLoad
Newsgroups: gmane.comp.lang.tcl.core
Date: 2008-07-07 19:24:37 GMT
Subject: Re: GSoC ShlibMemLoad
Newsgroups: gmane.comp.lang.tcl.core
Date: 2008-07-07 19:24:37 GMT
> >> > (**) In (one of) the other test libraries you are using a > for-loop and > >> > write to print the pid. If you encapsulate that into a function > >> > FOO to generally print unsigned numbers and then put FOO into the > >> > libprintf code you can print any number you need, like function > >> > addresses. Inside of rtld itself it is of course possible to use > >> > the working printf to print its address. > > > >> Because I have already studied this whole code for quite a long time > >> and have not came up with any solution I am thinking of writing an > >> email to John Polstra who is an author of the rtld for > >> FreeBSD. Maybe he will be able to help out. Do you think it is a > >> good idea? > > > > Yes. Getting the help of (one of) the original authors of some code is > > (in my opinion) a good idea. He should know the intricacies of the > > code. > > I wrote the email today in the morning. > > > >> Today I also wrote a simple program which generates defs.h file. > > > > That note I did not understand. Can you explain a bit more? > > I committed make_defs.c file which automatically generates file > elf-defs.h (the same as defs.h). > An argument for this program should be the program itself, like > ./make_defs make_defs Hm. Ok, the defs.h file is the header which contains all the definitions #define Elf_Half Elf32_Half #define Elf_Addr Elf32_Addr #define Elf_Rel Elf32_Rel etc. From the contents of the generator file make_defs.c I infer that you doing this to switch the code between 32 and 64 bit ELF systems (and possibly other ). Is that right ? What are (dis)advantages of this approach compared to the alternative of using a single defs.h file and preprocessor conditionals to switch between the possibilities ? I.e have one defs.h file containing, roughly: #ifdef USE_ELF_64 /* Or whatever other name sounds more appropriate */ # define Elf_Half Elf64_Half # define Elf_Addr Elf64_Addr # define Elf_Rel Elf64_Rel [...] #else /* 32 bit / default branch */ # define Elf_Half Elf32_Half # define Elf_Addr Elf32_Addr # define Elf_Rel Elf32_Rel [...] #endif and then using it like so gcc -DUSE_ELF_64 foo.c ... // on 64bit elf systems and gcc foo.c ... // on 32bit elf systems -- Andreas Kupries <andreask@...> Developer @ http://www.ActiveState.com Tel: +1 778-786-1122 ------------------------------------------------------------------------- Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08
RSS Feed