Search Google

Tuesday, December 26, 2006

flat binary中的reloc從何而來? -- irc log

20:24 < cyu021> hi, I am studying how a flat binary is loaded into memory for its execution
20:24 < cyu021> and I found this statement "relocs = ntohl(hdr->reloc_count);"
20:24 < cyu021> I back trace the code and found hdr->reloc_count was obtain straight from the binary file
20:25 < cyu021> So my question is: how is "reloc_count" determined during compile time ?
20:28 < Phasip> cyu021, what struct is hdr?
20:29 < cyu021> Phasip: "hdr = ((struct flat_hdr *) bprm->buf); /* exec-header */"
20:30 < cyu021> so it's a pointer points to struct flat_hdr
21:34 < Phasip> dunno cyu021 =/
22:06 < robfitz> cyu021: Did you see http://www.beyondlogic.org/uClinux/bflt.htm ?
22:06 < robfitz> cyu021: Also have a look at bfd/elf32-bfin.c in the binutils source.
00:59 < cyu021> robfitz: thanks, I will take a good look at that before throwing out another question :-)

No comments: