diff options
author | Nick Clifton <nickc@redhat.com> | 2016-01-18 15:58:47 +0000 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2016-01-18 15:58:47 +0000 |
commit | 9ae678af999b8a692c4e6efbe493f39f0085d149 (patch) | |
tree | 3d66932e9acf44617cdb0cb2fe3c899db344add4 /bfd | |
parent | f303dbd60d9c7984832446eeb9d4e4d89703c615 (diff) | |
download | gdb-9ae678af999b8a692c4e6efbe493f39f0085d149.zip gdb-9ae678af999b8a692c4e6efbe493f39f0085d149.tar.gz gdb-9ae678af999b8a692c4e6efbe493f39f0085d149.tar.bz2 |
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.
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/ChangeLog | 11 | ||||
-rw-r--r-- | bfd/coff-rs6000.c | 2 | ||||
-rw-r--r-- | bfd/coff64-rs6000.c | 2 | ||||
-rw-r--r-- | bfd/coffcode.h | 1 | ||||
-rw-r--r-- | bfd/coffswap.h | 2 | ||||
-rw-r--r-- | bfd/peXXigen.c | 4 |
6 files changed, 17 insertions, 5 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 4d4ccbc..8b06e74 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -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. diff --git a/bfd/coff-rs6000.c b/bfd/coff-rs6000.c index ed21a05..e7a215b 100644 --- a/bfd/coff-rs6000.c +++ b/bfd/coff-rs6000.c @@ -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); diff --git a/bfd/coff64-rs6000.c b/bfd/coff64-rs6000.c index 955ea57..a0bc160 100644 --- a/bfd/coff64-rs6000.c +++ b/bfd/coff64-rs6000.c @@ -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); diff --git a/bfd/coffcode.h b/bfd/coffcode.h index d7e8351..caceab6 100644 --- a/bfd/coffcode.h +++ b/bfd/coffcode.h @@ -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); diff --git a/bfd/coffswap.h b/bfd/coffswap.h index b9122c8..e6c8c3f 100644 --- a/bfd/coffswap.h +++ b/bfd/coffswap.h @@ -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 diff --git a/bfd/peXXigen.c b/bfd/peXXigen.c index 23fdc9f..b80f981 100644 --- a/bfd/peXXigen.c +++ b/bfd/peXXigen.c @@ -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; |