Daniel Hans | 10 Jul 17:19

Re: GSoC ShlibMemLoad

Thank you very much. I am extremely grateful for his email ;-)

2008/7/10 Arnulf Wiedemann <arnulf@...>:
> Am Sonntag, 6. Juli 2008 22:02:19 schrieb Daniel Hans:
>> 2008/7/5 Andreas Kupries <akupries@...>:
>> >> > While walking to the office I managed to come up with a number of
>> >> > additional ideas ...
>> >> >
>> >> > printf is different from the other functions in two respects.
>> >> >
>> >> >        It takes a variable number of arguments,
>> >> > and     it operates at a higher IO level than write and consorts.
>> >> >
>> >> >        Both might be a possible source of the problem I guess.
>> >> >        Although I have no idea of how that could be.
>> >> >
>> >> > Things to consider:
>> >> >
>> >> >        - Does using 'sprintf()' (+write) work ?
>> >> >                sprintf is also varargs, but doesn't do any I/O
>> >>
>> >> sprintf does not work
>> >>
>> >> >        - Does 'fprintf()' work ?
>> >> >                It is like printf, i.e. varargs and highlevel I/O
>> >> >                However it explicitly takes an output argument.
>> >> >                printf (...) is like fprintf (stdout, ...).
>> >>
>> >> fprintf does not work
>> >>
>> >> >        - Does fflush() work?
>> >> >                Highlevel I/O, but no varargs. It is also outside
>> >> >                of the printf family of functions in general.
>> >>
>> >> fflush surprisingly works...
>> >> Anyway, the problem is not in varargs, because I also tried with
>> >> functions like putchar, puts, etc and they all does not work.
>> >
>> > Hm ... All these functions have lots of state ...
>> >
>> >
>> > Some leading questions ...
>> >
>> > You are using 'printf' in rtld itself to print log/debug messages, and
>> > it works there. What is the address of this 'printf' function ?
>> >
>> > Is the address of the 'printf' function seen by the loaded
>> > test-library the same ? (**)
>> >
>> > If not, why?
>>
>> These addresses differ. I am not sure why, but I think that printf in
>> log/debug messages uses printf from libc.so which was loaded at the
>> beginning of rtld execution by the regular dynamic loader and printf
>> in libprintf.so uses printf from libc.so loaded by
>> load_needed_objects.
>>
>> > Do you remember my comments about missing symbols ?
>> >
>> >        I.e.: The list of libraries we have in our rtld is the list of
>> >        memory-loaded libraries (ML/lib) and not of all libraries
>> >        (ALL/lib).
>> >
>> >        And a symbol not found in ML/lib has to be looked for in
>> >        ALL/lib too ?
>> >
>> > What does that same distinction mean for 'load_needed_objects' ?
>>
>> I think that load_needed_objects does not know anything about ALL/lib
>> and if our library needs another one it is loaded for the second time.
>> Anyway, all libraries I have tested needed just libc.so.
>>
>> > And (especially) a library like 'libc.so' which is loaded by the OS
>> > and thus in ALL/lib?
>> >
>> >
>> > (**) 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?
>>
>
> I have contacted John Polstra in the meantime, as I kow him personally from
> some project a lot of years ago, He will be happy to help you and answer your
> questions, also he is no longer active on that project as he has retired.
>
> His email address is: jdp@...
> Arnulf Wiedemann
>
>> Today I also wrote a simple program which generates defs.h file.
>>
>> Greetings,
>> Daniel
>>
>> -------------------------------------------------------------------------
>> 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
>> _______________________________________________
>> Tcl-Core mailing list
>> Tcl-Core@...
>> https://lists.sourceforge.net/lists/listinfo/tcl-core
>
>
>
> -------------------------------------------------------------------------
> 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
> _______________________________________________
> Tcl-Core mailing list
> Tcl-Core@...
> https://lists.sourceforge.net/lists/listinfo/tcl-core
>

-------------------------------------------------------------------------
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

Gmane