Am 21.04.2009 um 09:54 schrieb Ismail Khatib:

> Am 20.04.2009 um 23:00 schrieb Danny Backx:
>
>> Ismail,
>>
>> This may be a good idea, can you check whether it works ?
>>
>>      Danny
>>
>> -------- Forwarded Message --------
>>> From: Hans-Peter Nilsson <h...@bitrange.com>
>>> To: Danny Backx <danny.ba...@scarlet.be>
>>> Cc: binutils <binut...@sourceware.org>
>>> Subject: Re: [Fwd: [Cegcc-devel] Patches for cegcc on osx-powerpc
>>> (again, now cleaner)]
>>> Date: Sat, 18 Apr 2009 13:35:17 -0400 (EDT)
>>>
>>> On Sat, 18 Apr 2009, Danny Backx wrote:
>>>> Included below is the relevant part of a patch I received.
>>>>
>>>> A new version of MacOS X introduces the STACKSIZE symbol, this  
>>>> breaks
>>>> the build of binutils/ld.
>>>>
>>>> My suggestion was to use #ifdef to keep STACKSIZE as a symbol  
>>>> except on
>>>> the platform that breaks it. That may not be possible (bison/yacc
>>>> restriction ?).
>>>>
>>>> What would be the best approach ?
>>>
>>> Arranging to #undef the system-header macro after including that
>>> header but before the ld definition; possibly moving the header
>>> include?
>>>
>>> brgds, H-P
>>> PS: No, I didn't actually look.  Feel free to ignore.
>
> I've tried this on macosx , and it seems to work here, thank you!
>
> I will just try tonight if still everything builds fine on cygwin  
> and linux (just to be sure).
>
> I'll let you know about the outcome of this and I will supply  
> patches then.
>
> Thank you for asking in the binutils ml about this!
>
> Ismail

I've now finally found the time to check if the patch has any negative  
effect on building on cygwin or linux, and
it seems it doesn't have issues. :)

Here's the patch:

First part, enables correct building on systems with texinfo versions  
higher than 4.9 (4.13 in my case):

Index: src/newlib/configure
===================================================================
--- src/newlib/configure        (revision 1245)
+++ src/newlib/configure        (working copy)
@@ -3543,7 +3543,7 @@
      # For an installed makeinfo, we require it to be from texinfo  
4.2 or
      # higher, else we use the "missing" dummy.
      if ${MAKEINFO} --version \
-       | egrep 'texinfo[^0-9]*([1-3][0-9]|4\.[2-9]|[5-9])' >/dev/null  
2>&1; then
+       | egrep 'texinfo[^0-9]*([1-3][0-9]|4\.)([2-9]|[1-9].*)' >/dev/ 
null 2>&1; then
        :
      else
        MAKEINFO="$MISSING makeinfo"
Index: src/newlib/configure.in
===================================================================
--- src/newlib/configure.in     (revision 1245)
+++ src/newlib/configure.in     (working copy)
@@ -2128,7 +2128,7 @@
      # For an installed makeinfo, we require it to be from texinfo  
4.2 or
      # higher, else we use the "missing" dummy.
      if ${MAKEINFO} --version \
-       | egrep 'texinfo[^0-9]*([1-3][0-9]|4\.[2-9]|[5-9])' >/dev/null  
2>&1; then
+       | egrep 'texinfo[^0-9]*([1-3][0-9]|4\.)([2-9]|[1-9].*)' >/dev/ 
null 2>&1; then
        :
      else
        MAKEINFO="$MISSING makeinfo"

------------------------------------------

Second part, a patch for winuser.h (there's no "GetMenu" on wince, see  
previous messages in this thread):


Index: src/w32api/include/winuser.h
===================================================================
--- src/w32api/include/winuser.h        (revision 1245)
+++ src/w32api/include/winuser.h        (working copy)
@@ -3724,7 +3724,9 @@
  WINUSERAPI int WINAPI GetKeyNameTextW(LONG,LPWSTR,int);
  WINUSERAPI SHORT WINAPI GetKeyState(int);
  WINUSERAPI HWND WINAPI GetLastActivePopup(HWND);
+#ifndef UNDER_CE
  WINUSERAPI HMENU WINAPI GetMenu(HWND);
+#endif
  WINUSERAPI LONG WINAPI GetMenuCheckMarkDimensions(void);
  WINUSERAPI DWORD WINAPI GetMenuContextHelpId(HMENU);
  WINUSERAPI UINT WINAPI GetMenuDefaultItem(HMENU,UINT,UINT);

------------------------------------------

Next, a patch for deffilep.y, which seems to be needed with some  
versions of bison
(a usable deffilep.c is generated with bison 2.3, however at least  
with version 2.4.1 of bison
this patch is needed - so it's no mac specific issue as I suspected  
beforehand):


Index: src/binutils/ld/deffilep.y
===================================================================
--- src/binutils/ld/deffilep.y  (revision 1245)
+++ src/binutils/ld/deffilep.y  (working copy)
@@ -20,6 +20,25 @@
       Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
       MA 02110-1301, USA.  */

+%}
+
+%union {
+  char *id;
+  int number;
+};
+
+%token NAME LIBRARY DESCRIPTION STACKSIZE HEAPSIZE CODE DATAU DATAL
+%token SECTIONS EXPORTS IMPORTS VERSIONK BASE CONSTANTU CONSTANTL
+%token PRIVATEU PRIVATEL
+%token READ WRITE EXECUTE SHARED NONAMEU NONAMEL DIRECTIVE
+%token <id> ID
+%token <number> NUMBER
+%type  <number> opt_base opt_ordinal
+%type  <number> attr attr_list opt_number exp_opt_list exp_opt
+%type  <id> opt_name opt_equal_name dot_name
+
+%{
+
  #include "sysdep.h"
  #include "libiberty.h"
  #include "safe-ctype.h"
@@ -99,21 +118,6 @@

  %}

-%union {
-  char *id;
-  int number;
-};
-
-%token NAME LIBRARY DESCRIPTION STACKSIZE HEAPSIZE CODE DATAU DATAL
-%token SECTIONS EXPORTS IMPORTS VERSIONK BASE CONSTANTU CONSTANTL
-%token PRIVATEU PRIVATEL
-%token READ WRITE EXECUTE SHARED NONAMEU NONAMEL DIRECTIVE
-%token <id> ID
-%token <number> NUMBER
-%type  <number> opt_base opt_ordinal
-%type  <number> attr attr_list opt_number exp_opt_list exp_opt
-%type  <id> opt_name opt_equal_name dot_name
-
  %%

  start: start command

------------------------------------------

Finally, a patch that is needed on Mac OSX 10.5 or higher (on PowerPC):

Index: src/gcc/gcc/config/rs6000/host-darwin.c
===================================================================
--- src/gcc/gcc/config/rs6000/host-darwin.c     (revision 1245)
+++ src/gcc/gcc/config/rs6000/host-darwin.c     (working copy)
@@ -35,7 +35,9 @@

  /* This doesn't have a prototype in signal.h in 10.2.x and earlier,
     fixed in later releases.  */
+#ifndef __DARWIN_UNIX03
  extern int sigaltstack(const struct sigaltstack *, struct  
sigaltstack *);
+#endif

  #undef HOST_HOOKS_EXTRA_SIGNALS
  #define HOST_HOOKS_EXTRA_SIGNALS darwin_rs6000_extra_signals
@@ -68,7 +70,11 @@
    sigaddset (&sigset, SIGSEGV);
    sigprocmask (SIG_UNBLOCK, &sigset, NULL);

+#if __DARWIN_UNIX03
+  faulting_insn = *(unsigned *)uc->uc_mcontext->__ss.__srr0;
+#else
    faulting_insn = *(unsigned *)uc->uc_mcontext->ss.srr0;
+#endif

    /* Note that this only has to work for GCC, so we don't have to deal
       with all the possible cases (GCC has no AltiVec code, for
@@ -115,9 +121,13 @@

        exit (FATAL_EXIT_CODE);
      }
-
+#if __DARWIN_UNIX03
+  fprintf (stderr, "[address=%08lx pc=%08x]\n",
+          uc->uc_mcontext->__es.__dar, uc->uc_mcontext->__ss.__srr0);
+#else
    fprintf (stderr, "[address=%08lx pc=%08x]\n",
           uc->uc_mcontext->es.dar, uc->uc_mcontext->ss.srr0);
+#endif
    internal_error ("Segmentation Fault");
    exit (FATAL_EXIT_CODE);
  }


------------------------------------------

I'm currently trying to build fat (universal) binaries of the complete  
toolchain, so that the toolchain
will work on both x86 and PowerPC based macs. I've already  
"universalized" the the parts of the build scripts
relevant for binutils and it works perfectly; however I still have  
issues with the gcc-(bootstrap) itself, it seems
that I cannot prevent the makefiles from using the CFLAGS and LDFLAGS  
supplied for building the host-part also for
the arm-cegcc-gcc compiler (which of course doesn't know anything  
about "-arch i386 -arch pcc" for example).
I've already supplied CFLAGS_FOR_HOST instead of CFLAGS and  
LDFLAGS_FOR_HOST instead of LDFLAGS,
also CFLAGS_FOR_TARGET/LDFLAGS_FOR_TARGET and it still uses the CFLAGS  
for arm-cegcc-gcc...

Maybe someone else here with more profound knowledge in gcc building  
knows better about supplying CFLAGS
and LDFLAGS only for specific build steps?

Thanks in advance!

Ismail

--
Ismail "Cerial" Khatib, http://pocketinsanity.org

------------------------------------------------------------------------------
Crystal Reports &#45; New Free Runtime and 30 Day Trial
Check out the new simplified licensign option that enables unlimited
royalty&#45;free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Cegcc-devel mailing list
Cegcc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cegcc-devel

Reply via email to