Use a 32-bit value to hold the section number in the internal COFF symbol structure.
PR ld/19440 inc * coff/internal.h (internal_syment): Use int to hold section number. (N_UNDEF): Cast to int not short. (N_ABS): Likewise. (N_DEBUG): Likewise. (N_TV): Likewise. (P_TV): Likewise. bfd PR ld/19440 * coff-rs6000.c (_bfd_xcoff_swap_sym_in): Sign extend external section number into internal section number. * coff64-rs6000.c (_bfd_xcoff64_swap_sym_in): Likewise. * coffswap.h (coff_swap_sym_in): Likewise. * peXXigen.c (_bfd_XXi_swap_sym_in): Likewise. * coffcode.h (_coff_bigobj_swap_sym_in): Make sure that internal section number field is big enough to hold the external value.
This commit is contained in:
parent
f303dbd60d
commit
9ae678af99
8 changed files with 34 additions and 11 deletions
|
@ -1,3 +1,14 @@
|
|||
2016-01-18 Nick Clifton <nickc@redhat.com>
|
||||
|
||||
PR ld/19440
|
||||
* coff-rs6000.c (_bfd_xcoff_swap_sym_in): Sign extend external
|
||||
section number into internal section number.
|
||||
* coff64-rs6000.c (_bfd_xcoff64_swap_sym_in): Likewise.
|
||||
* coffswap.h (coff_swap_sym_in): Likewise.
|
||||
* peXXigen.c (_bfd_XXi_swap_sym_in): Likewise.
|
||||
* coffcode.h (_coff_bigobj_swap_sym_in): Make sure that internal
|
||||
section number field is big enough to hold the external value.
|
||||
|
||||
2016-01-17 Alan Modra <amodra@gmail.com>
|
||||
|
||||
* configure: Regenerate.
|
||||
|
|
|
@ -420,7 +420,7 @@ _bfd_xcoff_swap_sym_in (bfd *abfd, void * ext1, void * in1)
|
|||
}
|
||||
|
||||
in->n_value = H_GET_32 (abfd, ext->e_value);
|
||||
in->n_scnum = H_GET_16 (abfd, ext->e_scnum);
|
||||
in->n_scnum = (short) H_GET_16 (abfd, ext->e_scnum);
|
||||
in->n_type = H_GET_16 (abfd, ext->e_type);
|
||||
in->n_sclass = H_GET_8 (abfd, ext->e_sclass);
|
||||
in->n_numaux = H_GET_8 (abfd, ext->e_numaux);
|
||||
|
|
|
@ -322,7 +322,7 @@ _bfd_xcoff64_swap_sym_in (bfd *abfd, void *ext1, void *in1)
|
|||
in->_n._n_n._n_zeroes = 0;
|
||||
in->_n._n_n._n_offset = H_GET_32 (abfd, ext->e_offset);
|
||||
in->n_value = H_GET_64 (abfd, ext->e_value);
|
||||
in->n_scnum = H_GET_16 (abfd, ext->e_scnum);
|
||||
in->n_scnum = (short) H_GET_16 (abfd, ext->e_scnum);
|
||||
in->n_type = H_GET_16 (abfd, ext->e_type);
|
||||
in->n_sclass = H_GET_8 (abfd, ext->e_sclass);
|
||||
in->n_numaux = H_GET_8 (abfd, ext->e_numaux);
|
||||
|
|
|
@ -5759,6 +5759,7 @@ coff_bigobj_swap_sym_in (bfd * abfd, void * ext1, void * in1)
|
|||
}
|
||||
|
||||
in->n_value = H_GET_32 (abfd, ext->e_value);
|
||||
BFD_ASSERT (sizeof (in->n_scnum) >= 4);
|
||||
in->n_scnum = H_GET_32 (abfd, ext->e_scnum);
|
||||
in->n_type = H_GET_16 (abfd, ext->e_type);
|
||||
in->n_sclass = H_GET_8 (abfd, ext->e_sclass);
|
||||
|
|
|
@ -322,7 +322,7 @@ coff_swap_sym_in (bfd * abfd, void * ext1, void * in1)
|
|||
}
|
||||
|
||||
in->n_value = H_GET_32 (abfd, ext->e_value);
|
||||
in->n_scnum = H_GET_16 (abfd, ext->e_scnum);
|
||||
in->n_scnum = (short) H_GET_16 (abfd, ext->e_scnum);
|
||||
if (sizeof (ext->e_type) == 2)
|
||||
in->n_type = H_GET_16 (abfd, ext->e_type);
|
||||
else
|
||||
|
|
|
@ -119,7 +119,7 @@ _bfd_XXi_swap_sym_in (bfd * abfd, void * ext1, void * in1)
|
|||
memcpy (in->_n._n_name, ext->e.e_name, SYMNMLEN);
|
||||
|
||||
in->n_value = H_GET_32 (abfd, ext->e_value);
|
||||
in->n_scnum = H_GET_16 (abfd, ext->e_scnum);
|
||||
in->n_scnum = (short) H_GET_16 (abfd, ext->e_scnum);
|
||||
|
||||
if (sizeof (ext->e_type) == 2)
|
||||
in->n_type = H_GET_16 (abfd, ext->e_type);
|
||||
|
@ -257,7 +257,7 @@ _bfd_XXi_swap_sym_out (bfd * abfd, void * inp, void * extp)
|
|||
as the worst that can happen is that some absolute symbols are
|
||||
needlessly converted into section relative symbols. */
|
||||
&& in->n_value > ((1ULL << (sizeof (in->n_value) > 4 ? 32 : 31)) - 1)
|
||||
&& in->n_scnum == -1)
|
||||
&& in->n_scnum == N_ABS)
|
||||
{
|
||||
asection * sec;
|
||||
|
||||
|
|
|
@ -1,3 +1,14 @@
|
|||
2016-01-18 Nick Clifton <nickc@redhat.com>
|
||||
|
||||
PR ld/19440
|
||||
* coff/internal.h (internal_syment): Use int to hold section
|
||||
number.
|
||||
(N_UNDEF): Cast to int not short.
|
||||
(N_ABS): Likewise.
|
||||
(N_DEBUG): Likewise.
|
||||
(N_TV): Likewise.
|
||||
(P_TV): Likewise.
|
||||
|
||||
2016-01-11 Nick Clifton <nickc@redhat.com>
|
||||
|
||||
Import this change from GCC mainline:
|
||||
|
|
|
@ -483,7 +483,7 @@ struct internal_syment
|
|||
char *_n_nptr[2]; /* allows for overlaying */
|
||||
} _n;
|
||||
bfd_vma n_value; /* value of symbol */
|
||||
short n_scnum; /* section number */
|
||||
int n_scnum; /* section number */
|
||||
unsigned short n_flags; /* copy of flags from filhdr */
|
||||
unsigned short n_type; /* type and derived type */
|
||||
unsigned char n_sclass; /* storage class */
|
||||
|
@ -497,11 +497,11 @@ struct internal_syment
|
|||
/* Relocatable symbols have number of the section in which they are defined,
|
||||
or one of the following: */
|
||||
|
||||
#define N_UNDEF ((short)0) /* undefined symbol */
|
||||
#define N_ABS ((short)-1) /* value of symbol is absolute */
|
||||
#define N_DEBUG ((short)-2) /* debugging symbol -- value is meaningless */
|
||||
#define N_TV ((short)-3) /* indicates symbol needs preload transfer vector */
|
||||
#define P_TV ((short)-4) /* indicates symbol needs postload transfer vector*/
|
||||
#define N_UNDEF ((int)0) /* undefined symbol */
|
||||
#define N_ABS ((int)-1) /* value of symbol is absolute */
|
||||
#define N_DEBUG ((int)-2) /* debugging symbol -- value is meaningless */
|
||||
#define N_TV ((int)-3) /* indicates symbol needs preload transfer vector */
|
||||
#define P_TV ((int)-4) /* indicates symbol needs postload transfer vector*/
|
||||
|
||||
/* Type of a symbol, in low N bits of the word. */
|
||||
|
||||
|
|
Loading…
Reference in a new issue