From 23a87948dded8c5a7b832e3f5f86dbdd442e7053 Mon Sep 17 00:00:00 2001 From: DJ Delorie Date: Tue, 10 Oct 2000 03:28:01 +0000 Subject: [PATCH] * pe-dll.c (make_one): Do not generate code thunk for DATA exports. (process_def_file): deduce DATA flag for auto-export sumbols. --- ld/ChangeLog | 6 ++++++ ld/pe-dll.c | 50 +++++++++++++++++++++++++++++--------------------- 2 files changed, 35 insertions(+), 21 deletions(-) diff --git a/ld/ChangeLog b/ld/ChangeLog index 1cba2174986..1ee145122dc 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,9 @@ +2000-10-09 Paul Sokolovsky + + * pe-dll.c (make_one): Do not generate code thunk for DATA + exports. + (process_def_file): deduce DATA flag for auto-export sumbols. + 2000-10-09 Kazu Hirata * ld.h: Fix formatting. diff --git a/ld/pe-dll.c b/ld/pe-dll.c index da3bd9ff1af..25533272f12 100644 --- a/ld/pe-dll.c +++ b/ld/pe-dll.c @@ -310,7 +310,12 @@ process_def_file (abfd, info) if (*sn == '_') sn++; if (auto_export (pe_def_file, sn)) - def_file_add_export (pe_def_file, sn, 0, -1); + { + def_file_export *p; + p=def_file_add_export (pe_def_file, sn, 0, -1); + /* Fill data flag properly, from dlltool.c */ + p->flag_data = !(symbols[j]->flags & BSF_FUNCTION); + } } } } @@ -1405,7 +1410,7 @@ make_one (exp, parent) bfd *parent; { asection *tx, *id7, *id5, *id4, *id6; - unsigned char *td, *d7, *d5, *d4, *d6 = NULL; + unsigned char *td = NULL, *d7, *d5, *d4, *d6 = NULL; int len; char *oname; bfd *abfd; @@ -1454,25 +1459,28 @@ make_one (exp, parent) quick_symbol (abfd, U ("__imp_"), exp->internal_name, "", id5, BSF_GLOBAL, 0); - bfd_set_section_size (abfd, tx, jmp_byte_count); - td = (unsigned char *) xmalloc (jmp_byte_count); - tx->contents = td; - memcpy (td, jmp_bytes, jmp_byte_count); - switch (pe_details->pe_arch) - { - case PE_ARCH_i386: - quick_reloc (abfd, 2, BFD_RELOC_32, 2); - break; - case PE_ARCH_sh: - quick_reloc (abfd, 8, BFD_RELOC_32, 2); - break; - case PE_ARCH_mips: - quick_reloc (abfd, 0, BFD_RELOC_HI16_S, 2); - quick_reloc (abfd, 0, BFD_RELOC_LO16, 0); /* MIPS_R_PAIR */ - quick_reloc (abfd, 4, BFD_RELOC_LO16, 2); - break; - } - save_relocs (tx); + if (! exp->flag_data) + { + bfd_set_section_size (abfd, tx, jmp_byte_count); + td = (unsigned char *) xmalloc (jmp_byte_count); + tx->contents = td; + memcpy (td, jmp_bytes, jmp_byte_count); + switch (pe_details->pe_arch) + { + case PE_ARCH_i386: + quick_reloc (abfd, 2, BFD_RELOC_32, 2); + break; + case PE_ARCH_sh: + quick_reloc (abfd, 8, BFD_RELOC_32, 2); + break; + case PE_ARCH_mips: + quick_reloc (abfd, 0, BFD_RELOC_HI16_S, 2); + quick_reloc (abfd, 0, BFD_RELOC_LO16, 0); /* MIPS_R_PAIR */ + quick_reloc (abfd, 4, BFD_RELOC_LO16, 2); + break; + } + save_relocs (tx); + } bfd_set_section_size (abfd, id7, 4); d7 = (unsigned char *) xmalloc (4); -- 2.30.2