+1999-09-12 Ian Lance Taylor <ian@zembu.com>
+
+ * pe-dll.h: New file.
+ * pe-dll.c: Include "pe-dll.h". Mark unused arguments as needed
+ to avoid warnings.
+ (edata_sz, reloc_sz): Change from int to size_t.
+ (pe_details_type): Change type of imagebase_reloc from int to
+ unsigned int.
+ (pe_detail_list): Fully initialize last entry.
+ (pe_dll_id_target): Change parameter to const.
+ (pe_dll_generate_def_file): Likewise.
+ (pe_dll_generate_implib): Likewise.
+ (pe_implied_import_dll): Likewise. Change dll_name to const.
+ * emultempl/pe.em: Include "pe-dll.h". Remove declarations now in
+ pe-dll.h.
+ (init): Fully initialize __dll__ entry.
+ (gld_${EMULATION_NAME}_after_open): Remove unused variables
+ sequence, elt, and i.
+ * deffile.h: Add preprocessor guard.
+ * deffilep.y (def_debug): Remove.
+ * Makefile.am: Rebuild dependencies.
+ (HFILES): Add pe-dll.h.
+
1999-09-12 Donn Terry <donn@interix.com>
* emultempl/pe.em (PE_DEF_SECTION_ALIGNMENT): If
HFILES = ld.h ldctor.h ldemul.h ldexp.h ldfile.h \
ldlang.h ldlex.h ldmain.h ldmisc.h ldver.h \
- ldwrite.h mri.h deffile.h
+ ldwrite.h mri.h deffile.h pe-dll.h
GENERATED_CFILES = ldgram.c ldlex.c deffilep.c
GENERATED_HFILES = ldgram.h ldemul-list.h deffilep.h
sysdep.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/bfdlink.h \
$(INCDIR)/libiberty.h ld.h ldexp.h ldlang.h ldwrite.h \
ldmisc.h ldgram.h ldmain.h ldemul.h $(INCDIR)/coff/internal.h \
- ../bfd/libcoff.h deffile.h
+ ../bfd/libcoff.h deffile.h pe-dll.h
ldgram.o: ldgram.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
sysdep.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/bfdlink.h \
ld.h ldexp.h ldver.h ldlang.h ldemul.h ldfile.h ldmisc.h \
HFILES = ld.h ldctor.h ldemul.h ldexp.h ldfile.h \
ldlang.h ldlex.h ldmain.h ldmisc.h ldver.h \
- ldwrite.h mri.h deffile.h
+ ldwrite.h mri.h deffile.h pe-dll.h
GENERATED_CFILES = ldgram.c ldlex.c deffilep.c
sysdep.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/bfdlink.h \
$(INCDIR)/libiberty.h ld.h ldexp.h ldlang.h ldwrite.h \
ldmisc.h ldgram.h ldmain.h ldemul.h $(INCDIR)/coff/internal.h \
- ../bfd/libcoff.h deffile.h
+ ../bfd/libcoff.h deffile.h pe-dll.h
ldgram.o: ldgram.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
sysdep.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/bfdlink.h \
ld.h ldexp.h ldver.h ldlang.h ldemul.h ldfile.h ldmisc.h \
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
+#ifndef DEFFILE_H
+#define DEFFILE_H
+
#include "ansidecl.h"
/* DEF storage definitions. Note that any ordinal may be zero, and
extern void def_file_print PARAMS ((FILE * _file,
def_file * _def));
#endif
+
+#endif /* DEFFILE_H */
static void def_directive PARAMS ((char *));
static int def_parse PARAMS ((void));
static int def_error PARAMS ((const char *));
-static int def_debug;
static int def_lex PARAMS ((void));
static int lex_forced_token = 0;
#include "../bfd/libcoff.h"
#include "../bfd/libbfd.h"
#include "deffile.h"
+#include "pe-dll.h"
#define TARGET_IS_${EMULATION_NAME}
static int dll;
static int support_old_code = 0;
static char * thumb_entry_symbol = NULL;
-extern def_file *pe_def_file;
static lang_assignment_statement_type *image_base_statement = 0;
static char *pe_out_def_filename = 0;
-extern int pe_dll_export_everything;
-extern int pe_dll_kill_ats;
-extern int pe_dll_stdcall_aliases;
static int pe_enable_stdcall_fixup = -1; /* 0=disable 1=enable */
static char *pe_implib_filename = 0;
#define IMAGEBASEOFF 0
D(ImageBase,"__image_base__", NT_EXE_IMAGE_BASE),
#define DLLOFF 1
- {&dll, sizeof(dll), 0, "__dll__"},
+ {&dll, sizeof(dll), 0, "__dll__", 0},
D(SectionAlignment,"__section_alignment__", PE_DEF_SECTION_ALIGNMENT),
D(FileAlignment,"__file_alignment__", PE_DEF_FILE_ALIGNMENT),
D(MajorOperatingSystemVersion,"__major_os_version__", 4),
#endif
{
- static int sequence = 0;
int is_ms_arch;
- bfd *cur_arch = 0, *elt;
+ bfd *cur_arch = 0;
lang_input_statement_type *is2;
+
/* Careful - this is a shell script. Watch those dollar signs! */
/* Microsoft import libraries have every member named the same,
and not in the right order for us to link them correctly. We
thunks, and the sentinel(s). The head is easy; it's the one
with idata2. We assume that the sentinels won't have relocs,
and the thunks will. It's easier than checking the symbol
- table for external references. */
+ table for external references. */
LANG_FOR_EACH_INPUT_STATEMENT (is)
{
if (is->the_bfd->my_archive)
if (is_ms_arch)
{
- int idata2 = 0, i, reloc_count=0;
+ int idata2 = 0, reloc_count=0;
asection *sec;
char *new_name, seq;
+
for (sec = is->the_bfd->sections; sec; sec = sec->next)
{
if (strcmp (sec->name, ".idata\$2") == 0)
#include "coff/internal.h"
#include "../bfd/libcoff.h"
#include "deffile.h"
+#include "pe-dll.h"
/************************************************************************
static bfd *filler_bfd;
static struct sec *edata_s, *reloc_s;
static unsigned char *edata_d, *reloc_d;
-static int edata_sz, reloc_sz;
+static size_t edata_sz, reloc_sz;
typedef struct {
char *target_name;
char *object_target;
- int imagebase_reloc;
+ unsigned int imagebase_reloc;
int pe_arch;
int bfd_arch;
int underscored;
bfd_arch_i386,
1
},
- { 0 }
+ { NULL, NULL, 0, 0, 0, 0 }
};
static pe_details_type *pe_details;
void
pe_dll_id_target (target)
- char *target;
+ const char *target;
{
int i;
for (i=0; pe_detail_list[i].target_name; i++)
static void
process_def_file (abfd, info)
- bfd *abfd;
+ bfd *abfd ATTRIBUTE_UNUSED;
struct bfd_link_info *info;
{
int i, j;
static void
generate_edata (abfd, info)
bfd *abfd;
- struct bfd_link_info *info;
+ struct bfd_link_info *info ATTRIBUTE_UNUSED;
{
int i, next_ordinal;
int name_table_size = 0;
static void
fill_edata (abfd, info)
bfd *abfd;
- struct bfd_link_info *info;
+ struct bfd_link_info *info ATTRIBUTE_UNUSED;
{
int i, hint;
unsigned char *edirectory;
void
pe_dll_generate_def_file (pe_out_def_filename)
- char *pe_out_def_filename;
+ const char *pe_out_def_filename;
{
int i;
FILE *out = fopen (pe_out_def_filename, "w");
void
pe_dll_generate_implib (def, impfilename)
def_file *def;
- char *impfilename;
+ const char *impfilename;
{
int i;
bfd *ar_head;
boolean
pe_implied_import_dll (filename)
- char *filename;
+ const char *filename;
{
bfd *dll;
unsigned long pe_header_offset, opthdr_ofs, num_entries, i;
unsigned long export_rva, export_size, nsections, secptr, expptr;
unsigned char *expdata, *erva;
unsigned long name_rvas, ordinals, nexp, ordbase;
- char *dll_name;
+ const char *dll_name;
/* No, I can't use bfd here. kernel32.dll puts its export table in
the middle of the .rdata section. */
void
pe_exe_build_sections (abfd, info)
bfd *abfd;
- struct bfd_link_info *info;
+ struct bfd_link_info *info ATTRIBUTE_UNUSED;
{
pe_dll_id_target (bfd_get_target (abfd));
build_filler_bfd (0);
--- /dev/null
+/* pe-dll.h: Header file for routines used to build Windows DLLs.
+ Copyright (C) 1999 Free Software Foundation, Inc.
+
+ This file is part of GLD, the Gnu Linker.
+
+ GLD 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, or (at your option)
+ any later version.
+
+ GLD 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 GLD; see the file COPYING. If not, write to the Free
+ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+ 02111-1307, USA. */
+
+#ifndef PE_DLL_H
+#define PE_DLL_H
+
+#include "bfd.h"
+#include "sysdep.h"
+#include "bfdlink.h"
+#include "deffile.h"
+
+extern def_file *pe_def_file;
+extern int pe_dll_export_everything;
+extern int pe_dll_do_default_excludes;
+extern int pe_dll_kill_ats;
+extern int pe_dll_stdcall_aliases;
+
+extern void pe_dll_id_target PARAMS ((const char *));
+extern void pe_dll_add_excludes PARAMS ((const char *));
+extern void pe_dll_generate_def_file PARAMS ((const char *));
+extern void pe_dll_generate_implib PARAMS ((def_file *, const char *));
+extern void pe_process_import_defs PARAMS ((bfd *, struct bfd_link_info *));
+extern boolean pe_implied_import_dll PARAMS ((const char *));
+extern void pe_dll_build_sections PARAMS ((bfd *, struct bfd_link_info *));
+extern void pe_exe_build_sections PARAMS ((bfd *, struct bfd_link_info *));
+extern void pe_dll_fill_sections PARAMS ((bfd *, struct bfd_link_info *));
+extern void pe_exe_fill_sections PARAMS ((bfd *, struct bfd_link_info *));
+
+#endif /* PE_DLL_H */