| [10] | 1 | /* BFD back-end for Intel 386 COFF files (DJGPP variant with a stub).
|
|---|
| [609] | 2 | Copyright 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
|
|---|
| [10] | 3 | Written by Robert Hoehne.
|
|---|
| 4 |
|
|---|
| 5 | This file is part of BFD, the Binary File Descriptor library.
|
|---|
| 6 |
|
|---|
| 7 | This program is free software; you can redistribute it and/or modify
|
|---|
| 8 | it under the terms of the GNU General Public License as published by
|
|---|
| 9 | the Free Software Foundation; either version 2 of the License, or
|
|---|
| 10 | (at your option) any later version.
|
|---|
| 11 |
|
|---|
| 12 | This program is distributed in the hope that it will be useful,
|
|---|
| 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|---|
| 15 | GNU General Public License for more details.
|
|---|
| 16 |
|
|---|
| 17 | You should have received a copy of the GNU General Public License
|
|---|
| 18 | along with this program; if not, write to the Free Software
|
|---|
| 19 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
|---|
| 20 |
|
|---|
| 21 | /* This file handles now also stubbed coff images. The stub is a small
|
|---|
| 22 | DOS executable program before the coff image to load it in memory
|
|---|
| 23 | and execute it. This is needed, because DOS cannot run coff files.
|
|---|
| 24 |
|
|---|
| 25 | All the functions below are called by the corresponding functions
|
|---|
| 26 | from coffswap.h.
|
|---|
| 27 | The only thing what they do is to adjust the information stored in
|
|---|
| 28 | the COFF file which are offset into the file.
|
|---|
| 29 | This is needed, because DJGPP uses a very special way to load and run
|
|---|
| 30 | the coff image. It loads the image in memory and assumes then, that the
|
|---|
| 31 | image had no stub by using the filepointers as pointers in the coff
|
|---|
| 32 | image and NOT in the file.
|
|---|
| 33 |
|
|---|
| 34 | To be compatible with any existing executables I have fixed this
|
|---|
| [609] | 35 | here and NOT in the DJGPP startup code. */
|
|---|
| [10] | 36 |
|
|---|
| 37 | #define TARGET_SYM go32stubbedcoff_vec
|
|---|
| 38 | #define TARGET_NAME "coff-go32-exe"
|
|---|
| 39 | #define TARGET_UNDERSCORE '_'
|
|---|
| 40 | #define COFF_GO32_EXE
|
|---|
| 41 | #define COFF_LONG_SECTION_NAMES
|
|---|
| 42 | #define COFF_SUPPORT_GNU_LINKONCE
|
|---|
| 43 | #define COFF_LONG_FILENAMES
|
|---|
| 44 |
|
|---|
| 45 | #define COFF_SECTION_ALIGNMENT_ENTRIES \
|
|---|
| 46 | { COFF_SECTION_NAME_EXACT_MATCH (".data"), \
|
|---|
| 47 | COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \
|
|---|
| 48 | { COFF_SECTION_NAME_EXACT_MATCH (".text"), \
|
|---|
| [609] | 49 | COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \
|
|---|
| 50 | { COFF_SECTION_NAME_PARTIAL_MATCH (".debug"), \
|
|---|
| 51 | COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 0 }, \
|
|---|
| 52 | { COFF_SECTION_NAME_PARTIAL_MATCH (".gnu.linkonce.wi"), \
|
|---|
| 53 | COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 0 }
|
|---|
| [10] | 54 |
|
|---|
| 55 | #include "bfd.h"
|
|---|
| 56 |
|
|---|
| [609] | 57 | /* At first the prototypes. */
|
|---|
| [10] | 58 |
|
|---|
| 59 | static void
|
|---|
| [609] | 60 | adjust_filehdr_in_post PARAMS ((bfd *, PTR, PTR));
|
|---|
| [10] | 61 | static void
|
|---|
| [609] | 62 | adjust_filehdr_out_pre PARAMS ((bfd *, PTR, PTR));
|
|---|
| [10] | 63 | static void
|
|---|
| [609] | 64 | adjust_filehdr_out_post PARAMS ((bfd *, PTR, PTR));
|
|---|
| [10] | |
|---|