1 |
/* Support for the generic parts of PE/PEI; the common executable parts. |
/* Support for the generic parts of PE/PEI; the common executable parts. |
2 |
Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 |
Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, |
3 |
Free Software Foundation, Inc. |
2005 Free Software Foundation, Inc. |
4 |
Written by Cygnus Solutions. |
Written by Cygnus Solutions. |
5 |
|
|
6 |
This file is part of BFD, the Binary File Descriptor library. |
This file is part of BFD, the Binary File Descriptor library. |
91 |
|
|
92 |
static void add_data_entry |
static void add_data_entry |
93 |
PARAMS ((bfd *, struct internal_extra_pe_aouthdr *, int, char *, bfd_vma)); |
PARAMS ((bfd *, struct internal_extra_pe_aouthdr *, int, char *, bfd_vma)); |
94 |
static boolean pe_print_pdata PARAMS ((bfd *, PTR)); |
static bfd_boolean pe_print_pdata PARAMS ((bfd *, PTR)); |
95 |
static boolean pe_print_reloc PARAMS ((bfd *, PTR)); |
static bfd_boolean pe_print_reloc PARAMS ((bfd *, PTR)); |
96 |
static boolean pe_print_idata PARAMS ((bfd *, PTR)); |
static bfd_boolean pe_print_idata PARAMS ((bfd *, PTR)); |
97 |
static boolean pe_print_edata PARAMS ((bfd *, PTR)); |
static bfd_boolean pe_print_edata PARAMS ((bfd *, PTR)); |
98 |
|
|
99 |
|
|
100 |
void |
void |
138 |
{ |
{ |
139 |
in->n_value = 0x0; |
in->n_value = 0x0; |
140 |
|
|
|
#if 0 |
|
|
/* FIXME: This is clearly wrong. The problem seems to be that |
|
|
undefined C_SECTION symbols appear in the first object of a |
|
|
MS generated .lib file, and the symbols are not defined |
|
|
anywhere. */ |
|
|
in->n_scnum = 1; |
|
|
|
|
|
/* I have tried setting the class to 3 and using the following |
|
|
to set the section number. This will put the address of the |
|
|
pointer to the string kernel32.dll at addresses 0 and 0x10 |
|
|
off start of idata section which is not correct. */ |
|
|
#if 0 |
|
|
if (strcmp (in->_n._n_name, ".idata$4") == 0) |
|
|
in->n_scnum = 3; |
|
|
else |
|
|
in->n_scnum = 2; |
|
|
#endif |
|
|
#else |
|
141 |
/* Create synthetic empty sections as needed. DJ */ |
/* Create synthetic empty sections as needed. DJ */ |
142 |
if (in->n_scnum == 0) |
if (in->n_scnum == 0) |
143 |
{ |
{ |
171 |
|
|
172 |
sec->vma = 0; |
sec->vma = 0; |
173 |
sec->lma = 0; |
sec->lma = 0; |
174 |
sec->_cooked_size = 0; |
sec->size = 0; |
|
sec->_raw_size = 0; |
|
175 |
sec->filepos = 0; |
sec->filepos = 0; |
176 |
sec->rel_filepos = 0; |
sec->rel_filepos = 0; |
177 |
sec->reloc_count = 0; |
sec->reloc_count = 0; |
179 |
sec->lineno_count = 0; |
sec->lineno_count = 0; |
180 |
sec->userdata = NULL; |
sec->userdata = NULL; |
181 |
sec->next = (asection *) NULL; |
sec->next = (asection *) NULL; |
|
sec->flags = 0; |
|
182 |
sec->alignment_power = 2; |
sec->alignment_power = 2; |
183 |
sec->flags = SEC_HAS_CONTENTS | SEC_ALLOC | SEC_DATA | SEC_LOAD; |
sec->flags = SEC_HAS_CONTENTS | SEC_ALLOC | SEC_DATA | SEC_LOAD; |
184 |
|
|
187 |
in->n_scnum = unused_section_number; |
in->n_scnum = unused_section_number; |
188 |
} |
} |
189 |
in->n_sclass = C_STAT; |
in->n_sclass = C_STAT; |
|
#endif |
|
190 |
} |
} |
191 |
#endif |
#endif |
192 |
|
|
549 |
struct internal_extra_pe_aouthdr *extra = &pe->pe_opthdr; |
struct internal_extra_pe_aouthdr *extra = &pe->pe_opthdr; |
550 |
PEAOUTHDR *aouthdr_out = (PEAOUTHDR *) out; |
PEAOUTHDR *aouthdr_out = (PEAOUTHDR *) out; |
551 |
bfd_vma sa, fa, ib; |
bfd_vma sa, fa, ib; |
552 |
|
IMAGE_DATA_DIRECTORY idata2, idata5, tls; |
553 |
|
|
554 |
if (pe->force_minimum_alignment) |
if (pe->force_minimum_alignment) |
555 |
{ |
{ |
556 |
if (!extra->FileAlignment) |
if (!extra->FileAlignment) |
566 |
fa = extra->FileAlignment; |
fa = extra->FileAlignment; |
567 |
ib = extra->ImageBase; |
ib = extra->ImageBase; |
568 |
|
|
569 |
|
idata2 = pe->pe_opthdr.DataDirectory[1]; |
570 |
|
idata5 = pe->pe_opthdr.DataDirectory[12]; |
571 |
|
tls = pe->pe_opthdr.DataDirectory[9]; |
572 |
|
|
573 |
if (aouthdr_in->tsize) |
if (aouthdr_in->tsize) |
574 |
{ |
{ |
575 |
aouthdr_in->text_start -= ib; |
aouthdr_in->text_start -= ib; |
598 |
#define SA(x) (((x) + sa -1 ) & (- sa)) |
#define SA(x) (((x) + sa -1 ) & (- sa)) |
599 |
|
|
600 |
/* We like to have the sizes aligned. */ |
/* We like to have the sizes aligned. */ |
|
|
|
601 |
aouthdr_in->bsize = FA (aouthdr_in->bsize); |
aouthdr_in->bsize = FA (aouthdr_in->bsize); |
602 |
|
|
603 |
extra->NumberOfRvaAndSizes = IMAGE_NUMBEROF_DIRECTORY_ENTRIES; |
extra->NumberOfRvaAndSizes = IMAGE_NUMBEROF_DIRECTORY_ENTRIES; |
604 |
|
|
605 |
/* first null out all data directory entries .. */ |
/* First null out all data directory entries. */ |
606 |
memset (extra->DataDirectory, 0, sizeof (extra->DataDirectory)); |
memset (extra->DataDirectory, 0, sizeof (extra->DataDirectory)); |
607 |
|
|
608 |
add_data_entry (abfd, extra, 0, ".edata", ib); |
add_data_entry (abfd, extra, 0, ".edata", ib); |
|
|
|
|
/* Don't call add_data_entry for .idata$2 or .idata$5. It's done in |
|
|
bfd_coff_final_link where all the required information is |
|
|
available. */ |
|
|
|
|
|
/* However, until other .idata fixes are made (pending patch), the |
|
|
entry for .idata is needed for backwards compatability. FIXME. */ |
|
|
add_data_entry (abfd, extra, 1, ".idata", ib); |
|
|
|
|
609 |
add_data_entry (abfd, extra, 2, ".rsrc", ib); |
add_data_entry (abfd, extra, 2, ".rsrc", ib); |
|
|
|
610 |
add_data_entry (abfd, extra, 3, ".pdata", ib); |
add_data_entry (abfd, extra, 3, ".pdata", ib); |
611 |
|
|
612 |
|
/* In theory we do not need to call add_data_entry for .idata$2 or |
613 |
|
.idata$5. It will be done in bfd_coff_final_link where all the |
614 |
|
required information is available. If however, we are not going |
615 |
|
to perform a final link, eg because we have been invoked by objcopy |
616 |
|
or strip, then we need to make sure that these Data Directory |
617 |
|
entries are initialised properly. |
618 |
|
|
619 |
|
So - we copy the input values into the output values, and then, if |
620 |
|
a final link is going to be performed, it can overwrite them. */ |
621 |
|
extra->DataDirectory[1] = idata2; |
622 |
|
extra->DataDirectory[12] = idata5; |
623 |
|
extra->DataDirectory[9] = tls; |
624 |
|
|
625 |
|
if (extra->DataDirectory[1].VirtualAddress == 0) |
626 |
|
/* Until other .idata fixes are made (pending patch), the entry for |
627 |
|
.idata is needed for backwards compatibility. FIXME. */ |
628 |
|
add_data_entry (abfd, extra, 1, ".idata", ib); |
629 |
|
|
630 |
/* For some reason, the virtual size (which is what's set by |
/* For some reason, the virtual size (which is what's set by |
631 |
add_data_entry) for .reloc is not the same as the size recorded |
add_data_entry) for .reloc is not the same as the size recorded |
632 |
in this slot by MSVC; it doesn't seem to cause problems (so far), |
in this slot by MSVC; it doesn't seem to cause problems (so far), |
637 |
|
|
638 |
{ |
{ |
639 |
asection *sec; |
asection *sec; |
640 |
|
bfd_vma hsize = 0; |
641 |
bfd_vma dsize = 0; |
bfd_vma dsize = 0; |
642 |
bfd_vma isize = SA(abfd->sections->filepos); |
bfd_vma isize = 0; |
643 |
bfd_vma tsize = 0; |
bfd_vma tsize = 0; |
644 |
|
|
645 |
for (sec = abfd->sections; sec; sec = sec->next) |
for (sec = abfd->sections; sec; sec = sec->next) |
646 |
{ |
{ |
647 |
int rounded = FA(sec->_raw_size); |
int rounded = FA(sec->size); |
648 |
|
|
649 |
|
/* The first non-zero section filepos is the header size. |
650 |
|
Sections without contents will have a filepos of 0. */ |
651 |
|
if (hsize == 0) |
652 |
|
hsize = sec->filepos; |
653 |
if (sec->flags & SEC_DATA) |
if (sec->flags & SEC_DATA) |
654 |
dsize += rounded; |
dsize += rounded; |
655 |
if (sec->flags & SEC_CODE) |
if (sec->flags & SEC_CODE) |
659 |
5.0 link.exe) where the file size of the .data segment is |
5.0 link.exe) where the file size of the .data segment is |
660 |
quite small compared to the virtual size. Without this |
quite small compared to the virtual size. Without this |
661 |
fix, strip munges the file. */ |
fix, strip munges the file. */ |
662 |
isize += SA (FA (pei_section_data (abfd, sec)->virt_size)); |
if (coff_section_data (abfd, sec) != NULL |
663 |
|
&& pei_section_data (abfd, sec) != NULL) |
664 |
|
isize += SA (FA (pei_section_data (abfd, sec)->virt_size)); |
665 |
} |
} |
666 |
|
|
667 |
aouthdr_in->dsize = dsize; |
aouthdr_in->dsize = dsize; |
668 |
aouthdr_in->tsize = tsize; |
aouthdr_in->tsize = tsize; |
669 |
extra->SizeOfImage = isize; |
extra->SizeOfHeaders = hsize; |
670 |
|
extra->SizeOfImage = SA(hsize) + isize; |
671 |
} |
} |
672 |
|
|
|
extra->SizeOfHeaders = abfd->sections->filepos; |
|
673 |
H_PUT_16 (abfd, aouthdr_in->magic, aouthdr_out->standard.magic); |
H_PUT_16 (abfd, aouthdr_in->magic, aouthdr_out->standard.magic); |
674 |
|
|
675 |
#define LINKER_VERSION 256 /* That is, 2.56 */ |
#define LINKER_VERSION 256 /* That is, 2.56 */ |
687 |
aouthdr_out->standard.text_start); |
aouthdr_out->standard.text_start); |
688 |
|
|
689 |
#ifndef COFF_WITH_pep |
#ifndef COFF_WITH_pep |
690 |
/* PE32+ does not have data_start member! */ |
/* PE32+ does not have data_start member! */ |
691 |
PUT_AOUTHDR_DATA_START (abfd, aouthdr_in->data_start, |
PUT_AOUTHDR_DATA_START (abfd, aouthdr_in->data_start, |
692 |
aouthdr_out->standard.data_start); |
aouthdr_out->standard.data_start); |
693 |
#endif |
#endif |
893 |
sometimes). */ |
sometimes). */ |
894 |
if ((scnhdr_int->s_flags & IMAGE_SCN_CNT_UNINITIALIZED_DATA) != 0) |
if ((scnhdr_int->s_flags & IMAGE_SCN_CNT_UNINITIALIZED_DATA) != 0) |
895 |
{ |
{ |
896 |
ps = scnhdr_int->s_size; |
if (bfd_pe_executable_p (abfd)) |
897 |
ss = 0; |
{ |
898 |
|
ps = scnhdr_int->s_size; |
899 |
|
ss = 0; |
900 |
|
} |
901 |
|
else |
902 |
|
{ |
903 |
|
ps = 0; |
904 |
|
ss = scnhdr_int->s_size; |
905 |
|
} |
906 |
} |
} |
907 |
else |
else |
908 |
{ |
{ |
909 |
ps = scnhdr_int->s_paddr; |
if (bfd_pe_executable_p (abfd)) |
910 |
|
ps = scnhdr_int->s_paddr; |
911 |
|
else |
912 |
|
ps = 0; |
913 |
|
|
914 |
ss = scnhdr_int->s_size; |
ss = scnhdr_int->s_size; |
915 |
} |
} |
916 |
|
|
927 |
PUT_SCNHDR_LNNOPTR (abfd, scnhdr_int->s_lnnoptr, |
PUT_SCNHDR_LNNOPTR (abfd, scnhdr_int->s_lnnoptr, |
928 |
scnhdr_ext->s_lnnoptr); |
scnhdr_ext->s_lnnoptr); |
929 |
|
|
|
/* Extra flags must be set when dealing with NT. All sections should also |
|
|
have the IMAGE_SCN_MEM_READ (0x40000000) flag set. In addition, the |
|
|
.text section must have IMAGE_SCN_MEM_EXECUTE (0x20000000) and the data |
|
|
sections (.idata, .data, .bss, .CRT) must have IMAGE_SCN_MEM_WRITE set |
|
|
(this is especially important when dealing with the .idata section since |
|
|
the addresses for routines from .dlls must be overwritten). If .reloc |
|
|
section data is ever generated, we must add IMAGE_SCN_MEM_DISCARDABLE |
|
|
(0x02000000). Also, the resource data should also be read and |
|
|
writable. */ |
|
|
|
|
|
/* FIXME: alignment is also encoded in this field, at least on ppc (krk) */ |
|
|
/* FIXME: even worse, I don't see how to get the original alignment field*/ |
|
|
/* back... */ |
|
|
|
|
930 |
{ |
{ |
931 |
int flags = scnhdr_int->s_flags; |
/* Extra flags must be set when dealing with PE. All sections should also |
932 |
|
have the IMAGE_SCN_MEM_READ (0x40000000) flag set. In addition, the |
933 |
|
.text section must have IMAGE_SCN_MEM_EXECUTE (0x20000000) and the data |
934 |
|
sections (.idata, .data, .bss, .CRT) must have IMAGE_SCN_MEM_WRITE set |
935 |
|
(this is especially important when dealing with the .idata section since |
936 |
|
the addresses for routines from .dlls must be overwritten). If .reloc |
937 |
|
section data is ever generated, we must add IMAGE_SCN_MEM_DISCARDABLE |
938 |
|
(0x02000000). Also, the resource data should also be read and |
939 |
|
writable. */ |
940 |
|
|
941 |
|
/* FIXME: Alignment is also encoded in this field, at least on PPC and |
942 |
|
ARM-WINCE. Although - how do we get the original alignment field |
943 |
|
back ? */ |
944 |
|
|
945 |
|
typedef struct |
946 |
|
{ |
947 |
|
const char * section_name; |
948 |
|
unsigned long must_have; |
949 |
|
} |
950 |
|
pe_required_section_flags; |
951 |
|
|
952 |
|
pe_required_section_flags known_sections [] = |
953 |
|
{ |
954 |
|
{ ".arch", IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_DISCARDABLE | IMAGE_SCN_ALIGN_8BYTES }, |
955 |
|
{ ".bss", IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_UNINITIALIZED_DATA | IMAGE_SCN_MEM_WRITE }, |
956 |
|
{ ".data", IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_WRITE }, |
957 |
|
{ ".edata", IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_INITIALIZED_DATA }, |
958 |
|
{ ".idata", IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_WRITE }, |
959 |
|
{ ".pdata", IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_INITIALIZED_DATA }, |
960 |
|
{ ".rdata", IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_INITIALIZED_DATA }, |
961 |
|
{ ".reloc", IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_DISCARDABLE }, |
962 |
|
{ ".rsrc", IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_WRITE }, |
963 |
|
{ ".text" , IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_CODE | IMAGE_SCN_MEM_EXECUTE }, |
964 |
|
{ ".tls", IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_WRITE }, |
965 |
|
{ ".xdata", IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_INITIALIZED_DATA }, |
966 |
|
{ NULL, 0} |
967 |
|
}; |
968 |
|
|
969 |
|
pe_required_section_flags * p; |
970 |
|
|
971 |
|
/* We have defaulted to adding the IMAGE_SCN_MEM_WRITE flag, but now |
972 |
|
we know exactly what this specific section wants so we remove it |
973 |
|
and then allow the must_have field to add it back in if necessary. |
974 |
|
However, we don't remove IMAGE_SCN_MEM_WRITE flag from .text if the |
975 |
|
default WP_TEXT file flag has been cleared. WP_TEXT may be cleared |
976 |
|
by ld --enable-auto-import (if auto-import is actually needed), |
977 |
|
by ld --omagic, or by obcopy --writable-text. */ |
978 |
|
|
979 |
|
for (p = known_sections; p->section_name; p++) |
980 |
|
if (strcmp (scnhdr_int->s_name, p->section_name) == 0) |
981 |
|
{ |
982 |
|
if (strcmp (scnhdr_int->s_name, ".text") |
983 |
|
|| (bfd_get_file_flags (abfd) & WP_TEXT)) |
984 |
|
scnhdr_int->s_flags &= ~IMAGE_SCN_MEM_WRITE; |
985 |
|
scnhdr_int->s_flags |= p->must_have; |
986 |
|
break; |
987 |
|
} |
988 |
|
|
989 |
H_PUT_32 (abfd, flags, scnhdr_ext->s_flags); |
H_PUT_32 (abfd, scnhdr_int->s_flags, scnhdr_ext->s_flags); |
990 |
} |
} |
991 |
|
|
992 |
if (coff_data (abfd)->link_info |
if (coff_data (abfd)->link_info |
993 |
&& ! coff_data (abfd)->link_info->relocateable |
&& ! coff_data (abfd)->link_info->relocatable |
994 |
&& ! coff_data (abfd)->link_info->shared |
&& ! coff_data (abfd)->link_info->shared |
995 |
&& strcmp (scnhdr_int->s_name, ".text") == 0) |
&& strcmp (scnhdr_int->s_name, ".text") == 0) |
996 |
{ |
{ |
997 |
/* By inference from looking at MS output, the 32 bit field |
/* By inference from looking at MS output, the 32 bit field |
998 |
which is the combintion of the number_of_relocs and |
which is the combination of the number_of_relocs and |
999 |
number_of_linenos is used for the line number count in |
number_of_linenos is used for the line number count in |
1000 |
executables. A 16-bit field won't do for cc1. The MS |
executables. A 16-bit field won't do for cc1. The MS |
1001 |
document says that the number of relocs is zero for |
document says that the number of relocs is zero for |
1019 |
ret = 0; |
ret = 0; |
1020 |
} |
} |
1021 |
|
|
1022 |
if (scnhdr_int->s_nreloc <= 0xffff) |
/* Although we could encode 0xffff relocs here, we do not, to be |
1023 |
|
consistent with other parts of bfd. Also it lets us warn, as |
1024 |
|
we should never see 0xffff here w/o having the overflow flag |
1025 |
|
set. */ |
1026 |
|
if (scnhdr_int->s_nreloc < 0xffff) |
1027 |
H_PUT_16 (abfd, scnhdr_int->s_nreloc, scnhdr_ext->s_nreloc); |
H_PUT_16 (abfd, scnhdr_int->s_nreloc, scnhdr_ext->s_nreloc); |
1028 |
else |
else |
1029 |
{ |
{ |
1031 |
H_PUT_16 (abfd, 0xffff, scnhdr_ext->s_nreloc); |
H_PUT_16 (abfd, 0xffff, scnhdr_ext->s_nreloc); |
1032 |
scnhdr_int->s_flags |= IMAGE_SCN_LNK_NRELOC_OVFL; |
scnhdr_int->s_flags |= IMAGE_SCN_LNK_NRELOC_OVFL; |
1033 |
H_PUT_32 (abfd, scnhdr_int->s_flags, scnhdr_ext->s_flags); |
H_PUT_32 (abfd, scnhdr_int->s_flags, scnhdr_ext->s_flags); |
|
#if 0 |
|
|
(*_bfd_error_handler) (_("%s: reloc overflow 1: 0x%lx > 0xffff"), |
|
|
bfd_get_filename (abfd), |
|
|
scnhdr_int->s_nreloc); |
|
|
bfd_set_error (bfd_error_file_truncated); |
|
|
H_PUT_16 (abfd, 0xffff, scnhdr_ext->s_nreloc); |
|
|
ret = 0; |
|
|
#endif |
|
1034 |
} |
} |
1035 |
} |
} |
1036 |
return ret; |
return ret; |
1064 |
PPC- specific code. */ |
PPC- specific code. */ |
1065 |
#endif |
#endif |
1066 |
|
|
1067 |
static boolean |
static bfd_boolean |
1068 |
pe_print_idata (abfd, vfile) |
pe_print_idata (abfd, vfile) |
1069 |
bfd *abfd; |
bfd *abfd; |
1070 |
PTR vfile; |
PTR vfile; |
1081 |
bfd_size_type datasize = 0; |
bfd_size_type datasize = 0; |
1082 |
bfd_size_type dataoff; |
bfd_size_type dataoff; |
1083 |
bfd_size_type i; |
bfd_size_type i; |
|
bfd_size_type amt; |
|
1084 |
int onaline = 20; |
int onaline = 20; |
1085 |
|
|
1086 |
pe_data_type *pe = pe_data (abfd); |
pe_data_type *pe = pe_data (abfd); |
1095 |
/* Maybe the extra header isn't there. Look for the section. */ |
/* Maybe the extra header isn't there. Look for the section. */ |
1096 |
section = bfd_get_section_by_name (abfd, ".idata"); |
section = bfd_get_section_by_name (abfd, ".idata"); |
1097 |
if (section == NULL) |
if (section == NULL) |
1098 |
return true; |
return TRUE; |
1099 |
|
|
1100 |
addr = section->vma; |
addr = section->vma; |
1101 |
datasize = bfd_section_size (abfd, section); |
datasize = section->size; |
1102 |
if (datasize == 0) |
if (datasize == 0) |
1103 |
return true; |
return TRUE; |
1104 |
} |
} |
1105 |
else |
else |
1106 |
{ |
{ |
1107 |
addr += extra->ImageBase; |
addr += extra->ImageBase; |
1108 |
for (section = abfd->sections; section != NULL; section = section->next) |
for (section = abfd->sections; section != NULL; section = section->next) |
1109 |
{ |
{ |
1110 |
datasize = bfd_section_size (abfd, section); |
datasize = section->size; |
1111 |
if (addr >= section->vma && addr < section->vma + datasize) |
if (addr >= section->vma && addr < section->vma + datasize) |
1112 |
break; |
break; |
1113 |
} |
} |
1116 |
{ |
{ |
1117 |
fprintf (file, |
fprintf (file, |
1118 |
_("\nThere is an import table, but the section containing it could not be found\n")); |
_("\nThere is an import table, but the section containing it could not be found\n")); |
1119 |
return true; |
return TRUE; |
1120 |
} |
} |
1121 |
} |
} |
1122 |
|
|
1127 |
datasize -= dataoff; |
datasize -= dataoff; |
1128 |
|
|
1129 |
#ifdef POWERPC_LE_PE |
#ifdef POWERPC_LE_PE |
1130 |
if (rel_section != 0 && bfd_section_size (abfd, rel_section) != 0) |
if (rel_section != 0 && rel_section->size != 0) |
1131 |
{ |
{ |
1132 |
/* The toc address can be found by taking the starting address, |
/* The toc address can be found by taking the starting address, |
1133 |
which on the PPC locates a function descriptor. The |
which on the PPC locates a function descriptor. The |
1139 |
bfd_vma loadable_toc_address; |
bfd_vma loadable_toc_address; |
1140 |
bfd_vma toc_address; |
bfd_vma toc_address; |
1141 |
bfd_vma start_address; |
bfd_vma start_address; |
1142 |
bfd_byte *data = 0; |
bfd_byte *data; |
1143 |
int offset; |
int offset; |
1144 |
|
|
1145 |
amt = bfd_section_size (abfd, rel_section); |
if (!bfd_malloc_and_get_section (abfd, rel_section, &data)) |
1146 |
data = (bfd_byte *) bfd_malloc (amt); |
{ |
1147 |
if (data == NULL && amt != 0) |
if (data != NULL) |
1148 |
return false; |
free (data); |
1149 |
|
return FALSE; |
1150 |
bfd_get_section_contents (abfd, rel_section, (PTR) data, (bfd_vma) 0, |
} |
|
amt); |
|
1151 |
|
|
1152 |
offset = abfd->start_address - rel_section->vma; |
offset = abfd->start_address - rel_section->vma; |
1153 |
|
|
1161 |
fprintf (file, |
fprintf (file, |
1162 |
_("\tcode-base %08lx toc (loadable/actual) %08lx/%08lx\n"), |
_("\tcode-base %08lx toc (loadable/actual) %08lx/%08lx\n"), |
1163 |
start_address, loadable_toc_address, toc_address); |
start_address, loadable_toc_address, toc_address); |
1164 |
|
if (data != NULL) |
1165 |
|
free (data); |
1166 |
} |
} |
1167 |
else |
else |
1168 |
{ |
{ |
1179 |
vma: Hint Time Forward DLL First\n\ |
vma: Hint Time Forward DLL First\n\ |
1180 |
Table Stamp Chain Name Thunk\n")); |
Table Stamp Chain Name Thunk\n")); |
1181 |
|
|
|
amt = dataoff + datasize; |
|
|
data = (bfd_byte *) bfd_malloc (amt); |
|
|
if (data == NULL) |
|
|
return false; |
|
|
|
|
1182 |
/* Read the whole section. Some of the fields might be before dataoff. */ |
/* Read the whole section. Some of the fields might be before dataoff. */ |
1183 |
if (! bfd_get_section_contents (abfd, section, (PTR) data, (bfd_vma) 0, amt)) |
if (!bfd_malloc_and_get_section (abfd, section, &data)) |
1184 |
return false; |
{ |
1185 |
|
if (data != NULL) |
1186 |
|
free (data); |
1187 |
|
return FALSE; |
1188 |
|
} |
1189 |
|
|
1190 |
adj = section->vma - extra->ImageBase; |
adj = section->vma - extra->ImageBase; |
1191 |
|
|
1203 |
|
|
1204 |
/* Print (i + extra->DataDirectory[1].VirtualAddress). */ |
/* Print (i + extra->DataDirectory[1].VirtualAddress). */ |
1205 |
fprintf (file, " %08lx\t", (unsigned long) (i + adj + dataoff)); |
fprintf (file, " %08lx\t", (unsigned long) (i + adj + dataoff)); |
|
#if 0 |
|
|
if (i + 20 > datasize) |
|
|
/* Check stuff. */ |
|
|
; |
|
|
#endif |
|
1206 |
hint_addr = bfd_get_32 (abfd, data + i + dataoff); |
hint_addr = bfd_get_32 (abfd, data + i + dataoff); |
1207 |
time_stamp = bfd_get_32 (abfd, data + i + 4 + dataoff); |
time_stamp = bfd_get_32 (abfd, data + i + 4 + dataoff); |
1208 |
forward_chain = bfd_get_32 (abfd, data + i + 8 + dataoff); |
forward_chain = bfd_get_32 (abfd, data + i + 8 + dataoff); |
1247 |
ft_section != NULL; |
ft_section != NULL; |
1248 |
ft_section = ft_section->next) |
ft_section = ft_section->next) |
1249 |
{ |
{ |
1250 |
ft_datasize = bfd_section_size (abfd, ft_section); |
ft_datasize = ft_section->size; |
1251 |
if (ft_addr >= ft_section->vma |
if (ft_addr >= ft_section->vma |
1252 |
&& ft_addr < ft_section->vma + ft_datasize) |
&& ft_addr < ft_section->vma + ft_datasize) |
1253 |
break; |
break; |
1332 |
|
|
1333 |
free (data); |
free (data); |
1334 |
|
|
1335 |
return true; |
return TRUE; |
1336 |
} |
} |
1337 |
|
|
1338 |
static boolean |
static bfd_boolean |
1339 |
pe_print_edata (abfd, vfile) |
pe_print_edata (abfd, vfile) |
1340 |
bfd *abfd; |
bfd *abfd; |
1341 |
PTR vfile; |
PTR vfile; |
1374 |
/* Maybe the extra header isn't there. Look for the section. */ |
/* Maybe the extra header isn't there. Look for the section. */ |
1375 |
section = bfd_get_section_by_name (abfd, ".edata"); |
section = bfd_get_section_by_name (abfd, ".edata"); |
1376 |
if (section == NULL) |
if (section == NULL) |
1377 |
return true; |
return TRUE; |
1378 |
|
|
1379 |
addr = section->vma; |
addr = section->vma; |
1380 |
datasize = bfd_section_size (abfd, section); |
datasize = section->size; |
1381 |
if (datasize == 0) |
if (datasize == 0) |
1382 |
return true; |
return TRUE; |
1383 |
} |
} |
1384 |
else |
else |
1385 |
{ |
{ |
1387 |
|
|
1388 |
for (section = abfd->sections; section != NULL; section = section->next) |
for (section = abfd->sections; section != NULL; section = section->next) |
1389 |
{ |
{ |
1390 |
datasize = bfd_section_size (abfd, section); |
datasize = section->size; |
1391 |
|
|
1392 |
if (addr >= section->vma && addr < section->vma + datasize) |
if (addr >= section->vma && addr < section->vma + datasize) |
1393 |
break; |
break; |
1397 |
{ |
{ |
1398 |
fprintf (file, |
fprintf (file, |
1399 |
_("\nThere is an export table, but the section containing it could not be found\n")); |
_("\nThere is an export table, but the section containing it could not be found\n")); |
1400 |
return true; |
return TRUE; |
1401 |
} |
} |
1402 |
} |
} |
1403 |
|
|
1409 |
|
|
1410 |
data = (bfd_byte *) bfd_malloc (datasize); |
data = (bfd_byte *) bfd_malloc (datasize); |
1411 |
if (data == NULL) |
if (data == NULL) |
1412 |
return false; |
return FALSE; |
1413 |
|
|
1414 |
if (! bfd_get_section_contents (abfd, section, (PTR) data, |
if (! bfd_get_section_contents (abfd, section, (PTR) data, |
1415 |
(file_ptr) dataoff, datasize)) |
(file_ptr) dataoff, datasize)) |
1416 |
return false; |
return FALSE; |
1417 |
|
|
1418 |
/* Go get Export Directory Table. */ |
/* Go get Export Directory Table. */ |
1419 |
edt.export_flags = bfd_get_32 (abfd, data + 0); |
edt.export_flags = bfd_get_32 (abfd, data + 0); |
1550 |
|
|
1551 |
free (data); |
free (data); |
1552 |
|
|
1553 |
return true; |
return TRUE; |
1554 |
} |
} |
1555 |
|
|
1556 |
/* This really is architecture dependent. On IA-64, a .pdata entry |
/* This really is architecture dependent. On IA-64, a .pdata entry |
1558 |
specify the start and end address of the code range the entry |
specify the start and end address of the code range the entry |
1559 |
covers and the address of the corresponding unwind info data. */ |
covers and the address of the corresponding unwind info data. */ |
1560 |
|
|
1561 |
static boolean |
static bfd_boolean |
1562 |
pe_print_pdata (abfd, vfile) |
pe_print_pdata (abfd, vfile) |
1563 |
bfd *abfd; |
bfd *abfd; |
1564 |
PTR vfile; |
PTR vfile; |
1579 |
if (section == NULL |
if (section == NULL |
1580 |
|| coff_section_data (abfd, section) == NULL |
|| coff_section_data (abfd, section) == NULL |
1581 |
|| pei_section_data (abfd, section) == NULL) |
|| pei_section_data (abfd, section) == NULL) |
1582 |
return true; |
return TRUE; |
1583 |
|
|
1584 |
stop = pei_section_data (abfd, section)->virt_size; |
stop = pei_section_data (abfd, section)->virt_size; |
1585 |
if ((stop % onaline) != 0) |
if ((stop % onaline) != 0) |
1598 |
\t\tAddress Address Handler Data Address Mask\n")); |
\t\tAddress Address Handler Data Address Mask\n")); |
1599 |
#endif |
#endif |
1600 |
|
|
1601 |
datasize = bfd_section_size (abfd, section); |
datasize = section->size; |
1602 |
if (datasize == 0) |
if (datasize == 0) |
1603 |
return true; |
return TRUE; |
|
|
|
|
data = (bfd_byte *) bfd_malloc (datasize); |
|
|
if (data == NULL && datasize != 0) |
|
|
return false; |
|
1604 |
|
|
1605 |
bfd_get_section_contents (abfd, section, (PTR) data, (bfd_vma) 0, |
if (!bfd_malloc_and_get_section (abfd, section, &data)) |
1606 |
datasize); |
{ |
1607 |
|
if (data != NULL) |
1608 |
|
free (data); |
1609 |
|
return FALSE; |
1610 |
|
} |
1611 |
|
|
1612 |
start = 0; |
start = 0; |
1613 |
|
|
1681 |
|
|
1682 |
free (data); |
free (data); |
1683 |
|
|
1684 |
return true; |
return TRUE; |
1685 |
} |
} |
1686 |
|
|
1687 |
#define IMAGE_REL_BASED_HIGHADJ 4 |
#define IMAGE_REL_BASED_HIGHADJ 4 |
1702 |
"UNKNOWN", /* MUST be last */ |
"UNKNOWN", /* MUST be last */ |
1703 |
}; |
}; |
1704 |
|
|
1705 |
static boolean |
static bfd_boolean |
1706 |
pe_print_reloc (abfd, vfile) |
pe_print_reloc (abfd, vfile) |
1707 |
bfd *abfd; |
bfd *abfd; |
1708 |
PTR vfile; |
PTR vfile; |
1715 |
bfd_size_type start, stop; |
bfd_size_type start, stop; |
1716 |
|
|
1717 |
if (section == NULL) |
if (section == NULL) |
1718 |
return true; |
return TRUE; |
1719 |
|
|
1720 |
if (bfd_section_size (abfd, section) == 0) |
if (section->size == 0) |
1721 |
return true; |
return TRUE; |
1722 |
|
|
1723 |
fprintf (file, |
fprintf (file, |
1724 |
_("\n\nPE File Base Relocations (interpreted .reloc section contents)\n")); |
_("\n\nPE File Base Relocations (interpreted .reloc section contents)\n")); |
1725 |
|
|
1726 |
datasize = bfd_section_size (abfd, section); |
datasize = section->size; |
1727 |
data = (bfd_byte *) bfd_malloc (datasize); |
if (!bfd_malloc_and_get_section (abfd, section, &data)) |
1728 |
if (data == NULL && datasize != 0) |
{ |
1729 |
return false; |
if (data != NULL) |
1730 |
|
free (data); |
1731 |
bfd_get_section_contents (abfd, section, (PTR) data, (bfd_vma) 0, |
return FALSE; |
1732 |
datasize); |
} |
1733 |
|
|
1734 |
start = 0; |
start = 0; |
1735 |
|
|
1736 |
stop = bfd_section_size (abfd, section); |
stop = section->size; |
1737 |
|
|
1738 |
for (i = start; i < stop;) |
for (i = start; i < stop;) |
1739 |
{ |
{ |
1785 |
|
|
1786 |
free (data); |
free (data); |
1787 |
|
|
1788 |
return true; |
return TRUE; |
1789 |
} |
} |
1790 |
|
|
1791 |
/* Print out the program headers. */ |
/* Print out the program headers. */ |
1792 |
|
|
1793 |
boolean |
bfd_boolean |
1794 |
_bfd_XX_print_private_bfd_data_common (abfd, vfile) |
_bfd_XX_print_private_bfd_data_common (abfd, vfile) |
1795 |
bfd *abfd; |
bfd *abfd; |
1796 |
PTR vfile; |
PTR vfile; |
1807 |
fprintf (file, _("\nCharacteristics 0x%x\n"), pe->real_flags); |
fprintf (file, _("\nCharacteristics 0x%x\n"), pe->real_flags); |
1808 |
#undef PF |
#undef PF |
1809 |
#define PF(x, y) if (pe->real_flags & x) { fprintf (file, "\t%s\n", y); } |
#define PF(x, y) if (pe->real_flags & x) { fprintf (file, "\t%s\n", y); } |
1810 |
PF (F_RELFLG, "relocations stripped"); |
PF (IMAGE_FILE_RELOCS_STRIPPED, "relocations stripped"); |
1811 |
PF (F_EXEC, "executable"); |
PF (IMAGE_FILE_EXECUTABLE_IMAGE, "executable"); |
1812 |
PF (F_LNNO, "line numbers stripped"); |
PF (IMAGE_FILE_LINE_NUMS_STRIPPED, "line numbers stripped"); |
1813 |
PF (F_LSYMS, "symbols stripped"); |
PF (IMAGE_FILE_LOCAL_SYMS_STRIPPED, "symbols stripped"); |
1814 |
PF (0x80, "little endian"); |
PF (IMAGE_FILE_LARGE_ADDRESS_AWARE, "large address aware"); |
1815 |
PF (F_AR32WR, "32 bit words"); |
PF (IMAGE_FILE_BYTES_REVERSED_LO, "little endian"); |
1816 |
PF (0x200, "debugging information removed"); |
PF (IMAGE_FILE_32BIT_MACHINE, "32 bit words"); |
1817 |
PF (0x1000, "system file"); |
PF (IMAGE_FILE_DEBUG_STRIPPED, "debugging information removed"); |
1818 |
PF (F_DLL, "DLL"); |
PF (IMAGE_FILE_SYSTEM, "system file"); |
1819 |
PF (0x8000, "big endian"); |
PF (IMAGE_FILE_DLL, "DLL"); |
1820 |
|
PF (IMAGE_FILE_BYTES_REVERSED_HI, "big endian"); |
1821 |
#undef PF |
#undef PF |
1822 |
|
|
1823 |
/* ctime implies '\n'. */ |
/* ctime implies '\n'. */ |
1902 |
pe_print_pdata (abfd, vfile); |
pe_print_pdata (abfd, vfile); |
1903 |
pe_print_reloc (abfd, vfile); |
pe_print_reloc (abfd, vfile); |
1904 |
|
|
1905 |
return true; |
return TRUE; |
1906 |
} |
} |
1907 |
|
|
1908 |
/* Copy any private info we understand from the input bfd |
/* Copy any private info we understand from the input bfd |
1909 |
to the output bfd. */ |
to the output bfd. */ |
1910 |
|
|
1911 |
boolean |
bfd_boolean |
1912 |
_bfd_XX_bfd_copy_private_bfd_data_common (ibfd, obfd) |
_bfd_XX_bfd_copy_private_bfd_data_common (ibfd, obfd) |
1913 |
bfd *ibfd, *obfd; |
bfd *ibfd, *obfd; |
1914 |
{ |
{ |
1915 |
/* One day we may try to grok other private data. */ |
/* One day we may try to grok other private data. */ |
1916 |
if (ibfd->xvec->flavour != bfd_target_coff_flavour |
if (ibfd->xvec->flavour != bfd_target_coff_flavour |
1917 |
|| obfd->xvec->flavour != bfd_target_coff_flavour) |
|| obfd->xvec->flavour != bfd_target_coff_flavour) |
1918 |
return true; |
return TRUE; |
1919 |
|
|
1920 |
pe_data (obfd)->pe_opthdr = pe_data (ibfd)->pe_opthdr; |
pe_data (obfd)->pe_opthdr = pe_data (ibfd)->pe_opthdr; |
1921 |
pe_data (obfd)->dll = pe_data (ibfd)->dll; |
pe_data (obfd)->dll = pe_data (ibfd)->dll; |
1927 |
pe_data (obfd)->pe_opthdr.DataDirectory[5].VirtualAddress = 0; |
pe_data (obfd)->pe_opthdr.DataDirectory[5].VirtualAddress = 0; |
1928 |
pe_data (obfd)->pe_opthdr.DataDirectory[5].Size = 0; |
pe_data (obfd)->pe_opthdr.DataDirectory[5].Size = 0; |
1929 |
} |
} |
1930 |
return true; |
return TRUE; |
1931 |
} |
} |
1932 |
|
|
1933 |
/* Copy private section data. */ |
/* Copy private section data. */ |
1934 |
|
|
1935 |
boolean |
bfd_boolean |
1936 |
_bfd_XX_bfd_copy_private_section_data (ibfd, isec, obfd, osec) |
_bfd_XX_bfd_copy_private_section_data (ibfd, isec, obfd, osec) |
1937 |
bfd *ibfd; |
bfd *ibfd; |
1938 |
asection *isec; |
asection *isec; |
1941 |
{ |
{ |
1942 |
if (bfd_get_flavour (ibfd) != bfd_target_coff_flavour |
if (bfd_get_flavour (ibfd) != bfd_target_coff_flavour |
1943 |
|| bfd_get_flavour (obfd) != bfd_target_coff_flavour) |
|| bfd_get_flavour (obfd) != bfd_target_coff_flavour) |
1944 |
return true; |
return TRUE; |
1945 |
|
|
1946 |
if (coff_section_data (ibfd, isec) != NULL |
if (coff_section_data (ibfd, isec) != NULL |
1947 |
&& pei_section_data (ibfd, isec) != NULL) |
&& pei_section_data (ibfd, isec) != NULL) |
1951 |
bfd_size_type amt = sizeof (struct coff_section_tdata); |
bfd_size_type amt = sizeof (struct coff_section_tdata); |
1952 |
osec->used_by_bfd = (PTR) bfd_zalloc (obfd, amt); |
osec->used_by_bfd = (PTR) bfd_zalloc (obfd, amt); |
1953 |
if (osec->used_by_bfd == NULL) |
if (osec->used_by_bfd == NULL) |
1954 |
return false; |
return FALSE; |
1955 |
} |
} |
1956 |
|
|
1957 |
if (pei_section_data (obfd, osec) == NULL) |
if (pei_section_data (obfd, osec) == NULL) |
1959 |
bfd_size_type amt = sizeof (struct pei_section_tdata); |
bfd_size_type amt = sizeof (struct pei_section_tdata); |
1960 |
coff_section_data (obfd, osec)->tdata = (PTR) bfd_zalloc (obfd, amt); |
coff_section_data (obfd, osec)->tdata = (PTR) bfd_zalloc (obfd, amt); |
1961 |
if (coff_section_data (obfd, osec)->tdata == NULL) |
if (coff_section_data (obfd, osec)->tdata == NULL) |
1962 |
return false; |
return FALSE; |
1963 |
} |
} |
1964 |
|
|
1965 |
pei_section_data (obfd, osec)->virt_size = |
pei_section_data (obfd, osec)->virt_size = |
1968 |
pei_section_data (ibfd, isec)->pe_flags; |
pei_section_data (ibfd, isec)->pe_flags; |
1969 |
} |
} |
1970 |
|
|
1971 |
return true; |
return TRUE; |
1972 |
} |
} |
1973 |
|
|
1974 |
void |
void |
1978 |
symbol_info *ret; |
symbol_info *ret; |
1979 |
{ |
{ |
1980 |
coff_get_symbol_info (abfd, symbol, ret); |
coff_get_symbol_info (abfd, symbol, ret); |
|
#if 0 /* This code no longer appears to be necessary. |
|
|
ImageBase has already been added in by coff_swap_scnhdr_in. */ |
|
|
if (pe_data (abfd) != NULL |
|
|
&& ((symbol->flags & BSF_DEBUGGING) == 0 |
|
|
|| (symbol->flags & BSF_DEBUGGING_RELOC) != 0) |
|
|
&& ! bfd_is_abs_section (symbol->section)) |
|
|
ret->value += pe_data (abfd)->pe_opthdr.ImageBase; |
|
|
#endif |
|
1981 |
} |
} |
1982 |
|
|
1983 |
/* Handle the .idata section and other things that need symbol table |
/* Handle the .idata section and other things that need symbol table |
1984 |
access. */ |
access. */ |
1985 |
|
|
1986 |
boolean |
bfd_boolean |
1987 |
_bfd_XXi_final_link_postscript (abfd, pfinfo) |
_bfd_XXi_final_link_postscript (abfd, pfinfo) |
1988 |
bfd *abfd; |
bfd *abfd; |
1989 |
struct coff_final_link_info *pfinfo; |
struct coff_final_link_info *pfinfo; |
2000 |
/* The import directory. This is the address of .idata$2, with size |
/* The import directory. This is the address of .idata$2, with size |
2001 |
of .idata$2 + .idata$3. */ |
of .idata$2 + .idata$3. */ |
2002 |
h1 = coff_link_hash_lookup (coff_hash_table (info), |
h1 = coff_link_hash_lookup (coff_hash_table (info), |
2003 |
".idata$2", false, false, true); |
".idata$2", FALSE, FALSE, TRUE); |
2004 |
if (h1 != NULL) |
if (h1 != NULL) |
2005 |
{ |
{ |
2006 |
pe_data (abfd)->pe_opthdr.DataDirectory[1].VirtualAddress = |
pe_data (abfd)->pe_opthdr.DataDirectory[1].VirtualAddress = |
2008 |
+ h1->root.u.def.section->output_section->vma |
+ h1->root.u.def.section->output_section->vma |
2009 |
+ h1->root.u.def.section->output_offset); |
+ h1->root.u.def.section->output_offset); |
2010 |
h1 = coff_link_hash_lookup (coff_hash_table (info), |
h1 = coff_link_hash_lookup (coff_hash_table (info), |
2011 |
".idata$4", false, false, true); |
".idata$4", FALSE, FALSE, TRUE); |
2012 |
pe_data (abfd)->pe_opthdr.DataDirectory[1].Size = |
pe_data (abfd)->pe_opthdr.DataDirectory[1].Size = |
2013 |
((h1->root.u.def.value |
((h1->root.u.def.value |
2014 |
+ h1->root.u.def.section->output_section->vma |
+ h1->root.u.def.section->output_section->vma |
2018 |
/* The import address table. This is the size/address of |
/* The import address table. This is the size/address of |
2019 |
.idata$5. */ |
.idata$5. */ |
2020 |
h1 = coff_link_hash_lookup (coff_hash_table (info), |
h1 = coff_link_hash_lookup (coff_hash_table (info), |
2021 |
".idata$5", false, false, true); |
".idata$5", FALSE, FALSE, TRUE); |
2022 |
pe_data (abfd)->pe_opthdr.DataDirectory[12].VirtualAddress = |
pe_data (abfd)->pe_opthdr.DataDirectory[12].VirtualAddress = |
2023 |
(h1->root.u.def.value |
(h1->root.u.def.value |
2024 |
+ h1->root.u.def.section->output_section->vma |
+ h1->root.u.def.section->output_section->vma |
2025 |
+ h1->root.u.def.section->output_offset); |
+ h1->root.u.def.section->output_offset); |
2026 |
h1 = coff_link_hash_lookup (coff_hash_table (info), |
h1 = coff_link_hash_lookup (coff_hash_table (info), |
2027 |
".idata$6", false, false, true); |
".idata$6", FALSE, FALSE, TRUE); |
2028 |
pe_data (abfd)->pe_opthdr.DataDirectory[12].Size = |
pe_data (abfd)->pe_opthdr.DataDirectory[12].Size = |
2029 |
((h1->root.u.def.value |
((h1->root.u.def.value |
2030 |
+ h1->root.u.def.section->output_section->vma |
+ h1->root.u.def.section->output_section->vma |
2031 |
+ h1->root.u.def.section->output_offset) |
+ h1->root.u.def.section->output_offset) |
2032 |
- pe_data (abfd)->pe_opthdr.DataDirectory[12].VirtualAddress); |
- pe_data (abfd)->pe_opthdr.DataDirectory[12].VirtualAddress); |
2033 |
|
} |
2034 |
|
|
2035 |
|
h1 = coff_link_hash_lookup (coff_hash_table (info), |
2036 |
|
"__tls_used", FALSE, FALSE, TRUE); |
2037 |
|
if (h1 != NULL) |
2038 |
|
{ |
2039 |
|
pe_data (abfd)->pe_opthdr.DataDirectory[9].VirtualAddress = |
2040 |
|
(h1->root.u.def.value |
2041 |
|
+ h1->root.u.def.section->output_section->vma |
2042 |
|
+ h1->root.u.def.section->output_offset |
2043 |
|
- pe_data (abfd)->pe_opthdr.ImageBase); |
2044 |
|
pe_data (abfd)->pe_opthdr.DataDirectory[9].Size = 0x18; |
2045 |
} |
} |
2046 |
|
|
2047 |
/* If we couldn't find idata$2, we either have an excessively |
/* If we couldn't find idata$2, we either have an excessively |
2048 |
trivial program or are in DEEP trouble; we have to assume trivial |
trivial program or are in DEEP trouble; we have to assume trivial |
2049 |
program.... */ |
program.... */ |
2050 |
return true; |
return TRUE; |
2051 |
} |
} |