|
éíñ
a.out - æopÍaÔ ÆaÊÌa, ÐoÌyÞaeÍoÇo × peÚyÌØÔaÔe paÂoÔÙ
ÐpoÇpaÍÍ acceÍÂÌÉpo×aÎÉÑ É peÄaËÔopa c×ÑÚeÊ.
ïðéóáîéå
A.out Ñ×ÌÑeÔcÑ peÚyÌØÔÉpyÀÝÉÍ ÆaÊÌoÍ ÐocÌe Úa×epÛeÎÉÑ paÂoÔÙ
ÐpoÇpaÍÍ acceÍÂÌepa masm É peÄaËÔopa c×ÑÚeÊ ld. EcÌÉ ×
ÐpoÃecce paÂoÔÙ ËaÖÄoÊ ÉÚ ÜÔÉx ÐpoÇpaÍÍ Îe ÂÙÌÉ oÂÎapyÖeÎÙ
oÛÉÂËÉ ÉÌÉ ÎeoÐpeÄeÌeÎÎÙe ÇÌoÂaÌØÎÙe ÐepeÍeÎÎÙe, ÂyÄeÔ
coÚÄaÎ ÆaÊÌ fa.out.
æopÍaÔ ÆaÊÌa a.out, ÎaÚÙ×aeÍÙÊ ÔaËÖe x.out ÉÌÉ ceÇÍeÎÔÉpo×aÎÎÙÊ x.out, oÐpeÄeÌÑeÔcÑ ÆaÊÌaÍÉ /usr/include/a.out.h É /usr/include/sys/relsym.h. æaÊÌ a.out ÉÍeeÔ cÌeÄyÀÝÉe ocÎo×ÎÙe ÞacÔÉ:
B ceÇÍeÎÔÉpo×aÎÎoÍ ÆopÍaÔe ÍoÇyÔ cyÝecÔ×o×aÔØ ÎecËoÌØËo ceÇÍeÎÔo× ÔeËcÔo× É ÄaÎÎÙx, × Úa×ÉcÉÍocÔÉ oÔ ÍoÄeÌÉ ÐaÍÑÔÉ ÐpoÇpaÍÍÙ. CeÇÍeÎÔÙ × ÆaÊÌe ÎaÞÉÎaÀÔcÑ c aÄpeca, ËpaÔÎoÇo paÚÍepy cÔpaÎÉÃÙ ÆaÊÌa (512 ÂaÊÔ).
æOPíAô
/* *OcÎo×ÎoÊ É ÄoÐoÌÎÉÔeÌØÎÙÊ ÚaÇoÌo×oË cÔpyËÔyp. *äÌÑ ceÇÍeÔÉpo×aÎÎoÇo ÆopÍaÔa x.out (XE_SEG): * 1)ÐoÌÑ, ÍapËÉpo×aÎÎÙe (s) ÄoÌÖÎÙ * coÄepÖaÔØ cyÍÍy ×cex xs_psize, ecÌÉ oÂpaÚ ÎaxoÄÉÔcÑ Îa ÄÉcËe * ÉÌÉ xs_vsize ÄÌÑ oÂpaÚa ÐaÍÑÔÉ. * 2)coÄepÖÉÍoe oÂÌacÔeÊ, ÍapËÉpo×aÎÎÙx * (u) ÎeoÐpeÄeÌeÎo. */ struct xexec{ /*ÚaÇoÌo×oË x.out*/ unsigned short x_magic; /*ÍaÇÉÞecËoe ÞÉcÌo*/ unsigned short x_ext; /*paÚÍep ÄoÐoÌÎÉÔeÌØÎoÇo ÚaÇoÌo×Ëa*/ long X-Text; /*paÚÍep ceÇÍeÎÔa ÔeËcÔa (s)*/ long x_data; /*paÚÍep ÉÎÉÃÉaÌÉÚÉpo×aÎÎÙx ÄaÎÎÙx (s)*/ long x_bss; /*paÚÍep ÎeÉÎÉÃÉaÌÉÚÉpo×aÎÎÙx ÄaÎÎÙx (s)*/ long syms; /*paÚÍep ÔaÂÌÉÃÙ cÉÍ×oÌo× (s)*/ long x_reloc; /*ÄÌÉÎa ÔaÂÌÉÃÙ ÐepeÍeÝeÎÉÊ (s)*/ long x_entry; /*ÍaÛÉÎÎo Úa×ÉcÉÍaÑ ÔoÞËa ×xoÄa*/ char x_cpu; /*ÔÉÐ ÐpoÃeccopa É ÐopÑÄoË ÂaÊÔ/cÌo×o*/ char x_relsym; /*ÆopÍÔ ÐepeÍeÝeÎÉÊ É cÉÍ×oÌo× (u)*/ unsigned short x_renv; /* cpeÄa ×ÙÐoÌÎeÎÉÑ*/ }; struct xext { /* ÄoÐoÌÎÉÔeÌØÎÙÊ ÚaÇoÌo×oË x.out */ long xe_trsize; /* paÚÍep ÔaÂÌÉÃÙ ÐepeÍeÝeÎÉÊ ÔeËcÔa (s) */ long xe_drsize; /* paÚÍep ÔaÂÌÉÃÙ ÐepeÍeÝeÎÉÊ ÄaÎÎÙx (s) */ long xe_tbase; /* ÂaÚa ÐepeÍeÝaeÍoÇo ÔeËcÔa(u) */ long xe_dbase; /* ÂaÚa ÐepeÍeÝaeÍÙx ÄaÎÎÙx(u) */ long xe_stksize; /* paÚÍep cÔeËa (ecÌÉ XE_FS ycÔaÎo×ÌeÎ) */ /* cÌeÄyÀÝÉe ÄaÌee ÜÌeÍeÎÔÙ ÄoÌÖÎÙ ÂÙÔØ ÐpeÄcÔa×ÌeÎÙ ecÌÉ XE_SEG ycÔaÎo×ÌeÎ */ long xe_segpos; /* ÐoÌoÖeÎÉe ÔaÂÌÉÃÙ ceÇÍeÎÔo× */ long xe_segsize; /* paÚÍep ÔaÂÌÉÃÙ ceÇÍeÎÔo× */ long xe_mdtpos; /* ÍaÛÉÎÎo Úa×ÉcÉÍoe ÐoÌoÖeÎÉe */ long xe_mdtsize; /* ÍaÛÉÎÎo Úa×ÉcÉÍÙÊ paÚÍep ÔaÂÌÉÃÙ */ char xe_mdttype; /* ÍaÛÉÎÎo Úa×ÉcÉÍÙÊ ÔÉÐ ÔaÂÌÉÃÙ */ char xe_pagesize; /* paÚÍep cÔpaÎÉÃÙ ÆaÊÌa, ËpaÔÎoe 512 */ char xe_ostype; /* ÔÉÐ oÐepaÃÉoÎÎoÊ cÉcÔeÍÙ */ char xe_osvers; /* ×epcÉÑ oÐepaÃÉoÎÎoÊ cÉcÔeÍÙ */ unsigned short xe_eseg; /*ceÇÍeÎÔ ×xoÄa, Úa×ÉcÉÍÙÊ oÔ aÐÐapaÔypÙ */ unsigned short xe_sres; /* peÚep×Épo×aÎ */ }; struct xseg { /* ÔaÂÌÉÃa ceÇÍeÎÔo× x.out */ unsigned short xs_type; /*ÔÉÐ ceÇÍeÎÔa */ unsigned short xs_attr; /*aÔpÉÂyÔÙ ceÇÍeÎÔa */ unsigned short xs_seg; /*ÎoÍep ceÇÍeÎÔa */ char xs_align; /* ÌoÇapÉÆÍ Ðo ocÎo×aÎÉÀ 2 oÔ ×Ùpa×ÎÉ×aÎÉÑ */ char xs_cres; /* ÎeÉcÐoÌØÚyeÔcÑ*/ long xs_filpos; /* ÐoÌoÖeÎÉe ÆaÊÌa */ long xs_psize; /* ÆÉÚÉÞecËÉÊ paÚÍep (× ÆaÊÌe) */ long xs_vsize; /* ×ÉpÔyaÌØÎÙÊ paÚÍep (in core) */ long xs_rbase; /* aÄpec/cÍeÝeÎÉe ÂaÚÙ ÐepeÍeÝeÎÉÑ */ unsigned short xs_noff; /* cÍeÝeÎÉe Äo ÉÍeÎÉ ceÇÍÎÔa × ÔaÂÌÉÃe ceÇÍeÎÔo× ceÇÍeÎÔa */ unsigned short xs_sres; /* ÎeÉcÐoÌØÚyeÔcÑ*/ long xs_lres; /* ÎeÉcÐoÌØÚyeÔcÑ */ }; struct xiter { /* ÚaÐÉcØ Ðo×ÔopeÎÉÊ x.out */ long xi_size; /* source byte count */ long xi_rep; /* replication count */ long xi_offset; /* destination offset in segment */ }; struct xlist { /* xlist cÔpyËÔypa ÄÌÑ xlist(3). */ unsigned short xl_type; /* ÔÉÐ cÉÍ×oÌa */ unsigned short xl_seg; /* ÉÎÄeËc ÔaÂÌÉÃÙ ceÇÍeÎÔa ÆaÊÌa */ long xl_value; /* ×eÌÉÞÉÎa cÉÍ×oÌa */ char *xl_name; /* yËaÚaÔeÌØ Îa ÉÍÑ, oÇpaÎÉÞeÎÎoe ÎyÌeÍ */ }; struct aexec { /* ÚaÇoÌo×oË a.out */ unsigned short xa_magic; /* ÍaÇÉÞecËoe ÞÉcÌo */ unsigned short xa_text; /* paÚÍep ceÇÍeÎÔa ÔeËcÔa*/ unsigned short xa_data; /* paÚÍep ÉÎÉÃÉaÌÉÚÉpo×aÎÎÙx ÄaÎÎÙx */ unsigned short xa_bss; /* paÚÍep ÎeÉÎÉÃÉaÌÉÚÉpo×aÎÎÙx ÄaÎÎÙx */ unsigned short xa_syms; /* paÚÍep ÔaÂÌÉÃÙ cÉÍ×oÌo× */ unsigned short xa_entry; /* ÔoÞËa ×xoÄa */ unsigned short xa_unused; /* Îe ÉcÐoÌØÚyeÔcÑ */ unsigned short xa_flag; /* ÆÌaÇ oÔcyÔc×ÉÑ ÔaÂÌÉÃÙ ÉÍeÎ */ }; struct nlist { /* nlist cÔpyËÔypa ÄÌÑ nlist(3). */ char n_name[8]; /* ÉÍÑ cÉÍ×oÌa */ int n_type; /* ÆÌaÇ ÔÉÐa*/ unsigned n_value; /* ×eÌÉÞÉÎa */ }; struct bexec { /* ÚaÇoÌo×oË b.out */ long xb_magic; /* ÍaÇÉÞecËoe ÞÉcÌo */ long xb_text; /* paÚÍep ceÇÍeÎÔa ÔeËcÔa*/ long xb_data; /* paÚÍep ceÎÍeÎÔa ÄaÎÎÙx*/ long xb_bss; /* paÚÍep ÎeÉÎÉÃÉaÌÉÚÉpo×aÎÎÙx ÄaÎÎÙx */ long xb_syms; /* paÚÍep ÔaÂÌÉÃÙ cÉÍ×oÌo×*/ long xb_trsize; /* paÚÍep ÔaÂÌÉÃÙ ÐepeÍeÝeÎÉÑ ÔeËcÔa*/ long xb_drsize; /* paÚÍep ÔaÂÌÉÃÙ ÐepeÍeÝeÎÉÑ ÄaÎÎÙx*/ long xb_entry; /* ÔoÞËa ×xoÄa*/ };
óí. ôáëöå
masm(1), ld(1), nm(1), strip(1), xlist(1).
|