This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: having problems with my code in BFD
- From: Ian Lance Taylor <ian at wasabisystems dot com>
- To: Jonathan Wilson <jonwil at tpgi dot com dot au>
- Cc: binutils at sources dot redhat dot com
- Date: 13 Oct 2003 19:09:11 -0700
- Subject: Re: having problems with my code in BFD
- References: <3F8B576D.6000805@tpgi.com.au>
Jonathan Wilson <jonwil@tpgi.com.au> writes:
> patch for what I am working on is attatched.
> The printf I added to aid debugging does trigger and does output what
> it should be outputing.
> but when I run objdump -p on the resulting exe file, it tells me that
> entry 9 of the data directory is empty.
> Anyone know what could be going on here?
> Index: peXXigen.c
> ===================================================================
> RCS file: /cvs/src/src/bfd/peXXigen.c,v
> retrieving revision 1.16
> diff -u -r1.16 peXXigen.c
> --- peXXigen.c 7 Oct 2003 08:49:11 -0000 1.16
> +++ peXXigen.c 14 Oct 2003 01:48:20 -0000
> @@ -2024,6 +2024,18 @@
> - pe_data (abfd)->pe_opthdr.DataDirectory[12].VirtualAddress);
> }
>
> + h1 = coff_link_hash_lookup (coff_hash_table (info),
> + "__tls_used", FALSE, FALSE, TRUE);
> + if (h1 != NULL)
> + {
> + pe_data (abfd)->pe_opthdr.DataDirectory[9].VirtualAddress =
> + (h1->root.u.def.value
> + + h1->root.u.def.section->output_section->vma
> + + h1->root.u.def.section->output_offset);
> + pe_data (abfd)->pe_opthdr.DataDirectory[9].Size = 0x18;
> + printf("va %lx sz %lx\n",pe_data (abfd)->pe_opthdr.DataDirectory[9].VirtualAddress,pe_data (abfd)->pe_opthdr.DataDirectory[9].Size);
> + }
> +
> /* If we couldn't find idata$2, we either have an excessively
> trivial program or are in DEEP trouble; we have to assume trivial
> program.... */
Hmmm, for some reason _bfd_XXi_swap_aouthdr_out() appears to zero out
the DataDirectory entries, then fill them again in. Peculiar. Makes
one wonder what _bfd_XXi_final_link_postscript() is for.
Ian