This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [bfd] RFC: support to get data from import/export tables [especially PE files]


On Thu, Nov 08, 2007 at 11:12:46AM +0000, Nick Clifton wrote:
> Hi Jakub,
> 
> >I'm missing functionality to get data from import/export tables.
> 
> Presumably you mean this from the point of view of an application that is 
> using the BFD library to handle file containing these tables, rather than 
> from the point of view of code running inside the BFD library.

Yes ;)

> Good luck with this, and if you have specific questions please do not 
> hesitate to ask them on this list.

Thx.
I've got question how to introduce new functions in bfd.
I haven't seen any doc about it.

First of all I think I need to create in targets.c some macro:
#v+
+.  {* Entry points to read import/ export tables (?). *}
+.#define BFD_JUMP_TABLE_IMPORT(NAME) \
+.  NAME##_imports_get_shared_objects, \
+.  NAME##_imports_get, \
+.  NAME##_exports_get, \
+.  NAME##_imports_print\
+.  /* more will follow... */
+.
+.  {* Called to read import table of object file *}
+.  bfd_boolean (*_bfd_import_get_shared_objects) (bfd *, void *, bfd_imports_shared_callback);
+.
+.  /* more will follow, it just to show idea. */
+.
#v-

[I don't have gift for nameing functions ;/
 And also I've question: 
 maybe instead of creating new BFD_JUMP_TABLE() 
 I've should add these function to BFD_JUMP_TABLE() which already exists?)
]

and than in each declared bfd_target 
I should do:
 BFD_JUMP_TABLE_IMPORT(_bfd_noimports) when i don't implement support for it.

and BFD_JUMP_TABLE_IMPORT(mytarget) when I implement support for it?

(For now (when I want only implement support for it in PE targets)

in _ALL_ bfd_target's do: BFD_JUMP_TABLE_IMPORT(_bfd_noimports)
[these _bfd_noimports_* function SHOULD exists or they could be macros
to bfd_true() bfd_false() or bfd_nullvoidptr() with typecast?
Where I should define them?]

and in peicode.h 
	(which is included from coffcode.h [when COFF_WITH_PE is set])
do:

#define _bfd_noimports_imports_get_shared_objects	_bfd_pe_bfd_imports_get_dlls
#define _bfd_noimports_imports_get			_bfd_pe_bfd_imports_get
etc...

Am I right?

I'd be grateful for any tips.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]