gcl-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gcl-devel] bug in sfaslbfd.c


From: Peter Wood
Subject: [Gcl-devel] bug in sfaslbfd.c
Date: Sun, 6 Oct 2002 16:32:14 +0200
User-agent: Mutt/1.4i

Hi

On x86 Gnu/Linux, using Gcl from CVS downloaded Mon Sep 16 22:11:07
CEST 2002.

In gcl/o/sfaslbfd.c in function 'fasload':

...

  if (!(b=bfd_openr(filename,0)))
    FEerror("Cannot open bfd");

  if (!bfd_check_format(b,bfd_object))
    FEerror("Unknown bfd format");

...

Setting the target to NULL in the call to bfd_openr causes the call to
bfd_check_format to set the bfd 'errno' to 3 ("wrong format"), when
calling #'load from lisp.  FError is _not_ signalled, since
bfd_check_format succeeds, so it's invisible from lisp, by default.

This bug can be confirmed by adding the following debug statements,
using bfd_get_error which 'returns the current BFD error condition'

...

  bfd_error_type myerr
...

  if (!(b=bfd_openr(filename,0)))
    FEerror("Cannot open bfd");

  if ((myerr = bfd_get_error()) != 0) {
    printf("1. myerr = %d\n", myerr);
    bfd_set_error(0);
  }

  if (!bfd_check_format(b,bfd_object))
    FEerror("Unknown bfd format");

  if ((myerr = bfd_get_error()) != 0) {
    printf("2. myerr = %d\n", myerr);
    bfd_set_error(0);

...

With the above additions, a call to #'load results in the following
output:

>(load "bfd-lisp")

Loading bfd-lisp.o
2. myerr = 3
start address -T 0x8920000 Finished loading bfd-lisp.o
7728

I fixed the bug (for this machine) by replacing the NULL (0)parameter
in the call to bfd_openr with the target name "elf32-i386".  Maybe
this could be set up by config?  There is also a call to bfd_openr in
sfasli.c which uses a NULL target parameter, and which needs to be
specified. 

After which:

(load "bfd-lisp")

Loading bfd-lisp.o
start address -T 0x88b3000 Finished loading bfd-lisp.o
7728

To be honest, after looking at the *ancient* bfd 'documentation' I
think it might be BFD's bug, not GCL's.  Regardless, its not nice to
have the bfd_errno set permanently.

Regards,
Peter




reply via email to

[Prev in Thread] Current Thread [Next in Thread]