* aoutx.h (aout_*_adjust_sizes_and_vmas): Avoid `sanity'
check for the case where the user sets the address of the BSS section (and the file header can't specify this). Let the user set it wherever they want, regardless of what goes in the header. Fixes #ld/1826 (the fix was never checked in by Steve or Ken).
This commit is contained in:
parent
b07d03ba16
commit
a99c3d7094
2 changed files with 226 additions and 203 deletions
|
@ -1,5 +1,10 @@
|
||||||
Thu Apr 15 01:00:29 1993 John Gilmore (gnu@cygnus.com)
|
Thu Apr 15 01:00:29 1993 John Gilmore (gnu@cygnus.com)
|
||||||
|
|
||||||
|
* aoutx.h (aout_*_adjust_sizes_and_vmas): Avoid `sanity'
|
||||||
|
check for the case where the user sets the address of the BSS
|
||||||
|
section (and the file header can't specify this). Let the user
|
||||||
|
set it wherever they want, regardless of what goes in the header.
|
||||||
|
|
||||||
* ieee.c (ieee_slurp_sections): Pass all ieee section names
|
* ieee.c (ieee_slurp_sections): Pass all ieee section names
|
||||||
straight through into BFD sections. Add comments.
|
straight through into BFD sections. Add comments.
|
||||||
|
|
||||||
|
|
82
bfd/aoutx.h
82
bfd/aoutx.h
|
@ -1,5 +1,5 @@
|
||||||
/* BFD semi-generic back-end for a.out binaries.
|
/* BFD semi-generic back-end for a.out binaries.
|
||||||
Copyright 1990, 1991, 1992 Free Software Foundation, Inc.
|
Copyright 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
|
||||||
Written by Cygnus Support.
|
Written by Cygnus Support.
|
||||||
|
|
||||||
This file is part of BFD, the Binary File Descriptor library.
|
This file is part of BFD, the Binary File Descriptor library.
|
||||||
|
@ -120,6 +120,7 @@ DESCRIPTION
|
||||||
#define KEEPIT flags
|
#define KEEPIT flags
|
||||||
#define KEEPITTYPE int
|
#define KEEPITTYPE int
|
||||||
|
|
||||||
|
#include <string.h> /* For strchr and friends */
|
||||||
#include "bfd.h"
|
#include "bfd.h"
|
||||||
#include <sysdep.h>
|
#include <sysdep.h>
|
||||||
#include <ansidecl.h>
|
#include <ansidecl.h>
|
||||||
|
@ -216,6 +217,7 @@ DEFUN(NAME(aout,reloc_type_lookup),(abfd,code),
|
||||||
EXT (BFD_RELOC_HI22, 8);
|
EXT (BFD_RELOC_HI22, 8);
|
||||||
EXT (BFD_RELOC_LO10, 11);
|
EXT (BFD_RELOC_LO10, 11);
|
||||||
EXT (BFD_RELOC_32_PCREL_S2, 6);
|
EXT (BFD_RELOC_32_PCREL_S2, 6);
|
||||||
|
default: return (CONST struct reloc_howto_struct *) 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
/* std relocs */
|
/* std relocs */
|
||||||
|
@ -226,8 +228,8 @@ DEFUN(NAME(aout,reloc_type_lookup),(abfd,code),
|
||||||
STD (BFD_RELOC_8_PCREL, 4);
|
STD (BFD_RELOC_8_PCREL, 4);
|
||||||
STD (BFD_RELOC_16_PCREL, 5);
|
STD (BFD_RELOC_16_PCREL, 5);
|
||||||
STD (BFD_RELOC_32_PCREL, 6);
|
STD (BFD_RELOC_32_PCREL, 6);
|
||||||
|
default: return (CONST struct reloc_howto_struct *) 0;
|
||||||
}
|
}
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extern bfd_error_vector_type bfd_error_vector;
|
extern bfd_error_vector_type bfd_error_vector;
|
||||||
|
@ -818,18 +820,7 @@ DEFUN (NAME (aout,adjust_sizes_and_vmas), (abfd, text_size, text_end),
|
||||||
execp->a_data = BFD_ALIGN (obj_datasec(abfd)->_raw_size,
|
execp->a_data = BFD_ALIGN (obj_datasec(abfd)->_raw_size,
|
||||||
adata(abfd).page_size);
|
adata(abfd).page_size);
|
||||||
data_pad = execp->a_data - obj_datasec(abfd)->_raw_size;
|
data_pad = execp->a_data - obj_datasec(abfd)->_raw_size;
|
||||||
/* This code is almost surely botched. It'll only get tested
|
|
||||||
for the case where the application does explicitly set the VMA
|
|
||||||
of the BSS section. */
|
|
||||||
if (obj_bsssec(abfd)->user_set_vma
|
|
||||||
&& (obj_bsssec(abfd)->vma
|
|
||||||
> BFD_ALIGN (obj_datasec(abfd)->vma
|
|
||||||
+ obj_datasec(abfd)->_raw_size,
|
|
||||||
adata(abfd).page_size)))
|
|
||||||
{
|
|
||||||
/* Can't play with squeezing into data pages; fix this code. */
|
|
||||||
abort ();
|
|
||||||
}
|
|
||||||
if (!obj_bsssec(abfd)->user_set_vma)
|
if (!obj_bsssec(abfd)->user_set_vma)
|
||||||
obj_bsssec(abfd)->vma = (obj_datasec(abfd)->vma
|
obj_bsssec(abfd)->vma = (obj_datasec(abfd)->vma
|
||||||
+ obj_datasec(abfd)->_raw_size);
|
+ obj_datasec(abfd)->_raw_size);
|
||||||
|
@ -1019,10 +1010,20 @@ boolean
|
||||||
stabilised these should be inlined into their (single) caller */
|
stabilised these should be inlined into their (single) caller */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
DEFUN(translate_from_native_sym_flags,(sym_pointer, cache_ptr, abfd),
|
DEFUN (translate_from_native_sym_flags, (sym_pointer, cache_ptr, abfd, statep),
|
||||||
struct external_nlist *sym_pointer AND
|
struct external_nlist *sym_pointer AND
|
||||||
aout_symbol_type * cache_ptr AND
|
aout_symbol_type * cache_ptr AND
|
||||||
bfd *abfd)
|
bfd * abfd AND
|
||||||
|
int *statep)
|
||||||
|
{
|
||||||
|
if (*statep)
|
||||||
|
{
|
||||||
|
/* This is an indirect symbol */
|
||||||
|
cache_ptr->symbol.flags = BSF_DEBUGGING;
|
||||||
|
cache_ptr->symbol.section = &bfd_und_section;
|
||||||
|
*statep = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
switch (cache_ptr->type & N_TYPE)
|
switch (cache_ptr->type & N_TYPE)
|
||||||
{
|
{
|
||||||
|
@ -1099,11 +1100,13 @@ DEFUN(translate_from_native_sym_flags,(sym_pointer, cache_ptr, abfd),
|
||||||
is the symbol to associate the warning with */
|
is the symbol to associate the warning with */
|
||||||
cache_ptr->symbol.flags = BSF_DEBUGGING | BSF_WARNING;
|
cache_ptr->symbol.flags = BSF_DEBUGGING | BSF_WARNING;
|
||||||
cache_ptr->symbol.value = (bfd_vma) ((cache_ptr + 1));
|
cache_ptr->symbol.value = (bfd_vma) ((cache_ptr + 1));
|
||||||
/* We furgle with the next symbol in place. We don't want it to be undefined, we'll trample the type */
|
/* We furgle with the next symbol in place.
|
||||||
|
We don't want it to be undefined, we'll trample the type */
|
||||||
(sym_pointer + 1)->e_type[0] = 0xff;
|
(sym_pointer + 1)->e_type[0] = 0xff;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if ((cache_ptr->type | N_EXT) == (N_INDR | N_EXT)) {
|
if ((cache_ptr->type | N_EXT) == (N_INDR | N_EXT))
|
||||||
|
{
|
||||||
/* Two symbols in a row for an INDR message. The first symbol
|
/* Two symbols in a row for an INDR message. The first symbol
|
||||||
contains the name we will match, the second symbol contains the
|
contains the name we will match, the second symbol contains the
|
||||||
name the first name is translated into. It is supplied to us
|
name the first name is translated into. It is supplied to us
|
||||||
|
@ -1111,12 +1114,12 @@ DEFUN(translate_from_native_sym_flags,(sym_pointer, cache_ptr, abfd),
|
||||||
define it */
|
define it */
|
||||||
cache_ptr->symbol.flags = BSF_DEBUGGING | BSF_INDIRECT;
|
cache_ptr->symbol.flags = BSF_DEBUGGING | BSF_INDIRECT;
|
||||||
cache_ptr->symbol.value = (bfd_vma) ((cache_ptr + 1));
|
cache_ptr->symbol.value = (bfd_vma) ((cache_ptr + 1));
|
||||||
cache_ptr->symbol.section = &bfd_und_section;
|
cache_ptr->symbol.section = &bfd_ind_section;
|
||||||
break;
|
*statep = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else if (sym_is_debugger_info (cache_ptr))
|
||||||
if (sym_is_debugger_info (cache_ptr)) {
|
{
|
||||||
cache_ptr->symbol.flags = BSF_DEBUGGING;
|
cache_ptr->symbol.flags = BSF_DEBUGGING;
|
||||||
/* Work out the section correct for this symbol */
|
/* Work out the section correct for this symbol */
|
||||||
switch (cache_ptr->type & N_TYPE)
|
switch (cache_ptr->type & N_TYPE)
|
||||||
|
@ -1141,14 +1144,16 @@ DEFUN(translate_from_native_sym_flags,(sym_pointer, cache_ptr, abfd),
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
|
|
||||||
if (sym_is_fortrancommon (cache_ptr))
|
if (sym_is_fortrancommon (cache_ptr))
|
||||||
{
|
{
|
||||||
cache_ptr->symbol.flags = 0;
|
cache_ptr->symbol.flags = 0;
|
||||||
cache_ptr->symbol.section = &bfd_com_section;
|
cache_ptr->symbol.section = &bfd_com_section;
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1161,19 +1166,23 @@ DEFUN(translate_from_native_sym_flags,(sym_pointer, cache_ptr, abfd),
|
||||||
* to find the section relative address.
|
* to find the section relative address.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (sym_in_text_section (cache_ptr)) {
|
if (sym_in_text_section (cache_ptr))
|
||||||
|
{
|
||||||
cache_ptr->symbol.value -= obj_textsec (abfd)->vma;
|
cache_ptr->symbol.value -= obj_textsec (abfd)->vma;
|
||||||
cache_ptr->symbol.section = obj_textsec (abfd);
|
cache_ptr->symbol.section = obj_textsec (abfd);
|
||||||
}
|
}
|
||||||
else if (sym_in_data_section (cache_ptr)){
|
else if (sym_in_data_section (cache_ptr))
|
||||||
|
{
|
||||||
cache_ptr->symbol.value -= obj_datasec (abfd)->vma;
|
cache_ptr->symbol.value -= obj_datasec (abfd)->vma;
|
||||||
cache_ptr->symbol.section = obj_datasec (abfd);
|
cache_ptr->symbol.section = obj_datasec (abfd);
|
||||||
}
|
}
|
||||||
else if (sym_in_bss_section(cache_ptr)) {
|
else if (sym_in_bss_section (cache_ptr))
|
||||||
|
{
|
||||||
cache_ptr->symbol.section = obj_bsssec (abfd);
|
cache_ptr->symbol.section = obj_bsssec (abfd);
|
||||||
cache_ptr->symbol.value -= obj_bsssec (abfd)->vma;
|
cache_ptr->symbol.value -= obj_bsssec (abfd)->vma;
|
||||||
}
|
}
|
||||||
else if (sym_is_undefined (cache_ptr)) {
|
else if (sym_is_undefined (cache_ptr))
|
||||||
|
{
|
||||||
cache_ptr->symbol.flags = 0;
|
cache_ptr->symbol.flags = 0;
|
||||||
cache_ptr->symbol.section = &bfd_und_section;
|
cache_ptr->symbol.section = &bfd_und_section;
|
||||||
}
|
}
|
||||||
|
@ -1193,6 +1202,7 @@ DEFUN(translate_from_native_sym_flags,(sym_pointer, cache_ptr, abfd),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1208,6 +1218,7 @@ DEFUN(translate_to_native_sym_flags,(sym_pointer, cache_ptr, abfd),
|
||||||
to another */
|
to another */
|
||||||
sym_pointer->e_type[0] &= ~N_TYPE;
|
sym_pointer->e_type[0] &= ~N_TYPE;
|
||||||
|
|
||||||
|
|
||||||
if (bfd_get_output_section(cache_ptr) == obj_bsssec (abfd)) {
|
if (bfd_get_output_section(cache_ptr) == obj_bsssec (abfd)) {
|
||||||
sym_pointer->e_type[0] |= N_BSS;
|
sym_pointer->e_type[0] |= N_BSS;
|
||||||
}
|
}
|
||||||
|
@ -1225,6 +1236,10 @@ DEFUN(translate_to_native_sym_flags,(sym_pointer, cache_ptr, abfd),
|
||||||
{
|
{
|
||||||
sym_pointer->e_type[0] = (N_UNDF | N_EXT);
|
sym_pointer->e_type[0] = (N_UNDF | N_EXT);
|
||||||
}
|
}
|
||||||
|
else if (bfd_get_output_section(cache_ptr) == &bfd_ind_section)
|
||||||
|
{
|
||||||
|
sym_pointer->e_type[0] = N_INDR;
|
||||||
|
}
|
||||||
else if (bfd_is_com_section (bfd_get_output_section (cache_ptr))) {
|
else if (bfd_is_com_section (bfd_get_output_section (cache_ptr))) {
|
||||||
sym_pointer->e_type[0] = (N_UNDF | N_EXT);
|
sym_pointer->e_type[0] = (N_UNDF | N_EXT);
|
||||||
}
|
}
|
||||||
|
@ -1323,10 +1338,12 @@ DEFUN(NAME(aout,slurp_symbol_table),(abfd),
|
||||||
if (bfd_read ((PTR)strings, 1, string_size, abfd) != string_size) {
|
if (bfd_read ((PTR)strings, 1, string_size, abfd) != string_size) {
|
||||||
goto bailout;
|
goto bailout;
|
||||||
}
|
}
|
||||||
|
strings[string_size] = 0; /* Just in case. */
|
||||||
|
|
||||||
/* OK, now walk the new symtable, cacheing symbol properties */
|
/* OK, now walk the new symtable, cacheing symbol properties */
|
||||||
{
|
{
|
||||||
register struct external_nlist *sym_pointer;
|
register struct external_nlist *sym_pointer;
|
||||||
|
int state = 0;
|
||||||
register struct external_nlist *sym_end = syms + bfd_get_symcount (abfd);
|
register struct external_nlist *sym_end = syms + bfd_get_symcount (abfd);
|
||||||
register aout_symbol_type *cache_ptr = cached;
|
register aout_symbol_type *cache_ptr = cached;
|
||||||
|
|
||||||
|
@ -1334,19 +1351,20 @@ DEFUN(NAME(aout,slurp_symbol_table),(abfd),
|
||||||
for (sym_pointer = syms, cache_ptr = cached;
|
for (sym_pointer = syms, cache_ptr = cached;
|
||||||
sym_pointer < sym_end; sym_pointer ++, cache_ptr++)
|
sym_pointer < sym_end; sym_pointer ++, cache_ptr++)
|
||||||
{
|
{
|
||||||
bfd_vma x = GET_WORD(abfd, sym_pointer->e_strx);
|
long x = GET_WORD(abfd, sym_pointer->e_strx);
|
||||||
cache_ptr->symbol.the_bfd = abfd;
|
cache_ptr->symbol.the_bfd = abfd;
|
||||||
if (x)
|
if (x >= 0 && x < string_size)
|
||||||
cache_ptr->symbol.name = x + strings;
|
cache_ptr->symbol.name = x + strings;
|
||||||
else
|
else
|
||||||
cache_ptr->symbol.name = (char *)NULL;
|
goto bailout;
|
||||||
|
|
||||||
cache_ptr->symbol.value = GET_SWORD(abfd, sym_pointer->e_value);
|
cache_ptr->symbol.value = GET_SWORD(abfd, sym_pointer->e_value);
|
||||||
cache_ptr->desc = bfd_h_get_16(abfd, sym_pointer->e_desc);
|
cache_ptr->desc = bfd_h_get_16(abfd, sym_pointer->e_desc);
|
||||||
cache_ptr->other = bfd_h_get_8(abfd, sym_pointer->e_other);
|
cache_ptr->other = bfd_h_get_8(abfd, sym_pointer->e_other);
|
||||||
cache_ptr->type = bfd_h_get_8(abfd, sym_pointer->e_type);
|
cache_ptr->type = bfd_h_get_8(abfd, sym_pointer->e_type);
|
||||||
cache_ptr->symbol.udata = 0;
|
cache_ptr->symbol.udata = 0;
|
||||||
translate_from_native_sym_flags (sym_pointer, cache_ptr, abfd);
|
translate_from_native_sym_flags (sym_pointer, cache_ptr,
|
||||||
|
abfd, &state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue