public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Re[2]: Cygwin tester? Was: [rfa] Add bfd-in-memory io vector
@ 2004-05-03 22:48 Danny Smith
  2004-05-05 11:09 ` Re[3]: " Danny Smith
  0 siblings, 1 reply; 3+ messages in thread
From: Danny Smith @ 2004-05-03 22:48 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: binutils


From: "Danny Smith"

| 
| | > On Sat, May 01, 2004 at 02:10:31PM -0400, Andrew Cagney wrote:
| | > 
| | >>> The testing comment still applies though.
| | > 
| | > 
| | > Given DJ's comment, I think you should test this on cygwin before
| | > committing.  If you can't do this yourself, convince someone else
| | > to do so for you.  OK to commit once you've done this.
| | > 
| | > 
| 
| I get this on mingw:
| 
| ../bfd/.libs/libbfd.a(opncls.o)(.text+0x5ba):opncls.c: undefined reference to `getuid'
| ../bfd/.libs/libbfd.a(opncls.o)(.text+0x5c6):opncls.c: undefined reference to `getgid'
| 
| 
| Configure already tests for getgid,  but not getuid
| 

Oops, configure already does test for both.

Danny

| Addinging this (and appropriate autoconfigury) works on mingw
| 
| #ifndef HAVE_GETGID
| #define getgid() 0
| #endif
| #ifndef HAVE_GETUID
| #define getuid() 0
| #endif
| 
| Danny
| 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re[3]: Cygwin tester? Was: [rfa] Add bfd-in-memory io vector
  2004-05-03 22:48 Re[2]: Cygwin tester? Was: [rfa] Add bfd-in-memory io vector Danny Smith
@ 2004-05-05 11:09 ` Danny Smith
  2004-05-05 15:57   ` Andrew Cagney
  0 siblings, 1 reply; 3+ messages in thread
From: Danny Smith @ 2004-05-05 11:09 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: binutils


----- Original Message ----- 
From: "Danny Smith" 
| 
| From: "Danny Smith"
| 
| | 
| | | > On Sat, May 01, 2004 at 02:10:31PM -0400, Andrew Cagney wrote:
| | | > 
| | | >>> The testing comment still applies though.
| | | > 
| | | > 
| | | > Given DJ's comment, I think you should test this on cygwin before
| | | > committing.  If you can't do this yourself, convince someone else
| | | > to do so for you.  OK to commit once you've done this.
| | | > 

Hi,

Although the patchset works fine (if I add the checks for HAVE_GET[GU]ID) 
when building .exe files on pe targets, it fails when building dll's 
(segfault in bfd/bfdio.c:bfd_bread when forwarding args to iovec->bread)  

With binutils built with CFLAGS="-g -O2", gcc-3.4.0, mingw32:

cat > foo.c
int foo = 1;
^Z
gcc -shared -ofoo.dll foo.c

raises the segfault in bfd_bread. 

Actually, the above testcase fails since your 21-April patch.

The problem occurs when pe-dll.c code calls bread with a NULL file, asking for zero bytes
(see comment in cache.c:cache_bread). 

The problem can be avoided by doing the cache_bread FIXME in bfd_bread, ie:

*** bfdio.c.cagney Mon May 03 10:02:13 2004
--- bfdio.c Tue May 04 11:26:40 2004
*************** bfd_bread (void *ptr, bfd_size_type size
*** 104,109 ****
--- 104,113 ----
  {
    size_t nread;
  
+   /*  See FIXME in cache.c:cache_bread(). */
+   if (size == 0)
+     return 0;
+ 
    nread = abfd->iovec->bread (abfd, ptr, size);
    if (nread != (size_t) -1)
      abfd->where += nread;

With above patch, simple dll build is okay. 
But this looks a bit strange in  peicode.h:pe_ILF_build_a_bfd()

+  vars.bim = _bfd_in_memory (abfd, abfd->flags, vars.bim->buffer,
+        vars.bim->size);


Should that be:

vars.bim = _bfd_in_memory (abfd, abfd->flags, bim.buffer, bim.size);


Danny

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Cygwin tester? Was: [rfa] Add bfd-in-memory io vector
  2004-05-05 11:09 ` Re[3]: " Danny Smith
@ 2004-05-05 15:57   ` Andrew Cagney
  0 siblings, 0 replies; 3+ messages in thread
From: Andrew Cagney @ 2004-05-05 15:57 UTC (permalink / raw)
  To: Danny Smith, dk; +Cc: binutils

Dave, Danny, thanks!

> From: "Danny Smith" 
> | 
> | From: "Danny Smith"
> | 
> | | 
> | | | > On Sat, May 01, 2004 at 02:10:31PM -0400, Andrew Cagney wrote:
> | | | > 
> | | | >>> The testing comment still applies though.
> | | | > 
> | | | > 
> | | | > Given DJ's comment, I think you should test this on cygwin before
> | | | > committing.  If you can't do this yourself, convince someone else
> | | | > to do so for you.  OK to commit once you've done this.
> | | | > 
> 
> Hi,
> 
> Although the patchset works fine (if I add the checks for HAVE_GET[GU]ID) 
> when building .exe files on pe targets, it fails when building dll's 
> (segfault in bfd/bfdio.c:bfd_bread when forwarding args to iovec->bread)  

I'll add this to the patch.

> With binutils built with CFLAGS="-g -O2", gcc-3.4.0, mingw32:
> 
> cat > foo.c
> int foo = 1;
> ^Z
> gcc -shared -ofoo.dll foo.c
> 
> raises the segfault in bfd_bread. 
> 
> Actually, the above testcase fails since your 21-April patch.
> 
> The problem occurs when pe-dll.c code calls bread with a NULL file, asking for zero bytes
> (see comment in cache.c:cache_bread). 
> 
> The problem can be avoided by doing the cache_bread FIXME in bfd_bread, ie:
> 
> *** bfdio.c.cagney Mon May 03 10:02:13 2004
> --- bfdio.c Tue May 04 11:26:40 2004
> *************** bfd_bread (void *ptr, bfd_size_type size
> *** 104,109 ****
> --- 104,113 ----
>   {
>     size_t nread;
>   
> +   /*  See FIXME in cache.c:cache_bread(). */
> +   if (size == 0)
> +     return 0;
> + 
>     nread = abfd->iovec->bread (abfd, ptr, size);
>     if (nread != (size_t) -1)
>       abfd->where += nread;

Outch, thanks.  I think I'll move the fixme as well as a separate patch.

> With above patch, simple dll build is okay. 
> But this looks a bit strange in  peicode.h:pe_ILF_build_a_bfd()
> 
> +  vars.bim = _bfd_in_memory (abfd, abfd->flags, vars.bim->buffer,
> +        vars.bim->size);

Oops, yes.

Andrew

> Should that be:
> 
> vars.bim = _bfd_in_memory (abfd, abfd->flags, bim.buffer, bim.size);
> 
> 
> Danny


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-05-05 15:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-03 22:48 Re[2]: Cygwin tester? Was: [rfa] Add bfd-in-memory io vector Danny Smith
2004-05-05 11:09 ` Re[3]: " Danny Smith
2004-05-05 15:57   ` Andrew Cagney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).