Update to correctly sign-extend 32-bit ECOFF null values (0xffffffff, -1)

This commit is contained in:
Nick Clifton 2002-09-19 15:31:30 +00:00
parent 54951bd7b5
commit 1c59ba3fd5
2 changed files with 139 additions and 103 deletions

View File

@ -1,3 +1,10 @@
2002-09-19 Nathan Tallent <eraxxon@alumni.rice.edu>
* ecoffswap.h (ecoff_swap_pdr_in) <isym, iline>: Update to
correctly sign-extend 32-bit ECOFF null values (0xffffffff, -1)
on 64 bit machines.
(ecoff_swap_sym_in) <iss>: Likewise.
2002-09-19 Daniel Jacobowitz <drow@mvista.com>
* elf32-arm.h (elf32_arm_adjust_dynamic_symbol): Update

View File

@ -1,5 +1,5 @@
/* Generic ECOFF swapping routines, for BFD.
Copyright 1992, 1993, 1994, 1995, 1996, 2000, 2001
Copyright 1992, 1993, 1994, 1995, 1996, 2000, 2001, 2002
Free Software Foundation, Inc.
Written by Cygnus Support.
@ -220,7 +220,7 @@ ecoff_swap_fdr_in (abfd, ext_copy, intern)
intern->rfdBase = H_GET_32 (abfd, ext->f_rfdBase);
intern->crfd = H_GET_32 (abfd, ext->f_crfd);
/* now the fun stuff... */
/* Now the fun stuff... */
if (bfd_header_big_endian (abfd))
{
intern->lang = ((ext->f_bits1[0] & FDR_BITS1_LANG_BIG)
@ -263,7 +263,8 @@ ecoff_swap_fdr_out (abfd, intern_copy, ext_ptr)
struct fdr_ext *ext = (struct fdr_ext *) ext_ptr;
FDR intern[1];
*intern = *intern_copy; /* Make it reasonable to do in-place. */
/* Make it reasonable to do in-place. */
*intern = *intern_copy;
ECOFF_PUT_OFF (abfd, intern->adr, ext->f_adr);
H_PUT_32 (abfd, intern->rss, ext->f_rss);
@ -288,7 +289,7 @@ ecoff_swap_fdr_out (abfd, intern_copy, ext_ptr)
H_PUT_32 (abfd, intern->rfdBase, ext->f_rfdBase);
H_PUT_32 (abfd, intern->crfd, ext->f_crfd);
/* now the fun stuff... */
/* Now the fun stuff... */
if (bfd_header_big_endian (abfd))
{
ext->f_bits1[0] = (((intern->lang << FDR_BITS1_LANG_SH_BIG)
@ -355,6 +356,11 @@ ecoff_swap_pdr_in (abfd, ext_copy, intern)
intern->cbLineOffset = ECOFF_GET_OFF (abfd, ext->p_cbLineOffset);
#if defined (ECOFF_64) || defined (ECOFF_SIGNED_64)
if (intern->isym == (signed long) 0xffffffff)
intern->isym = -1;
if (intern->iline == (signed long) 0xffffffff)
intern->iline = -1;
intern->gp_prologue = H_GET_8 (abfd, ext->p_gp_prologue);
if (bfd_header_big_endian (abfd))
{
@ -396,7 +402,8 @@ ecoff_swap_pdr_out (abfd, intern_copy, ext_ptr)
struct pdr_ext *ext = (struct pdr_ext *) ext_ptr;
PDR intern[1];
*intern = *intern_copy; /* Make it reasonable to do in-place. */
/* Make it reasonable to do in-place. */
*intern = *intern_copy;
ECOFF_PUT_OFF (abfd, intern->adr, ext->p_adr);
H_PUT_32 (abfd, intern->isym, ext->p_isym);
@ -494,7 +501,8 @@ ecoff_swap_pdr_out (abfd, intern_copy, ext_ptr)
struct pdr_ext *ext = (struct pdr_ext *) ext_ptr;
PDR intern[1];
*intern = *intern_copy; /* Make it reasonable to do in-place. */
/* Make it reasonable to do in-place. */
*intern = *intern_copy;
ECOFF_PUT_OFF (abfd, intern->adr, ext->p_adr);
H_PUT_32 (abfd, intern->isym, ext->p_isym);
@ -533,8 +541,14 @@ ecoff_swap_sym_in (abfd, ext_copy, intern)
intern->iss = H_GET_32 (abfd, ext->s_iss);
intern->value = ECOFF_GET_OFF (abfd, ext->s_value);
/* now the fun stuff... */
if (bfd_header_big_endian (abfd)) {
#if defined (ECOFF_64) || defined (ECOFF_SIGNED_64)
if (intern->iss == (signed long) 0xffffffff)
intern->iss = -1;
#endif
/* Now the fun stuff... */
if (bfd_header_big_endian (abfd))
{
intern->st = (ext->s_bits1[0] & SYM_BITS1_ST_BIG)
>> SYM_BITS1_ST_SH_BIG;
intern->sc = ((ext->s_bits1[0] & SYM_BITS1_SC_BIG)
@ -546,7 +560,9 @@ ecoff_swap_sym_in (abfd, ext_copy, intern)
<< SYM_BITS2_INDEX_SH_LEFT_BIG)
| (ext->s_bits3[0] << SYM_BITS3_INDEX_SH_LEFT_BIG)
| (ext->s_bits4[0] << SYM_BITS4_INDEX_SH_LEFT_BIG);
} else {
}
else
{
intern->st = (ext->s_bits1[0] & SYM_BITS1_ST_LITTLE)
>> SYM_BITS1_ST_SH_LITTLE;
intern->sc = ((ext->s_bits1[0] & SYM_BITS1_SC_LITTLE)
@ -578,13 +594,15 @@ ecoff_swap_sym_out (abfd, intern_copy, ext_ptr)
struct sym_ext *ext = (struct sym_ext *) ext_ptr;
SYMR intern[1];
*intern = *intern_copy; /* Make it reasonable to do in-place. */
/* Make it reasonable to do in-place. */
*intern = *intern_copy;
H_PUT_32 (abfd, intern->iss, ext->s_iss);
ECOFF_PUT_OFF (abfd, intern->value, ext->s_value);
/* now the fun stuff... */
if (bfd_header_big_endian (abfd)) {
/* Now the fun stuff... */
if (bfd_header_big_endian (abfd))
{
ext->s_bits1[0] = (((intern->st << SYM_BITS1_ST_SH_BIG)
& SYM_BITS1_ST_BIG)
| ((intern->sc >> SYM_BITS1_SC_SH_LEFT_BIG)
@ -596,7 +614,9 @@ ecoff_swap_sym_out (abfd, intern_copy, ext_ptr)
& SYM_BITS2_INDEX_BIG));
ext->s_bits3[0] = (intern->index >> SYM_BITS3_INDEX_SH_LEFT_BIG) & 0xff;
ext->s_bits4[0] = (intern->index >> SYM_BITS4_INDEX_SH_LEFT_BIG) & 0xff;
} else {
}
else
{
ext->s_bits1[0] = (((intern->st << SYM_BITS1_ST_SH_LITTLE)
& SYM_BITS1_ST_LITTLE)
| ((intern->sc << SYM_BITS1_SC_SH_LITTLE)
@ -628,12 +648,15 @@ ecoff_swap_ext_in (abfd, ext_copy, intern)
*ext = *(struct ext_ext *) ext_copy;
/* now the fun stuff... */
if (bfd_header_big_endian (abfd)) {
/* Now the fun stuff... */
if (bfd_header_big_endian (abfd))
{
intern->jmptbl = 0 != (ext->es_bits1[0] & EXT_BITS1_JMPTBL_BIG);
intern->cobol_main = 0 != (ext->es_bits1[0] & EXT_BITS1_COBOL_MAIN_BIG);
intern->weakext = 0 != (ext->es_bits1[0] & EXT_BITS1_WEAKEXT_BIG);
} else {
}
else
{
intern->jmptbl = 0 != (ext->es_bits1[0] & EXT_BITS1_JMPTBL_LITTLE);
intern->cobol_main = 0 != (ext->es_bits1[0] & EXT_BITS1_COBOL_MAIN_LITTLE);
intern->weakext = 0 != (ext->es_bits1[0] & EXT_BITS1_WEAKEXT_LITTLE);
@ -666,10 +689,12 @@ ecoff_swap_ext_out (abfd, intern_copy, ext_ptr)
struct ext_ext *ext = (struct ext_ext *) ext_ptr;
EXTR intern[1];
*intern = *intern_copy; /* Make it reasonable to do in-place. */
/* Make it reasonable to do in-place. */
*intern = *intern_copy;
/* now the fun stuff... */
if (bfd_header_big_endian (abfd)) {
/* Now the fun stuff... */
if (bfd_header_big_endian (abfd))
{
ext->es_bits1[0] = ((intern->jmptbl ? EXT_BITS1_JMPTBL_BIG : 0)
| (intern->cobol_main ? EXT_BITS1_COBOL_MAIN_BIG : 0)
| (intern->weakext ? EXT_BITS1_WEAKEXT_BIG : 0));
@ -678,7 +703,9 @@ ecoff_swap_ext_out (abfd, intern_copy, ext_ptr)
ext->es_bits2[1] = 0;
ext->es_bits2[2] = 0;
#endif
} else {
}
else
{
ext->es_bits1[0] = ((intern->jmptbl ? EXT_BITS1_JMPTBL_LITTLE : 0)
| (intern->cobol_main ? EXT_BITS1_COBOL_MAIN_LITTLE : 0)
| (intern->weakext ? EXT_BITS1_WEAKEXT_LITTLE : 0));
@ -792,7 +819,8 @@ ecoff_swap_opt_out (abfd, intern_copy, ext_ptr)
struct opt_ext *ext = (struct opt_ext *) ext_ptr;
OPTR intern[1];
*intern = *intern_copy; /* Make it reasonable to do in-place. */
/* Make it reasonable to do in-place. */
*intern = *intern_copy;
if (bfd_header_big_endian (abfd))
{
@ -852,7 +880,8 @@ ecoff_swap_dnr_out (abfd, intern_copy, ext_ptr)
struct dnr_ext *ext = (struct dnr_ext *) ext_ptr;
DNR intern[1];
*intern = *intern_copy; /* Make it reasonable to do in-place. */
/* Make it reasonable to do in-place. */
*intern = *intern_copy;
H_PUT_32 (abfd, intern->rfd, ext->d_rfd);
H_PUT_32 (abfd, intern->index, ext->d_index);