Still cant get anything to show up in the Thread Local Storage Directory

jonwil@tpg.com.au jonwil@tpg.com.au
Wed Oct 15 01:43:00 GMT 2003


I added my code to _bfd_XXi_final_link_postscript() (which is where someone else
told me to add it)
but its not actually appearing in the output file.
Aparently, its because _bfd_XXi_swap_aouthdr_out() zeros out the directory.
So, the question is, how should I get the stuff to be saved between the call to
_bfd_XXi_final_link_postscript() and the actual output to the exe file.

_bfd_XXi_swap_aouthdr_out() actually contains code that saves idata2 and idata5
idata2 = pe->pe_opthdr.DataDirectory[1];
idata5 = pe->pe_opthdr.DataDirectory[12];

then restores them later after the directory has been zeroed out
extra->DataDirectory[1]  = idata2;
extra->DataDirectory[12] = idata5;

I tried to do the same thing for DataDirectory[9]  but it didnt seem to help (in
fact, DataDirectory[9] was 0 before it even got to the tls =
pe->pe_opthdr.DataDirectory[9]; line from what I could tell with some debug
print statements)

Also, one version of MingW binutils (the current official version) mentions this
local patch:
2002-08-25  Danny Smith 
	* peXXigen.c (_bfd_XXi_swap_aouthdr_out): Don't null out
	data directory entries.
	(Bug reported by Donn Terry ).
However, the change isnt in the current "candidate" version on sourceforge (for
whatever reason)

So, I need someone that knows a lot more than I do about libbfd to take a look
at this stuff and tell me just what is going on here and how to make things work.

Is the code like tls = pe->pe_opthdr.DataDirectory[9]; the best way to save and
restore it later?
Is there any reason to do the memset that zeroes out the DataDirectory at all?



More information about the Binutils mailing list