(_bfd_XXi_swap_scnhdr_out): Compute ps and ss differently for object files and
executables. (coff_swap_scnhdr_in): Only set the s_size field for object files or for executables who have not already initialised the field. (bfd_pe_executable_p): New macro. Return true if the PE format bfd is an executable.
This commit is contained in:
parent
9a1b6dc5fd
commit
ff0c9faf3b
4 changed files with 69 additions and 46 deletions
|
@ -1,3 +1,13 @@
|
||||||
|
2003-04-03 Nick Clifton <nickc@redhat.com>
|
||||||
|
|
||||||
|
* peXXigen.c (_bfd_XXi_swap_scnhdr_out): Compute ps and ss
|
||||||
|
differently for object files and executables.
|
||||||
|
* peicode.h (coff_swap_scnhdr_in): Only set the s_size field
|
||||||
|
for object files or for executables who have not already
|
||||||
|
initialised the field.
|
||||||
|
* libpei.h (bfd_pe_executable_p): New macro. Return true if
|
||||||
|
the PE format bfd is an executable.
|
||||||
|
|
||||||
2003-04-03 Alan Modra <amodra@bigpond.net.au>
|
2003-04-03 Alan Modra <amodra@bigpond.net.au>
|
||||||
|
|
||||||
* elf32-ppc.c (ppc_elf_check_relocs): Don't use SYMBOL_REFERENCES_LOCAL
|
* elf32-ppc.c (ppc_elf_check_relocs): Don't use SYMBOL_REFERENCES_LOCAL
|
||||||
|
|
42
bfd/libpei.h
42
bfd/libpei.h
|
@ -1,31 +1,29 @@
|
||||||
/* Support for the generic parts of PE/PEI; common header information.
|
/* Support for the generic parts of PE/PEI; common header information.
|
||||||
Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
|
Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
|
||||||
Free Software Foundation, Inc.
|
Free Software Foundation, Inc.
|
||||||
Written by Cygnus Solutions.
|
Written by Cygnus Solutions.
|
||||||
|
|
||||||
This file is part of BFD, the Binary File Descriptor library.
|
This file is part of BFD, the Binary File Descriptor library.
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
/* Most of this hacked by Steve Chamberlain,
|
||||||
along with this program; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
|
||||||
|
|
||||||
/*
|
|
||||||
Most of this hacked by Steve Chamberlain,
|
|
||||||
sac@cygnus.com
|
sac@cygnus.com
|
||||||
|
|
||||||
PE/PEI rearrangement (and code added): Donn Terry
|
PE/PEI rearrangement (and code added): Donn Terry
|
||||||
Softway Systems, Inc.
|
Softway Systems, Inc. */
|
||||||
*/
|
|
||||||
|
|
||||||
/* Hey look, some documentation [and in a place you expect to find it]!
|
/* Hey look, some documentation [and in a place you expect to find it]!
|
||||||
|
|
||||||
|
@ -53,8 +51,7 @@ PE/PEI rearrangement (and code added): Donn Terry
|
||||||
|
|
||||||
FIXME: Please add more docs here so the next poor fool that has to hack
|
FIXME: Please add more docs here so the next poor fool that has to hack
|
||||||
on this code has a chance of getting something accomplished without
|
on this code has a chance of getting something accomplished without
|
||||||
wasting too much time.
|
wasting too much time. */
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef GET_FCN_LNNOPTR
|
#ifndef GET_FCN_LNNOPTR
|
||||||
#define GET_FCN_LNNOPTR(abfd, ext) \
|
#define GET_FCN_LNNOPTR(abfd, ext) \
|
||||||
|
@ -333,3 +330,6 @@ unsigned int _bfd_XX_only_swap_filehdr_out PARAMS ((bfd*, PTR, PTR));
|
||||||
unsigned int _bfd_XXi_only_swap_filehdr_out PARAMS ((bfd*, PTR, PTR));
|
unsigned int _bfd_XXi_only_swap_filehdr_out PARAMS ((bfd*, PTR, PTR));
|
||||||
bfd_boolean _bfd_XX_bfd_copy_private_section_data
|
bfd_boolean _bfd_XX_bfd_copy_private_section_data
|
||||||
PARAMS ((bfd *, asection *, bfd *, asection *));
|
PARAMS ((bfd *, asection *, bfd *, asection *));
|
||||||
|
|
||||||
|
/* Macro: Returns true if the bfd is a PE executable as opposed to a PE object file. */
|
||||||
|
#define bfd_pe_executable_p(abfd) (strncmp ((abfd)->xvec->name, "pei-", 4) == 0)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* Support for the generic parts of PE/PEI; the common executable parts.
|
/* Support for the generic parts of PE/PEI; the common executable parts.
|
||||||
Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
|
Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
|
||||||
Free Software Foundation, Inc.
|
Free Software Foundation, Inc.
|
||||||
Written by Cygnus Solutions.
|
Written by Cygnus Solutions.
|
||||||
|
|
||||||
|
@ -906,12 +906,24 @@ _bfd_XXi_swap_scnhdr_out (abfd, in, out)
|
||||||
sometimes). */
|
sometimes). */
|
||||||
if ((scnhdr_int->s_flags & IMAGE_SCN_CNT_UNINITIALIZED_DATA) != 0)
|
if ((scnhdr_int->s_flags & IMAGE_SCN_CNT_UNINITIALIZED_DATA) != 0)
|
||||||
{
|
{
|
||||||
ps = scnhdr_int->s_size;
|
if (bfd_pe_executable_p (abfd))
|
||||||
ss = 0;
|
{
|
||||||
|
ps = scnhdr_int->s_size;
|
||||||
|
ss = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ps = 0;
|
||||||
|
ss = scnhdr_int->s_size;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ps = scnhdr_int->s_paddr;
|
if (bfd_pe_executable_p (abfd))
|
||||||
|
ps = scnhdr_int->s_paddr;
|
||||||
|
else
|
||||||
|
ps = 0;
|
||||||
|
|
||||||
ss = scnhdr_int->s_size;
|
ss = scnhdr_int->s_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,31 +1,29 @@
|
||||||
/* Support for the generic parts of PE/PEI, for BFD.
|
/* Support for the generic parts of PE/PEI, for BFD.
|
||||||
Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
|
Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
|
||||||
Free Software Foundation, Inc.
|
Free Software Foundation, Inc.
|
||||||
Written by Cygnus Solutions.
|
Written by Cygnus Solutions.
|
||||||
|
|
||||||
This file is part of BFD, the Binary File Descriptor library.
|
This file is part of BFD, the Binary File Descriptor library.
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
/*
|
/* Most of this hacked by Steve Chamberlain,
|
||||||
Most of this hacked by Steve Chamberlain,
|
|
||||||
sac@cygnus.com
|
sac@cygnus.com
|
||||||
|
|
||||||
PE/PEI rearrangement (and code added): Donn Terry
|
PE/PEI rearrangement (and code added): Donn Terry
|
||||||
Softway Systems, Inc.
|
Softway Systems, Inc. */
|
||||||
*/
|
|
||||||
|
|
||||||
/* Hey look, some documentation [and in a place you expect to find it]!
|
/* Hey look, some documentation [and in a place you expect to find it]!
|
||||||
|
|
||||||
|
@ -53,8 +51,7 @@ PE/PEI rearrangement (and code added): Donn Terry
|
||||||
|
|
||||||
FIXME: Please add more docs here so the next poor fool that has to hack
|
FIXME: Please add more docs here so the next poor fool that has to hack
|
||||||
on this code has a chance of getting something accomplished without
|
on this code has a chance of getting something accomplished without
|
||||||
wasting too much time.
|
wasting too much time. */
|
||||||
*/
|
|
||||||
|
|
||||||
#include "libpei.h"
|
#include "libpei.h"
|
||||||
|
|
||||||
|
@ -264,7 +261,11 @@ coff_swap_scnhdr_in (abfd, ext, in)
|
||||||
if ((scnhdr_int->s_flags & IMAGE_SCN_CNT_UNINITIALIZED_DATA) != 0
|
if ((scnhdr_int->s_flags & IMAGE_SCN_CNT_UNINITIALIZED_DATA) != 0
|
||||||
&& (scnhdr_int->s_paddr > 0))
|
&& (scnhdr_int->s_paddr > 0))
|
||||||
{
|
{
|
||||||
scnhdr_int->s_size = scnhdr_int->s_paddr;
|
/* Always set it for non pe-obj files, and don't overwrite it
|
||||||
|
if it's zero for object files. */
|
||||||
|
if (! bfd_pe_executable_p (abfd) || !scnhdr_int->s_size)
|
||||||
|
scnhdr_int->s_size = scnhdr_int->s_paddr;
|
||||||
|
|
||||||
/* This code used to set scnhdr_int->s_paddr to 0. However,
|
/* This code used to set scnhdr_int->s_paddr to 0. However,
|
||||||
coff_set_alignment_hook stores s_paddr in virt_size, which
|
coff_set_alignment_hook stores s_paddr in virt_size, which
|
||||||
only works if it correctly holds the virtual size of the
|
only works if it correctly holds the virtual size of the
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue