bug-binutils
[Top][All Lists]
Advanced

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

[Bug binutils/5146] bfd build fails in alloca-conf.h when built without


From: nickc at redhat dot com
Subject: [Bug binutils/5146] bfd build fails in alloca-conf.h when built without gcc
Date: 16 Oct 2007 14:16:28 -0000

------- Additional Comments From nickc at redhat dot com  2007-10-16 14:16 
-------
Subject: Re:  bfd build fails in alloca-conf.h when built
 without gcc

Hi Haubi,

> With this patch only (without checking for <alloca.h> in bfd/configure), the
> next unknown symbol is 'size_t':

Doh.

> Eh, in gas/ChangeLog-9295 there is this log entry: "Replace alloca-conf.h
> inclusion with code recommended in autoconf documentation."
> 
> Maybe this should be done for bfd too ?

Yup.

Please try this revised patch which changes the som.c file directly.  If it 
works for you then I will check it in along with a similar change to 
elf64-hppa.c and an update of the dependencies in bfd/Makefile.am.  (I think 
that it is best not to include this code in the bfd.h header since I do not 
want to encourage the use of alloca.  It is a poor programming tool and one 
that can lead to very mysterious and hard to track down bugs).

Cheers
   Nick


Index: bfd/som.c
===================================================================
RCS file: /cvs/src/src/bfd/som.c,v
retrieving revision 1.68
diff -c -3 -p -r1.68 som.c
*** bfd/som.c   26 Sep 2007 08:12:59 -0000      1.68
--- bfd/som.c   16 Oct 2007 14:05:42 -0000
***************
*** 23,29 ****
     Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
     02110-1301, USA.  */
  
- #include "alloca-conf.h"
  #include "sysdep.h"
  #include "bfd.h"
  
--- 23,28 ----
***************
*** 38,43 ****
--- 37,71 ----
  #include <machine/reg.h>
  #include <sys/file.h>
  
+ /* This is the code recommended in the autoconf documentation, almost
+    verbatim.  If it doesn't work for you, let me know, and notify
+    address@hidden as well.  */
+ /* Added void* version for STDC case.  This is to be compatible with
+    the declaration in bison.simple, used for m68k operand parsing.
+    --KR 1995.08.08 */
+ /* Force void* decl for hpux.  This is what Bison uses.  --KR 1995.08.16 */
+ 
+ #ifndef __GNUC__
+ # if HAVE_ALLOCA_H
+ #  include <alloca.h>
+ # else
+ #  ifdef _AIX
+ /* Indented so that pre-ansi C compilers will ignore it, rather than
+    choke on it.  Some versions of AIX require this to be the first
+    thing in the file.  */
+  #pragma alloca
+ #  else
+ #   ifndef alloca /* predefined by HP cc +Olibcalls */
+ #    if !defined (__STDC__) && !defined (__hpux)
+ extern char *alloca ();
+ #    else
+ extern void *alloca ();
+ #    endif /* __STDC__, __hpux */
+ #   endif /* alloca */
+ #  endif /* _AIX */
+ # endif /* HAVE_ALLOCA_H */
+ #endif /* __GNUC__ */
+ 
  static bfd_reloc_status_type hppa_som_reloc
    (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
  static bfd_boolean som_mkobject (bfd *);


-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=5146

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.




reply via email to

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