[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug ld/168] ld testsuite failure on cygwin: FAIL: linking shared lib
From: |
nickc at redhat dot com |
Subject: |
[Bug ld/168] ld testsuite failure on cygwin: FAIL: linking shared lib |
Date: |
19 May 2004 19:05:49 -0000 |
------- Additional Comments From nickc at redhat dot com 2004-05-19 19:05
-------
Subject: Re: New: ld testsuite failure on cygwin: FAIL: linking
shared lib
Hi Christain,
> Running /usr/local/src/trunk/src/ld/testsuite/ld-auto-import/auto-import.exp
> ...
> gcc -L/usr/local/src/trunk/objdir-binutils/ld -g -O2
> -B/usr/local/src/trunk/objdir-binutils/ld/tmpdir/gas/
> -I/usr/local/src/trunk/src/ld/testsuite/ld-auto-import -g -O2 -c
> /usr/local/src/trunk/src/ld/testsuite/ld-auto-import/dll.c -o tmpdir/dll.o
> /usr/local/src/trunk/objdir-binutils/ld/ld-new -shared
> --out-implib=tmpdir/libstandard.dll.a -o tmpdir/dll.dll tmpdir/dll.o
> -L/usr/lib
> -lcygwin -L/usr/lib/w32api -lkernel32
> child killed: segmentation violation
> FAIL: linking shared lib
This is due to the code in pe-dll.c creating a dummy bfd called "pe
stuff" which does not have an file I/O capabilities associated with it.
The solution, in my opinion, is to fix the bfd file routines to cope
with a bfd that has a NULL iovec pointer. ie the attached patch.
Would you care to try this out and let me know what you think ?
Cheers
Nick
bfd/ChangeLog
2004-05-19 Nick Clifton <address@hidden>
* bfdio.c (bfd_bread): Do not use iovec if it is NULL.
(bfd_bwrite): Likewise.
(bfd_tell): Likewise.
(bfd_flush): Likewise.
(bfd_stat): Likewise.
(bfd_seek): Likewise.
(bfd_get_mtime): Likewise.
(bfd_get_size): Likewise.
Index: bfd/bfdio.c
===================================================================
RCS file: /cvs/src/src/bfd/bfdio.c,v
retrieving revision 1.6
diff -c -3 -p -r1.6 bfdio.c
*** bfd/bfdio.c 21 Apr 2004 17:05:11 -0000 1.6
--- bfd/bfdio.c 19 May 2004 18:58:52 -0000
*************** bfd_bread (void *ptr, bfd_size_type size
*** 125,131 ****
return get;
}
! nread = abfd->iovec->bread (abfd, ptr, size);
if (nread != (size_t) -1)
abfd->where += nread;
--- 125,134 ----
return get;
}
! if (abfd->iovec)
! nread = abfd->iovec->bread (abfd, ptr, size);
! else
! nread = 0;
if (nread != (size_t) -1)
abfd->where += nread;
*************** bfd_bwrite (const void *ptr, bfd_size_ty
*** 140,145 ****
--- 143,149 ----
if ((abfd->flags & BFD_IN_MEMORY) != 0)
{
struct bfd_in_memory *bim = abfd->iostream;
+
size = (size_t) size;
if (abfd->where + size > bim->size)
{
*************** bfd_bwrite (const void *ptr, bfd_size_ty
*** 164,170 ****
return size;
}
! nwrote = abfd->iovec->bwrite (abfd, ptr, size);
if (nwrote != (size_t) -1)
abfd->where += nwrote;
if (nwrote != size)
--- 168,178 ----
return size;
}
! if (abfd->iovec)
! nwrote = abfd->iovec->bwrite (abfd, ptr, size);
! else
! nwrote = 0;
!
if (nwrote != (size_t) -1)
abfd->where += nwrote;
if (nwrote != size)
*************** bfd_tell (bfd *abfd)
*** 185,194 ****
if ((abfd->flags & BFD_IN_MEMORY) != 0)
return abfd->where;
! ptr = abfd->iovec->btell (abfd);
- if (abfd->my_archive)
- ptr -= abfd->origin;
abfd->where = ptr;
return ptr;
}
--- 193,208 ----
if ((abfd->flags & BFD_IN_MEMORY) != 0)
return abfd->where;
! if (abfd->iovec)
! {
! ptr = abfd->iovec->btell (abfd);
!
! if (abfd->my_archive)
! ptr -= abfd->origin;
! }
! else
! ptr = 0;
abfd->where = ptr;
return ptr;
}
*************** bfd_flush (bfd *abfd)
*** 198,204 ****
{
if ((abfd->flags & BFD_IN_MEMORY) != 0)
return 0;
! return abfd->iovec->bflush (abfd);
}
/* Returns 0 for success, negative value for failure (in which case
--- 212,221 ----
{
if ((abfd->flags & BFD_IN_MEMORY) != 0)
return 0;
!
! if (abfd->iovec)
! return abfd->iovec->bflush (abfd);
! return 0;
}
/* Returns 0 for success, negative value for failure (in which case
*************** bfd_stat (bfd *abfd, struct stat *statbu
*** 211,217 ****
if ((abfd->flags & BFD_IN_MEMORY) != 0)
abort ();
! result = abfd->iovec->bstat (abfd, statbuf);
if (result < 0)
bfd_set_error (bfd_error_system_call);
return result;
--- 228,238 ----
if ((abfd->flags & BFD_IN_MEMORY) != 0)
abort ();
! if (abfd->iovec)
! result = abfd->iovec->bstat (abfd, statbuf);
! else
! result = -1;
!
if (result < 0)
bfd_set_error (bfd_error_system_call);
return result;
*************** bfd_seek (bfd *abfd, file_ptr position,
*** 251,256 ****
--- 272,278 ----
(abfd->direction == both_direction))
{
bfd_size_type newsize, oldsize;
+
oldsize = (bim->size + 127) & ~(bfd_size_type) 127;
bim->size = abfd->where;
/* Round up to cut down on memory fragmentation */
*************** bfd_seek (bfd *abfd, file_ptr position,
*** 313,319 ****
if (direction == SEEK_SET && abfd->my_archive != NULL)
file_position += abfd->origin;
! result = abfd->iovec->bseek (abfd, file_position, direction);
if (result != 0)
{
int hold_errno = errno;
--- 335,345 ----
if (direction == SEEK_SET && abfd->my_archive != NULL)
file_position += abfd->origin;
! if (abfd->iovec)
! result = abfd->iovec->bseek (abfd, file_position, direction);
! else
! result = -1;
!
if (result != 0)
{
int hold_errno = errno;
*************** bfd_get_mtime (bfd *abfd)
*** 363,368 ****
--- 389,397 ----
if (abfd->mtime_set)
return abfd->mtime;
+ if (abfd->iovec == NULL)
+ return 0;
+
if (abfd->iovec->bstat (abfd, &buf) != 0)
return 0;
*************** bfd_get_size (bfd *abfd)
*** 410,415 ****
--- 439,447 ----
if ((abfd->flags & BFD_IN_MEMORY) != 0)
return ((struct bfd_in_memory *) abfd->iostream)->size;
+
+ if (abfd->iovec == NULL)
+ return 0;
if (abfd->iovec->bstat (abfd, &buf) != 0)
return 0;
--
http://sources.redhat.com/bugzilla/show_bug.cgi?id=168
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.