This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: archives with foreign object files
On Fri, Aug 17, 2001 at 12:18:05PM +0200, Thiemo Seufer wrote:
> > - && sym->st_size <= bfd_get_gp_size (abfd))
> > + && sym->st_size <= (unsigned int) bfd_get_gp_size (abfd))
>
> Hm, I don't even have an alpha, but st_size is 8 byte on MIPS ELF64,
> so bfd_signed_vma might be the better choice here.
Oh well, bfd_get_gp_size returns an int, but if you look a little deeper,
you'll find it really is a fairly small unsigned int. Also, there
isn't any good reason to call the function in bfd routines that know the
target format. Thus..
bfd/ChangeLog
* bfd.c (bfd_get_gp_size): Return an unsigned int.
(bfd_set_gp_size): Make param unsigned.
* bfd-in2.h: Regenerate.
* elf32-ppc.c (ppc_elf_add_symbol_hook): Use elf_gp_size rather
than calling bfd_get_gp_size.
* elf64-alpha.c (elf64_alpha_add_symbol_hook): Likewise.
* elfxx-ia64.c (elfNN_ia64_add_symbol_hook): Likewise.
gas/ChangeLog
* ecoff.c (ecoff_frob_symbol): Remove cast from bfd_get_gp_size.
(ecoff_build_symbols): Likewise.
* read.c (s_lcomm_internal): Fix signed/unsigned warning.
--
Alan Modra
Thanks for checking over my patches, BTW.
Index: bfd/bfd.c
===================================================================
RCS file: /cvs/src/src/bfd/bfd.c,v
retrieving revision 1.19
diff -u -p -r1.19 bfd.c
--- bfd.c 2001/08/17 03:19:01 1.19
+++ bfd.c 2001/08/17 15:17:10
@@ -891,7 +891,7 @@ FUNCTION
bfd_get_gp_size
SYNOPSIS
- int bfd_get_gp_size(bfd *abfd);
+ unsigned int bfd_get_gp_size(bfd *abfd);
DESCRIPTION
Return the maximum size of objects to be optimized using the GP
@@ -899,7 +899,7 @@ DESCRIPTION
argument to the compiler, assembler or linker.
*/
-int
+unsigned int
bfd_get_gp_size (abfd)
bfd *abfd;
{
@@ -918,7 +918,7 @@ FUNCTION
bfd_set_gp_size
SYNOPSIS
- void bfd_set_gp_size(bfd *abfd, int i);
+ void bfd_set_gp_size(bfd *abfd, unsigned int i);
DESCRIPTION
Set the maximum size of objects to be optimized using the GP
@@ -929,7 +929,7 @@ DESCRIPTION
void
bfd_set_gp_size (abfd, i)
bfd *abfd;
- int i;
+ unsigned int i;
{
/* Don't try to set GP size on an archive or core file! */
if (abfd->format != bfd_object)
Index: bfd/elf32-ppc.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-ppc.c,v
retrieving revision 1.23
diff -u -p -r1.23 elf32-ppc.c
--- elf32-ppc.c 2001/08/09 14:38:04 1.23
+++ elf32-ppc.c 2001/08/17 15:17:15
@@ -2578,7 +2578,7 @@ ppc_elf_add_symbol_hook (abfd, info, sym
{
if (sym->st_shndx == SHN_COMMON
&& !info->relocateable
- && sym->st_size <= (bfd_vma) bfd_get_gp_size (abfd))
+ && sym->st_size <= elf_gp_size (abfd))
{
/* Common symbols less than or equal to -G nn bytes are automatically
put into .sdata. */
Index: bfd/elf64-alpha.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-alpha.c,v
retrieving revision 1.29
diff -u -p -r1.29 elf64-alpha.c
--- elf64-alpha.c 2001/08/17 09:19:10 1.29
+++ elf64-alpha.c 2001/08/17 15:17:19
@@ -1855,7 +1855,7 @@ elf64_alpha_add_symbol_hook (abfd, info,
{
if (sym->st_shndx == SHN_COMMON
&& !info->relocateable
- && sym->st_size <= (unsigned int) bfd_get_gp_size (abfd))
+ && sym->st_size <= elf_gp_size (abfd))
{
/* Common symbols less than or equal to -G nn bytes are
automatically put into .sbss. */
Index: bfd/elfxx-ia64.c
===================================================================
RCS file: /cvs/src/src/bfd/elfxx-ia64.c,v
retrieving revision 1.19
diff -u -p -r1.19 elfxx-ia64.c
--- elfxx-ia64.c 2001/08/17 08:57:42 1.19
+++ elfxx-ia64.c 2001/08/17 15:17:22
@@ -1130,7 +1130,7 @@ elfNN_ia64_add_symbol_hook (abfd, info,
{
if (sym->st_shndx == SHN_COMMON
&& !info->relocateable
- && sym->st_size <= (unsigned) bfd_get_gp_size (abfd))
+ && sym->st_size <= elf_gp_size (abfd))
{
/* Common symbols less than or equal to -G nn bytes are
automatically put into .sbss. */
Index: gas/ecoff.c
===================================================================
RCS file: /cvs/src/src/gas/ecoff.c,v
retrieving revision 1.11
diff -u -p -r1.11 ecoff.c
--- ecoff.c 2001/08/01 01:44:25 1.11
+++ ecoff.c 2001/08/17 15:49:15
@@ -3616,7 +3616,7 @@ ecoff_frob_symbol (sym)
{
if (S_IS_COMMON (sym)
&& S_GET_VALUE (sym) > 0
- && S_GET_VALUE (sym) <= (unsigned) bfd_get_gp_size (stdoutput))
+ && S_GET_VALUE (sym) <= bfd_get_gp_size (stdoutput))
{
static asection scom_section;
static asymbol scom_symbol;
@@ -4081,7 +4081,7 @@ ecoff_build_symbols (backend, buf, bufen
s = symbol_get_obj (as_sym)->ecoff_extern_size;
if (s == 0
- || s > (unsigned) bfd_get_gp_size (stdoutput))
+ || s > bfd_get_gp_size (stdoutput))
sc = sc_Undefined;
else
{
@@ -4096,7 +4096,7 @@ ecoff_build_symbols (backend, buf, bufen
{
if (S_GET_VALUE (as_sym) > 0
&& (S_GET_VALUE (as_sym)
- <= (unsigned) bfd_get_gp_size (stdoutput)))
+ <= bfd_get_gp_size (stdoutput)))
sc = sc_SCommon;
else
sc = sc_Common;
Index: gas/read.c
===================================================================
RCS file: /cvs/src/src/gas/read.c,v
retrieving revision 1.45
diff -u -p -r1.45 read.c
--- read.c 2001/08/01 01:44:25 1.45
+++ read.c 2001/08/17 15:49:21
@@ -1988,7 +1988,7 @@ s_lcomm_internal (needs_align, bytes_p)
|| OUTPUT_FLAVOR == bfd_target_elf_flavour)
{
/* For MIPS and Alpha ECOFF or ELF, small objects are put in .sbss. */
- if (temp <= bfd_get_gp_size (stdoutput))
+ if ((unsigned) temp <= bfd_get_gp_size (stdoutput))
{
bss_seg = subseg_new (".sbss", 1);
seg_info (bss_seg)->bss = 1;