diff options
author | Danny Smith <dannysmith@users.sourceforge.net> | 2006-01-31 22:13:41 +0000 |
---|---|---|
committer | Danny Smith <dannysmith@users.sourceforge.net> | 2006-01-31 22:13:41 +0000 |
commit | 4b5bd4e780a4e43e5adb63d4fa50c348a1bafdce (patch) | |
tree | 21b8ba376834e3b59107c8509370c17a439ee68e | |
parent | a8d701fd09ed1ce8afaf1a5892f3b37c078a6864 (diff) | |
download | gdb-4b5bd4e780a4e43e5adb63d4fa50c348a1bafdce.zip gdb-4b5bd4e780a4e43e5adb63d4fa50c348a1bafdce.tar.gz gdb-4b5bd4e780a4e43e5adb63d4fa50c348a1bafdce.tar.bz2 |
* NEWS: mention support for forward exports in PE-COFF dll's.
* ld.texinfo: Expand documentation of EXPORT statements in
PE-COFF .def files.
-rw-r--r-- | ld/ChangeLog | 6 | ||||
-rw-r--r-- | ld/NEWS | 3 | ||||
-rw-r--r-- | ld/ld.texinfo | 59 |
3 files changed, 64 insertions, 4 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog index e5e5355..f06eade 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,9 @@ +2006-01-31 Danny Smith dannysmith@users.sourceforge.net + + * NEWS: Mention support for forward exports in PE-COFF dll's. + * ld.texinfo: Expand documentation of EXPORT statements in + PE-COFF .def files. + 2006-01-31 Filip Navara <navaraf@reactos.com> * deffile.h (struct def_file_export): Add field flag_forward. @@ -1,5 +1,8 @@ -*- text -*- +* PE-COFF: Forward exports from DLL's can now be specified in .def files + passed directly to ld. + * Support for the Z80 processor family has been added. * Add support for the "@<file>" syntax to the command line, so that extra diff --git a/ld/ld.texinfo b/ld/ld.texinfo index 3c0a101..4f809f3 100644 --- a/ld/ld.texinfo +++ b/ld/ld.texinfo @@ -5581,17 +5581,68 @@ Using a DEF file turns off the normal auto-export behavior, unless the Here is an example of a DEF file for a shared library called @samp{xyz.dll}: @example -LIBRARY "xyz.dll" BASE=0x10000000 +LIBRARY "xyz.dll" BASE=0x20000000 EXPORTS foo bar _bar = bar +another_foo = abc.dll.afoo +var1 DATA @end example -This example defines a base address and three symbols. The third -symbol is an alias for the second. For the complete format -specification see ld/deffilep.y in the binutils sources. +This example defines a DLL with a non-default base address and five +symbols in the export table. The third exported symbol @code{_bar} is an +alias for the second. The fourth symbol, @code{another_foo} is resolved +by "forwarding" to another module and treating it as an alias for +@code{afoo} exported from the DLL @samp{abc.dll}. The final symbol +@code{var1} is declared to be a data object. + +The complete specification of an export symbol is: + +@example +EXPORTS + ( ( ( <name1> [ = <name2> ] ) + | ( <name1> = <module-name> . <external-name>)) + [ @@ <integer> ] [NONAME] [DATA] [CONSTANT] [PRIVATE] ) * +@end example + +Declares @samp{<name1>} as an exported symbol from the DLL, or declares +@samp{<name1>} as an exported alias for @samp{<name2>}; or declares +@samp{<name1>} as a "forward" alias for the symbol +@samp{<external-name>} in the DLL @samp{<module-name>}. +Optionally, the symbol may be exported by the specified ordinal +@samp{<integer>} alias. + +The optional keywords that follow the declaration indicate: + +@code{NONAME}: Do not put the symbol name in the DLL's export table. It +will still be exported by its ordinal alias (either the value specified +by the .def specification or, otherwise, the value assigned by the +linker). The symbol name, however, does remain visible in the import +library (if any), unless @code{PRIVATE} is also specified. + +@code{DATA}: The symbol is a variable or object, rather than a function. +The import lib will export only an indirect reference to @code{foo} as +the symbol @code{_imp__foo} (ie, @code{foo} must be resolved as +@code{*_imp__foo}). + +@code{CONSTANT}: Like @code{DATA}, but put the undecorated @code{foo} as +well as @code{_imp__foo} into the import library. Both refer to the +read-only import address table's pointer to the variable, not to the +variable itself. This can be dangerous. If the user code fails to add +the @code{dllimport} attribute and also fails to explicitly add the +extra indirection that the use of the attribute enforces, the +application will behave unexpectedly. + +@code{PRIVATE}: Put the symbol in the DLL's export table, but do not put +it into the static import library used to resolve imports at link time. The +symbol can still be imported using the @code{LoadLibrary/GetProcAddress} +API at runtime or by by using the GNU ld extension of linking directly to +the DLL without an import library. + +See ld/deffilep.y in the binutils sources for the full specification of +other DEF file statements @cindex creating a DEF file While linking a shared dll, @command{ld} is able to create a DEF file |