mirror of
https://github.com/darlinghq/darling-gdb.git
synced 2024-11-30 07:20:41 +00:00
* aout-target.h (MY_zmagic_contiguous): Define as 0 if not already
defined. (MY(backend_data)): Use MY_zmagic_contiguous, not hardcoded 0. * i386linux.c (MY_zmagic_contiguous): Define.
This commit is contained in:
parent
823609fe90
commit
a932d0ffb7
@ -1,5 +1,10 @@
|
||||
Mon Aug 15 12:16:56 1994 Ian Lance Taylor (ian@sanguine.cygnus.com)
|
||||
|
||||
* aout-target.h (MY_zmagic_contiguous): Define as 0 if not already
|
||||
defined.
|
||||
(MY(backend_data)): Use MY_zmagic_contiguous, not hardcoded 0.
|
||||
* i386linux.c (MY_zmagic_contiguous): Define.
|
||||
|
||||
* elfcode.h (bfd_section_from_shdr): If a SHT_SYMTAB section in a
|
||||
shared object has SHF_ALLOC set, create a BFD section for it.
|
||||
(elf_section_from_bfd_section): There may be a BFD section for a
|
||||
|
@ -27,11 +27,13 @@ extern CONST struct reloc_howto_struct * NAME(aout,reloc_type_lookup) ();
|
||||
/* Set parameters about this a.out file that are machine-dependent.
|
||||
This routine is called from some_aout_object_p just before it returns. */
|
||||
#ifndef MY_callback
|
||||
static bfd_target *
|
||||
static const bfd_target *
|
||||
MY(callback) (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
struct internal_exec *execp = exec_hdr (abfd);
|
||||
unsigned int arch_align_power;
|
||||
unsigned long arch_align;
|
||||
|
||||
/* Calculate the file positions of the parts of a newly read aout header */
|
||||
obj_textsec (abfd)->_raw_size = N_TXTSIZE(*execp);
|
||||
@ -63,11 +65,22 @@ MY(callback) (abfd)
|
||||
/* Now that we know the architecture, set the alignments of the
|
||||
sections. This is normally done by NAME(aout,new_section_hook),
|
||||
but when the initial sections were created the architecture had
|
||||
not yet been set. */
|
||||
obj_textsec (abfd)->alignment_power =
|
||||
obj_datasec (abfd)->alignment_power =
|
||||
obj_bsssec (abfd)->alignment_power =
|
||||
bfd_get_arch_info (abfd)->section_align_power;
|
||||
not yet been set. However, for backward compatibility, we don't
|
||||
set the alignment power any higher than as required by the size
|
||||
of the section. */
|
||||
arch_align_power = bfd_get_arch_info (abfd)->section_align_power;
|
||||
arch_align = 1 << arch_align_power;
|
||||
if ((BFD_ALIGN (obj_textsec (abfd)->_raw_size, arch_align)
|
||||
== obj_textsec (abfd)->_raw_size)
|
||||
&& (BFD_ALIGN (obj_datasec (abfd)->_raw_size, arch_align)
|
||||
== obj_datasec (abfd)->_raw_size)
|
||||
&& (BFD_ALIGN (obj_bsssec (abfd)->_raw_size, arch_align)
|
||||
== obj_bsssec (abfd)->_raw_size))
|
||||
{
|
||||
obj_textsec (abfd)->alignment_power = arch_align_power;
|
||||
obj_datasec (abfd)->alignment_power = arch_align_power;
|
||||
obj_bsssec (abfd)->alignment_power = arch_align_power;
|
||||
}
|
||||
|
||||
/* Don't set sizes now -- can't be sure until we know arch & mach.
|
||||
Sizes get set in set_sizes callback, later. */
|
||||
@ -88,13 +101,13 @@ MY(callback) (abfd)
|
||||
#ifndef MY_object_p
|
||||
/* Finish up the reading of an a.out file header */
|
||||
|
||||
static bfd_target *
|
||||
static const bfd_target *
|
||||
MY(object_p) (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
struct external_exec exec_bytes; /* Raw exec header from file */
|
||||
struct internal_exec exec; /* Cleaned-up exec header */
|
||||
bfd_target *target;
|
||||
const bfd_target *target;
|
||||
|
||||
if (bfd_read ((PTR) &exec_bytes, 1, EXEC_BYTES_SIZE, abfd)
|
||||
!= EXEC_BYTES_SIZE) {
|
||||
@ -115,6 +128,12 @@ MY(object_p) (abfd)
|
||||
#endif
|
||||
|
||||
NAME(aout,swap_exec_header_in)(abfd, &exec_bytes, &exec);
|
||||
|
||||
#ifdef SWAP_MAGIC
|
||||
/* swap_exec_header_in read in a_info with the wrong byte order */
|
||||
exec.a_info = SWAP_MAGIC (exec_bytes.e_info);
|
||||
#endif /* SWAP_MAGIC */
|
||||
|
||||
target = NAME(aout,some_aout_object_p) (abfd, &exec, MY(callback));
|
||||
|
||||
#ifdef ENTRY_CAN_BE_ZERO
|
||||
@ -217,11 +236,19 @@ MY(set_sizes) (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
adata(abfd).page_size = PAGE_SIZE;
|
||||
|
||||
#ifdef SEGMENT_SIZE
|
||||
adata(abfd).segment_size = SEGMENT_SIZE;
|
||||
#else
|
||||
adata(abfd).segment_size = PAGE_SIZE;
|
||||
#endif
|
||||
|
||||
#ifdef ZMAGIC_DISK_BLOCK_SIZE
|
||||
adata(abfd).zmagic_disk_block_size = ZMAGIC_DISK_BLOCK_SIZE;
|
||||
#else
|
||||
adata(abfd).zmagic_disk_block_size = PAGE_SIZE;
|
||||
#endif
|
||||
|
||||
adata(abfd).exec_bytes_size = EXEC_BYTES_SIZE;
|
||||
return true;
|
||||
}
|
||||
@ -234,6 +261,9 @@ MY(set_sizes) (abfd)
|
||||
|
||||
#ifndef MY_backend_data
|
||||
|
||||
#ifndef MY_zmagic_contiguous
|
||||
#define MY_zmagic_contiguous 0
|
||||
#endif
|
||||
#ifndef MY_text_includes_header
|
||||
#define MY_text_includes_header 0
|
||||
#endif
|
||||
@ -257,7 +287,7 @@ MY(set_sizes) (abfd)
|
||||
#endif
|
||||
|
||||
static CONST struct aout_backend_data MY(backend_data) = {
|
||||
0, /* zmagic contiguous */
|
||||
MY_zmagic_contiguous,
|
||||
MY_text_includes_header,
|
||||
MY_exec_hdr_flags,
|
||||
0, /* text vma? */
|
||||
@ -472,7 +502,7 @@ MY_bfd_final_link (abfd, info)
|
||||
#endif
|
||||
|
||||
#ifndef MY_BFD_TARGET
|
||||
bfd_target MY(vec) =
|
||||
const bfd_target MY(vec) =
|
||||
{
|
||||
TARGETNAME, /* name */
|
||||
bfd_target_aout_flavour,
|
||||
|
@ -22,7 +22,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
#define SEGMENT_SIZE 4096
|
||||
#define TEXT_START_ADDR 0x0
|
||||
#define N_SHARED_LIB(x) 0
|
||||
#define ARCH 32
|
||||
#define BYTES_IN_WORD 4
|
||||
|
||||
#include "bfd.h"
|
||||
@ -35,7 +34,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
#define DEFAULT_ARCH bfd_arch_i386
|
||||
#define MY(OP) CAT(i386linux_,OP)
|
||||
#define MY_text_includes_header 1
|
||||
#define TARGETNAME "a.out-i386-linux"
|
||||
|
||||
/* We always generate QMAGIC files in preference to ZMAGIC files. It
|
||||
@ -343,7 +341,8 @@ linux_add_one_symbol (info, abfd, name, flags, section, value, string,
|
||||
|
||||
if (! info->relocateable
|
||||
&& linux_hash_table (info)->dynobj == NULL
|
||||
&& strcmp (name, SHARABLE_CONFLICTS) == 0)
|
||||
&& strcmp (name, SHARABLE_CONFLICTS) == 0
|
||||
&& (flags & BSF_CONSTRUCTOR) != 0)
|
||||
{
|
||||
if (! linux_link_create_dynamic_sections (abfd, info))
|
||||
return false;
|
||||
@ -351,7 +350,7 @@ linux_add_one_symbol (info, abfd, name, flags, section, value, string,
|
||||
insert = true;
|
||||
}
|
||||
|
||||
if (section == &bfd_abs_section
|
||||
if (bfd_is_abs_section (section)
|
||||
&& (IS_GOT_SYM (name) || IS_PLT_SYM (name)))
|
||||
{
|
||||
h = linux_link_hash_lookup (linux_hash_table (info), name, false,
|
||||
@ -359,12 +358,18 @@ linux_add_one_symbol (info, abfd, name, flags, section, value, string,
|
||||
if (h != NULL
|
||||
&& h->root.root.type == bfd_link_hash_defined)
|
||||
{
|
||||
if (new_fixup (info, h, value, ! IS_PLT_SYM(name)) == NULL)
|
||||
struct fixup *f;
|
||||
|
||||
if (hashp != NULL)
|
||||
*hashp = (struct bfd_link_hash_entry *) h;
|
||||
|
||||
f = new_fixup (info, h, value, ! IS_PLT_SYM (name));
|
||||
if (f == NULL)
|
||||
return false;
|
||||
f->jump = IS_PLT_SYM (name);
|
||||
|
||||
return true;
|
||||
}
|
||||
if (hashp != NULL)
|
||||
*hashp = (struct bfd_link_hash_entry *) h;
|
||||
}
|
||||
|
||||
/* Do the usual procedure for adding a symbol. */
|
||||
@ -413,6 +418,7 @@ linux_tally_symbols (h, data)
|
||||
struct fixup *f, *f1;
|
||||
int is_plt;
|
||||
struct linux_link_hash_entry *h1, *h2;
|
||||
boolean exists;
|
||||
|
||||
/* If this symbol is not a PLT/GOT, we do not even need to look at it */
|
||||
is_plt = IS_PLT_SYM (h->root.root.root.string);
|
||||
@ -440,38 +446,49 @@ linux_tally_symbols (h, data)
|
||||
from different shared libraries */
|
||||
if (h1 != NULL
|
||||
&& ((h1->root.root.type == bfd_link_hash_defined
|
||||
&& h1->root.root.u.def.section != &bfd_abs_section)
|
||||
&& ! bfd_is_abs_section (h1->root.root.u.def.section))
|
||||
|| h2->root.root.type == bfd_link_hash_indirect))
|
||||
{
|
||||
f = new_fixup (info, h1, h->root.root.u.def.value, 0);
|
||||
if (f == NULL)
|
||||
{
|
||||
/* FIXME: No way to return error. */
|
||||
abort ();
|
||||
}
|
||||
f->jump = is_plt;
|
||||
|
||||
/* See if there is a "builtin" fixup already present
|
||||
involving this symbol. If so, convert it to a regular
|
||||
fixup. In the end, this relaxes some of the requirements
|
||||
about the order of performing fixups. */
|
||||
exists = false;
|
||||
for (f1 = linux_hash_table (info)->fixup_list;
|
||||
f1 != NULL;
|
||||
f1 = f1->next)
|
||||
{
|
||||
if (f1 == f)
|
||||
continue;
|
||||
if (f1->h != h)
|
||||
if (f1->h != h
|
||||
|| (! f1->builtin && ! f1->jump))
|
||||
continue;
|
||||
if (! exists
|
||||
&& bfd_is_abs_section (h->root.root.u.def.section))
|
||||
{
|
||||
f = new_fixup (info, h1, f1->h->root.root.u.def.value, 0);
|
||||
f->jump = is_plt;
|
||||
}
|
||||
f1->h = h1;
|
||||
f1->jump = is_plt;
|
||||
f1->builtin = 0;
|
||||
exists = true;
|
||||
}
|
||||
if (! exists
|
||||
&& bfd_is_abs_section (h->root.root.u.def.section))
|
||||
{
|
||||
f = new_fixup (info, h1, h->root.root.u.def.value, 0);
|
||||
if (f == NULL)
|
||||
{
|
||||
/* FIXME: No way to return error. */
|
||||
abort ();
|
||||
}
|
||||
f->jump = is_plt;
|
||||
}
|
||||
}
|
||||
|
||||
/* Quick and dirty way of stripping these symbols from the
|
||||
symtab. */
|
||||
h->root.written = true;
|
||||
if (bfd_is_abs_section (h->root.root.u.def.section))
|
||||
h->root.written = true;
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -697,4 +714,6 @@ linux_finish_dynamic_link (output_bfd, info)
|
||||
#define MY_add_one_symbol linux_add_one_symbol
|
||||
#define MY_finish_dynamic_link linux_finish_dynamic_link
|
||||
|
||||
#define MY_zmagic_contiguous 1
|
||||
|
||||
#include "aout-target.h"
|
||||
|
Loading…
Reference in New Issue
Block a user