mirror of
git://git.savannah.gnu.org/libtool.git
synced 2025-01-12 14:06:37 +08:00
* NEWS: mention fixes
* doc/PLATFORMS: GNU/Hurd update * depdemo: make use of variables * ltconfig.in: use CC -E when checking for ELF support on NetBSD (reported by Todd Vierling <tv@pobox.com>), replace all occurences of 'linkopts' with 'linker_flags' * ltmain.in: move ltdll.c and impgen.c to ltconfig.in and only add them to the libtool script if it's necessary * ltconfig.in: add support for UnixWare 7.X.X * doc/PLATFORMS: add new platforms * doc/libtool.texi: document use of noinst_LTLIBRARIES for convenience libraries * ltconfig.in: check for freebsdelf3, not just freebsd3. Set hardcode_into_libs=yes for FreeBSD 3.0 and 3.1 * ltmain.in: enable workaround for freebsdelf3.0 * ltconfig.in: export_dynamic_flag_spec is -rdynamic on BSD/OS
This commit is contained in:
parent
f5480b5c13
commit
7cc892b2c9
30
ChangeLog
30
ChangeLog
@ -1,3 +1,33 @@
|
||||
1999-08-24 Thomas Tanner <tanner@ffii.org>
|
||||
|
||||
* NEWS: mention fixes
|
||||
* doc/PLATFORMS: GNU/Hurd update
|
||||
* depdemo: make use of variables
|
||||
* ltconfig.in: use CC -E when checking for ELF support
|
||||
on NetBSD (reported by Todd Vierling <tv@pobox.com>),
|
||||
replace all occurences of 'linkopts' with 'linker_flags'
|
||||
* ltmain.in: move ltdll.c and impgen.c to ltconfig.in and
|
||||
only add them to the libtool script if it's necessary
|
||||
|
||||
1999-08-24 Boyd Gerber <gerberb@zenez.com>
|
||||
|
||||
* ltconfig.in: add support for UnixWare 7.X.X
|
||||
* doc/PLATFORMS: add new platforms
|
||||
|
||||
1999-08-24 Pavel Roskin <pavel_roskin@geocities.com>
|
||||
|
||||
* doc/libtool.texi: document use of noinst_LTLIBRARIES for
|
||||
convenience libraries
|
||||
|
||||
* ltconfig.in: check for freebsdelf3, not just freebsd3.
|
||||
Set hardcode_into_libs=yes for FreeBSD 3.0 and 3.1
|
||||
|
||||
* ltmain.in: enable workaround for freebsdelf3.0
|
||||
|
||||
1999-08-24 Bert Driehuis <bert_driehuis@nl.compuware.com>
|
||||
|
||||
* ltconfig.in: export_dynamic_flag_spec is -rdynamic on BSD/OS
|
||||
|
||||
1999-08-07 Alexandre Oliva <oliva@dcc.unicamp.br>
|
||||
|
||||
* libltdl/COPYING.LIB: Update to version 2.1.
|
||||
|
2
NEWS
2
NEWS
@ -2,7 +2,7 @@ NEWS - list of user-visible changes between releases of GNU Libtool
|
||||
|
||||
New in 1.3d: 1999-??-??; CVS version 1.3c, Libtool team:
|
||||
* Start of support code for cross-compiling to win32.
|
||||
* Improved support for mingw32.
|
||||
* Improved support for mingw32, NetBSD, FreeBSD and Unixware.
|
||||
* New --with-pic flag to control the generation of PIC/non-PIC code.
|
||||
* New --build flag to ltconfig to help with build cross compilation
|
||||
environments is inherited from --build flag passed to configure.
|
||||
|
@ -20,16 +20,17 @@ USA. */
|
||||
#include "l1/l1.h"
|
||||
#include <stdio.h>
|
||||
|
||||
int var_l1;
|
||||
int var_l1 = 0;
|
||||
|
||||
int
|
||||
func_l1(indent)
|
||||
int indent;
|
||||
{
|
||||
int i;
|
||||
|
||||
|
||||
for (i = 0; i < indent; i++)
|
||||
putchar(' ');
|
||||
printf("l1\n");
|
||||
printf("l1 (%i)\n", var_l1);
|
||||
var_l1++;
|
||||
return 0;
|
||||
}
|
||||
|
@ -22,17 +22,18 @@ USA. */
|
||||
#include "l1/l1.h"
|
||||
#include <stdio.h>
|
||||
|
||||
int var_l2;
|
||||
int var_l2 = 0;
|
||||
|
||||
int
|
||||
func_l2(indent)
|
||||
int indent;
|
||||
{
|
||||
int i;
|
||||
|
||||
|
||||
for (i = 0; i < indent; i++)
|
||||
putchar(' ');
|
||||
printf("l2\n");
|
||||
printf("l2 (%i)\n", var_l2);
|
||||
func_l1(indent+1);
|
||||
var_l2 += var_l1;
|
||||
return 0;
|
||||
}
|
||||
|
@ -23,18 +23,19 @@ USA. */
|
||||
#include "l2/l2.h"
|
||||
#include <stdio.h>
|
||||
|
||||
int var_l3;
|
||||
int var_l3 = 0;
|
||||
|
||||
int
|
||||
func_l3(indent)
|
||||
int indent;
|
||||
{
|
||||
int i;
|
||||
|
||||
|
||||
for (i = 0; i < indent; i++)
|
||||
putchar(' ');
|
||||
printf("l3\n");
|
||||
printf("l3 (%i)\n", var_l3);
|
||||
func_l1(indent+1);
|
||||
func_l2(indent+1);
|
||||
var_l3 += var_l1 + var_l2;
|
||||
return 0;
|
||||
}
|
||||
|
@ -26,20 +26,21 @@ USA. */
|
||||
#include <math.h>
|
||||
#endif
|
||||
|
||||
int var_l4;
|
||||
int var_l4 = 0;
|
||||
|
||||
int
|
||||
func_l4(indent)
|
||||
int indent;
|
||||
{
|
||||
int i;
|
||||
|
||||
|
||||
for (i = 0; i < indent; i++)
|
||||
putchar(' ');
|
||||
printf("l4\n");
|
||||
printf("l4 (%i)\n", var_l4);
|
||||
func_l3(indent+1);
|
||||
for (i = 0; i <= indent; i++)
|
||||
putchar(' ');
|
||||
printf("libm [sin(1.5) = %f]\n", sin(1.5));
|
||||
var_l4 += var_l3;
|
||||
return 0;
|
||||
}
|
||||
|
@ -32,5 +32,7 @@ main (argc,argv)
|
||||
func_l1(0);
|
||||
func_l2(0);
|
||||
func_l4(0);
|
||||
if (var_l1 + var_l2 + var_l4 != 20)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ i*86-*-freebsd2.2.8 gcc 1.3c ok
|
||||
i*86-*-freebsd2.2.6 gcc 1.3b ok
|
||||
(egcs-1.1 & gcc-2.7.2.1, native ld)
|
||||
i*86-*-freebsd2.1.5 gcc 0.5 ok
|
||||
i*86-*-gnu gcc 1.3.3 ok
|
||||
i*86-*-gnu gcc 1.3c ok (1.602)
|
||||
i*86-*-netbsd1.4 gcc 1.3c ok
|
||||
(egcs-1.1.1)
|
||||
i*86-*-netbsd1.3.3 gcc 1.3c ok
|
||||
@ -68,6 +68,14 @@ i*86-*-solaris2.5.1 gcc 1.2f ok
|
||||
i*86-ncr-sysv4.3.03 gcc 1.2f ok
|
||||
i*86-ncr-sysv4.3.03 cc 1.2e ok
|
||||
(cc -Hnocopyr)
|
||||
i*86-pc-sco3.2v5.0.5 cc 1.3c ok
|
||||
i*86-pc-sco3.2v5.0.5 gcc 1.3c ok
|
||||
(gcc 95q4c)
|
||||
i*86-pc-sco3.2v5.0.5 gcc 1.3c ok
|
||||
(egcs-1.1.2)
|
||||
i*86-UnixWare7.1.0-sysv5 cc 1.3c ok
|
||||
i*86-UnixWare7.1.0-sysv5 gcc 1.3c ok
|
||||
(egcs-1.1.1)
|
||||
m68k-next-nextstep3 gcc 1.2f NS
|
||||
m68k-sun-sunos4.1.1 gcc 1.2f NS
|
||||
(gcc-2.5.7)
|
||||
|
@ -1025,6 +1025,10 @@ libraries. But be careful not to link a single convenience library,
|
||||
directly or indirectly, into a single program or library, otherwise you
|
||||
may get errors about symbol redefinitions.
|
||||
|
||||
When GNU automake is used, you should use @code{noinst_LTLIBRARIES}
|
||||
instead of @code{lib_LTLIBRARIES} for convenience libraries, so that
|
||||
the @samp{-rpath} option is not passed when they are linked.
|
||||
|
||||
As a rule of thumb, link a libtool convenience library into at most one
|
||||
libtool library, and never into a program, and link libtool static
|
||||
convenience libraries only into programs, and only if you need to carry
|
||||
|
202
ltconfig.in
202
ltconfig.in
@ -1337,7 +1337,7 @@ EOF
|
||||
allow_undefined_flag=unsupported
|
||||
# Joseph Beckenbach <jrb3@best.com> says some releases of gcc
|
||||
# support --undefined. This deserves some investigation. FIXME
|
||||
archive_cmds='$CC -nostart $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib'
|
||||
archive_cmds='$CC -nostart $libobjs $deplibs $linker_flags ${wl}-soname $wl$soname -o $lib'
|
||||
else
|
||||
ld_shlibs=no
|
||||
fi
|
||||
@ -1408,12 +1408,11 @@ EOF
|
||||
;;
|
||||
|
||||
netbsd*)
|
||||
if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
|
||||
if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
|
||||
archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
|
||||
archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
|
||||
else
|
||||
archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
|
||||
# can we support soname and/or expsyms with a.out? -oliva
|
||||
fi
|
||||
;;
|
||||
|
||||
@ -1431,8 +1430,8 @@ EOF
|
||||
|
||||
EOF
|
||||
elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
|
||||
archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib'
|
||||
archive_expsym_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
|
||||
archive_cmds='$CC -shared $libobjs $deplibs $linker_flags ${wl}-soname $wl$soname -o $lib'
|
||||
archive_expsym_cmds='$CC -shared $libobjs $deplibs $linker_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
|
||||
else
|
||||
ld_shlibs=no
|
||||
fi
|
||||
@ -1707,6 +1706,12 @@ else
|
||||
fi
|
||||
;;
|
||||
|
||||
unixware7* | sysv5*)
|
||||
archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
|
||||
runpath_var='LD_RUN_PATH'
|
||||
hardcode_shlibpath_var=no
|
||||
;;
|
||||
|
||||
*)
|
||||
ld_shlibs=no
|
||||
;;
|
||||
@ -1836,6 +1841,7 @@ bsdi4*)
|
||||
file_magic_test_file=/shlib/libc.so
|
||||
sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
|
||||
sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
|
||||
export_dynamic_flag_spec=-rdynamic
|
||||
# the default ld.so.conf also contains /usr/contrib/lib and
|
||||
# /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
|
||||
# libtool to hard-code these into programs
|
||||
@ -1881,9 +1887,13 @@ freebsd*)
|
||||
esac
|
||||
shlibpath_var=LD_LIBRARY_PATH
|
||||
case "$host_os" in
|
||||
freebsd2* | freebsd3.[01]*)
|
||||
freebsd2*)
|
||||
shlibpath_overrides_runpath=yes
|
||||
;;
|
||||
freebsd3.[01]* | freebsdelf3.[01]*)
|
||||
shlibpath_overrides_runpath=yes
|
||||
hardcode_into_libs=yes
|
||||
;;
|
||||
*) # from 3.2 on
|
||||
shlibpath_overrides_runpath=no
|
||||
hardcode_into_libs=yes
|
||||
@ -3170,6 +3180,186 @@ fi
|
||||
EOF
|
||||
;;
|
||||
esac
|
||||
case "$host" in
|
||||
*-*-cygwin* | *-*-mingw* | *-*-os2*)
|
||||
cat <<EOF >> "$ofile"
|
||||
# This is a source program that is used to create dlls on Windows
|
||||
# Don't remove nor modify the starting and closing comments
|
||||
# /* ltdll.c starts here */
|
||||
# #define WIN32_LEAN_AND_MEAN
|
||||
# #include <windows.h>
|
||||
# #undef WIN32_LEAN_AND_MEAN
|
||||
# #include <stdio.h>
|
||||
#
|
||||
# #ifndef __CYGWIN__
|
||||
# # ifdef __CYGWIN32__
|
||||
# # define __CYGWIN__ __CYGWIN32__
|
||||
# # endif
|
||||
# #endif
|
||||
#
|
||||
# #ifdef __cplusplus
|
||||
# extern "C" {
|
||||
# #endif
|
||||
# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved);
|
||||
# #ifdef __cplusplus
|
||||
# }
|
||||
# #endif
|
||||
#
|
||||
# #ifdef __CYGWIN__
|
||||
# #include <cygwin/cygwin_dll.h>
|
||||
# DECLARE_CYGWIN_DLL( DllMain );
|
||||
# #endif
|
||||
# HINSTANCE __hDllInstance_base;
|
||||
#
|
||||
# BOOL APIENTRY
|
||||
# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved)
|
||||
# {
|
||||
# __hDllInstance_base = hInst;
|
||||
# return TRUE;
|
||||
# }
|
||||
# /* ltdll.c ends here */
|
||||
# This is a source program that is used to create import libraries
|
||||
# on Windows for dlls which lack them. Don't remove nor modify the
|
||||
# starting and closing comments
|
||||
# /* impgen.c starts here */
|
||||
# /* Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is part of GNU libtool.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
# */
|
||||
#
|
||||
# #include <stdio.h> /* for printf() */
|
||||
# #include <unistd.h> /* for open(), lseek(), read() */
|
||||
# #include <fcntl.h> /* for O_RDONLY, O_BINARY */
|
||||
# #include <string.h> /* for strdup() */
|
||||
#
|
||||
# /* O_BINARY isn't required (or even defined sometimes) under Unix */
|
||||
# #ifndef O_BINARY
|
||||
# #define O_BINARY 0
|
||||
# #endif
|
||||
#
|
||||
# static unsigned int
|
||||
# pe_get16 (fd, offset)
|
||||
# int fd;
|
||||
# int offset;
|
||||
# {
|
||||
# unsigned char b[2];
|
||||
# lseek (fd, offset, SEEK_SET);
|
||||
# read (fd, b, 2);
|
||||
# return b[0] + (b[1]<<8);
|
||||
# }
|
||||
#
|
||||
# static unsigned int
|
||||
# pe_get32 (fd, offset)
|
||||
# int fd;
|
||||
# int offset;
|
||||
# {
|
||||
# unsigned char b[4];
|
||||
# lseek (fd, offset, SEEK_SET);
|
||||
# read (fd, b, 4);
|
||||
# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);
|
||||
# }
|
||||
#
|
||||
# static unsigned int
|
||||
# pe_as32 (ptr)
|
||||
# void *ptr;
|
||||
# {
|
||||
# unsigned char *b = ptr;
|
||||
# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);
|
||||
# }
|
||||
#
|
||||
# int
|
||||
# main (argc, argv)
|
||||
# int argc;
|
||||
# char *argv[];
|
||||
# {
|
||||
# int dll;
|
||||
# unsigned long pe_header_offset, opthdr_ofs, num_entries, i;
|
||||
# unsigned long export_rva, export_size, nsections, secptr, expptr;
|
||||
# unsigned long name_rvas, nexp;
|
||||
# unsigned char *expdata, *erva;
|
||||
# char *filename, *dll_name;
|
||||
#
|
||||
# filename = argv[1];
|
||||
#
|
||||
# dll = open(filename, O_RDONLY|O_BINARY);
|
||||
# if (!dll)
|
||||
# return 1;
|
||||
#
|
||||
# dll_name = filename;
|
||||
#
|
||||
# for (i=0; filename[i]; i++)
|
||||
# if (filename[i] == '/' || filename[i] == '\\' || filename[i] == ':')
|
||||
# dll_name = filename + i +1;
|
||||
#
|
||||
# pe_header_offset = pe_get32 (dll, 0x3c);
|
||||
# opthdr_ofs = pe_header_offset + 4 + 20;
|
||||
# num_entries = pe_get32 (dll, opthdr_ofs + 92);
|
||||
#
|
||||
# if (num_entries < 1) /* no exports */
|
||||
# return 1;
|
||||
#
|
||||
# export_rva = pe_get32 (dll, opthdr_ofs + 96);
|
||||
# export_size = pe_get32 (dll, opthdr_ofs + 100);
|
||||
# nsections = pe_get16 (dll, pe_header_offset + 4 +2);
|
||||
# secptr = (pe_header_offset + 4 + 20 +
|
||||
# pe_get16 (dll, pe_header_offset + 4 + 16));
|
||||
#
|
||||
# expptr = 0;
|
||||
# for (i = 0; i < nsections; i++)
|
||||
# {
|
||||
# char sname[8];
|
||||
# unsigned long secptr1 = secptr + 40 * i;
|
||||
# unsigned long vaddr = pe_get32 (dll, secptr1 + 12);
|
||||
# unsigned long vsize = pe_get32 (dll, secptr1 + 16);
|
||||
# unsigned long fptr = pe_get32 (dll, secptr1 + 20);
|
||||
# lseek(dll, secptr1, SEEK_SET);
|
||||
# read(dll, sname, 8);
|
||||
# if (vaddr <= export_rva && vaddr+vsize > export_rva)
|
||||
# {
|
||||
# expptr = fptr + (export_rva - vaddr);
|
||||
# if (export_rva + export_size > vaddr + vsize)
|
||||
# export_size = vsize - (export_rva - vaddr);
|
||||
# break;
|
||||
# }
|
||||
# }
|
||||
#
|
||||
# expdata = (unsigned char*)malloc(export_size);
|
||||
# lseek (dll, expptr, SEEK_SET);
|
||||
# read (dll, expdata, export_size);
|
||||
# erva = expdata - export_rva;
|
||||
#
|
||||
# nexp = pe_as32 (expdata+24);
|
||||
# name_rvas = pe_as32 (expdata+32);
|
||||
#
|
||||
# printf ("EXPORTS\n");
|
||||
# for (i = 0; i<nexp; i++)
|
||||
# {
|
||||
# unsigned long name_rva = pe_as32 (erva+name_rvas+i*4);
|
||||
# printf ("\t%s @ %ld ;\n", erva+name_rva, 1+ i);
|
||||
# }
|
||||
#
|
||||
# return 0;
|
||||
# }
|
||||
# /* impgen.c ends here */
|
||||
|
||||
EOF
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
# Append the ltmain.sh script.
|
||||
sed '$q' "$ltmain" >> "$ofile" || (rm -f "$ofile"; exit 1)
|
||||
|
177
ltmain.in
177
ltmain.in
@ -512,7 +512,7 @@ compiler."
|
||||
|
||||
# If we have no pic_flag, then copy the object into place and finish.
|
||||
if (test -z "$pic_flag" || test "$pic_mode" != default) &&
|
||||
test "$build_old_libs" = yes; then
|
||||
test "$build_old_libs" = yes; then
|
||||
# Rename the .lo from within objdir to obj
|
||||
if test -f $obj; then
|
||||
$show $rm $obj
|
||||
@ -649,179 +649,6 @@ compiler."
|
||||
# -no-undefined on the libtool link line when we can be certain
|
||||
# that all symbols are satisfied, otherwise we get a static library.
|
||||
allow_undefined=yes
|
||||
|
||||
# This is a source program that is used to create dlls on Windows
|
||||
# Don't remove nor modify the starting and closing comments
|
||||
# /* ltdll.c starts here */
|
||||
# #define WIN32_LEAN_AND_MEAN
|
||||
# #include <windows.h>
|
||||
# #undef WIN32_LEAN_AND_MEAN
|
||||
# #include <stdio.h>
|
||||
#
|
||||
# #ifndef __CYGWIN__
|
||||
# # ifdef __CYGWIN32__
|
||||
# # define __CYGWIN__ __CYGWIN32__
|
||||
# # endif
|
||||
# #endif
|
||||
#
|
||||
# #ifdef __cplusplus
|
||||
# extern "C" {
|
||||
# #endif
|
||||
# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved);
|
||||
# #ifdef __cplusplus
|
||||
# }
|
||||
# #endif
|
||||
#
|
||||
# #ifdef __CYGWIN__
|
||||
# #include <cygwin/cygwin_dll.h>
|
||||
# DECLARE_CYGWIN_DLL( DllMain );
|
||||
# #endif
|
||||
# HINSTANCE __hDllInstance_base;
|
||||
#
|
||||
# BOOL APIENTRY
|
||||
# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved)
|
||||
# {
|
||||
# __hDllInstance_base = hInst;
|
||||
# return TRUE;
|
||||
# }
|
||||
# /* ltdll.c ends here */
|
||||
# This is a source program that is used to create import libraries
|
||||
# on Windows for dlls which lack them. Don't remove nor modify the
|
||||
# starting and closing comments
|
||||
# /* impgen.c starts here */
|
||||
# /* Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is part of GNU libtool.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
# */
|
||||
#
|
||||
# #include <stdio.h> /* for printf() */
|
||||
# #include <unistd.h> /* for open(), lseek(), read() */
|
||||
# #include <fcntl.h> /* for O_RDONLY, O_BINARY */
|
||||
# #include <string.h> /* for strdup() */
|
||||
#
|
||||
# /* O_BINARY isn't required (or even defined sometimes) under Unix */
|
||||
# #ifndef O_BINARY
|
||||
# #define O_BINARY 0
|
||||
# #endif
|
||||
#
|
||||
# static unsigned int
|
||||
# pe_get16 (fd, offset)
|
||||
# int fd;
|
||||
# int offset;
|
||||
# {
|
||||
# unsigned char b[2];
|
||||
# lseek (fd, offset, SEEK_SET);
|
||||
# read (fd, b, 2);
|
||||
# return b[0] + (b[1]<<8);
|
||||
# }
|
||||
#
|
||||
# static unsigned int
|
||||
# pe_get32 (fd, offset)
|
||||
# int fd;
|
||||
# int offset;
|
||||
# {
|
||||
# unsigned char b[4];
|
||||
# lseek (fd, offset, SEEK_SET);
|
||||
# read (fd, b, 4);
|
||||
# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);
|
||||
# }
|
||||
#
|
||||
# static unsigned int
|
||||
# pe_as32 (ptr)
|
||||
# void *ptr;
|
||||
# {
|
||||
# unsigned char *b = ptr;
|
||||
# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);
|
||||
# }
|
||||
#
|
||||
# int
|
||||
# main (argc, argv)
|
||||
# int argc;
|
||||
# char *argv[];
|
||||
# {
|
||||
# int dll;
|
||||
# unsigned long pe_header_offset, opthdr_ofs, num_entries, i;
|
||||
# unsigned long export_rva, export_size, nsections, secptr, expptr;
|
||||
# unsigned long name_rvas, nexp;
|
||||
# unsigned char *expdata, *erva;
|
||||
# char *filename, *dll_name;
|
||||
#
|
||||
# filename = argv[1];
|
||||
#
|
||||
# dll = open(filename, O_RDONLY|O_BINARY);
|
||||
# if (!dll)
|
||||
# return 1;
|
||||
#
|
||||
# dll_name = filename;
|
||||
#
|
||||
# for (i=0; filename[i]; i++)
|
||||
# if (filename[i] == '/' || filename[i] == '\\' || filename[i] == ':')
|
||||
# dll_name = filename + i +1;
|
||||
#
|
||||
# pe_header_offset = pe_get32 (dll, 0x3c);
|
||||
# opthdr_ofs = pe_header_offset + 4 + 20;
|
||||
# num_entries = pe_get32 (dll, opthdr_ofs + 92);
|
||||
#
|
||||
# if (num_entries < 1) /* no exports */
|
||||
# return 1;
|
||||
#
|
||||
# export_rva = pe_get32 (dll, opthdr_ofs + 96);
|
||||
# export_size = pe_get32 (dll, opthdr_ofs + 100);
|
||||
# nsections = pe_get16 (dll, pe_header_offset + 4 +2);
|
||||
# secptr = (pe_header_offset + 4 + 20 +
|
||||
# pe_get16 (dll, pe_header_offset + 4 + 16));
|
||||
#
|
||||
# expptr = 0;
|
||||
# for (i = 0; i < nsections; i++)
|
||||
# {
|
||||
# char sname[8];
|
||||
# unsigned long secptr1 = secptr + 40 * i;
|
||||
# unsigned long vaddr = pe_get32 (dll, secptr1 + 12);
|
||||
# unsigned long vsize = pe_get32 (dll, secptr1 + 16);
|
||||
# unsigned long fptr = pe_get32 (dll, secptr1 + 20);
|
||||
# lseek(dll, secptr1, SEEK_SET);
|
||||
# read(dll, sname, 8);
|
||||
# if (vaddr <= export_rva && vaddr+vsize > export_rva)
|
||||
# {
|
||||
# expptr = fptr + (export_rva - vaddr);
|
||||
# if (export_rva + export_size > vaddr + vsize)
|
||||
# export_size = vsize - (export_rva - vaddr);
|
||||
# break;
|
||||
# }
|
||||
# }
|
||||
#
|
||||
# expdata = (unsigned char*)malloc(export_size);
|
||||
# lseek (dll, expptr, SEEK_SET);
|
||||
# read (dll, expdata, export_size);
|
||||
# erva = expdata - export_rva;
|
||||
#
|
||||
# nexp = pe_as32 (expdata+24);
|
||||
# name_rvas = pe_as32 (expdata+32);
|
||||
#
|
||||
# printf ("EXPORTS\n");
|
||||
# for (i = 0; i<nexp; i++)
|
||||
# {
|
||||
# unsigned long name_rva = pe_as32 (erva+name_rvas+i*4);
|
||||
# printf ("\t%s @ %ld ;\n", erva+name_rva, 1+ i);
|
||||
# }
|
||||
#
|
||||
# return 0;
|
||||
# }
|
||||
# /* impgen.c ends here */
|
||||
;;
|
||||
*)
|
||||
allow_undefined=yes
|
||||
@ -3408,7 +3235,7 @@ static const void *lt_preloaded_setup() {
|
||||
# linked before any other PIC object. But we must not use
|
||||
# pic_flag when linking with -static. The problem exists in
|
||||
# FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
|
||||
*-*-freebsd2*|*-*-freebsd3.0*)
|
||||
*-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
|
||||
case "$compile_command " in
|
||||
*" -static "*) ;;
|
||||
*) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";;
|
||||
|
Loading…
Reference in New Issue
Block a user