public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Problem with  a cross-compiler based on gcc-trunk
@ 2009-03-23 18:42 Vincent R.
  2009-03-23 18:55 ` Dave Korn
  0 siblings, 1 reply; 3+ messages in thread
From: Vincent R. @ 2009-03-23 18:42 UTC (permalink / raw)
  To: gcc

Hi,

I am testing a cross-compiler targetting arm-wince-pe and based on
gcc-trunk revision r144975 and when
compiling a project I get the following error :

vincent@vincent-pc:~/projects$ arm-mingw32ce-gcc -std=gnu99 -save-temps
-I/home/vincent/local/wince/include -DNDEBUG -O3 -c cegcc-errno-bug.c 
-DDLL_EXPORT -DPIC -o libeet_la-eet_lib.o
cegcc-errno-bug.c: In function 'eet_close':
cegcc-errno-bug.c:134: error: unrecognizable insn:
(insn 6 5 7 3 cegcc-errno-bug.c:114 (set (reg/f:SI 138)
        (symbol_ref:SI ("errno") [flags 0x4c0] <var_decl 0xb7db26e0
errno>)) -1 (nil))
cegcc-errno-bug.c:134: internal compiler error: in extract_insn, at
recog.c:2048

Of course I could report a bug but since original sources are patched the
bug might be due to one 
of the modifications.
Anyway if someone knows how I could fix this, the only thing I see is the
fact the problem seems to be
related to errno and on wince platform by default there is no errno.
So the project I am compiling declare it like this and is defined in a
library.

/home/vincent/local/wince/include/errno.h:

#ifndef	__EVIL_ERRNO_H__
#define	__EVIL_ERRNO_H__

#ifdef EAPI
# undef EAPI
#endif /* EAPI */

#ifdef _WIN32
# ifdef EFL_EVIL_BUILD
#  ifdef DLL_EXPORT
#   define EAPI __declspec(dllexport)
#  else
#   define EAPI
#  endif /* ! DLL_EXPORT */
# else
#  define EAPI __declspec(dllimport)
# endif /* ! EFL_EVIL_BUILD */
#endif /* _WIN32 */

#ifdef	__cplusplus
extern "C" {
#endif

extern EAPI int errno;

/* Fake values */
#define E2BIG           1
#define EACCES          2
...

#ifdef	__cplusplus
}
#endif

#endif /* __EVIL_ERRNO_H__ */
-----------------------------------------------------
And here is the testcase :

//#ifdef HAVE_CONFIG_H
//# include <config.h>
//#endif

#ifdef HAVE_ALLOCA_H
# include <alloca.h>
#elif defined __GNUC__
# define alloca __builtin_alloca
#elif defined _AIX
# define alloca __alloca
#elif defined _MSC_VER
# include <malloc.h>
# define alloca _alloca
#else
# include <stddef.h>
# ifdef  __cplusplus
extern "C"
# endif
void *alloca (size_t);
#endif

#include <stdio.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/mman.h>
#include <time.h>
#include <string.h>
#include <fnmatch.h>
#include <fcntl.h>
#include <unistd.h>
#include <zlib.h>

#ifdef HAVE_OPENSSL
#include <openssl/err.h>
#endif

#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif

#if defined(_WIN32) && ! defined(__CEGCC__)
# include <winsock2.h>
#endif

//#ifdef HAVE_EVIL
//# include <Evil.h>
//#endif

#ifdef HAVE_GNUTLS
# include <gnutls/gnutls.h>
# include <gcrypt.h>
#endif

#ifdef HAVE_OPENSSL
# include <openssl/err.h>
# include <openssl/evp.h>
#endif

//#include <Eina.h>

//#include "Eet.h"
//#include "Eet_private.h"

#ifdef HAVE_REALPATH
#undef HAVE_REALPATH
#endif

#define EET_MAGIC_FILE                  0x1ee7ff00
#define EET_MAGIC_FILE_HEADER           0x1ee7ff01

#define EET_MAGIC_FILE2                 0x1ee70f42

 typedef enum _Eet_File_Mode
     {
	EET_FILE_MODE_INVALID = -1,
	EET_FILE_MODE_READ,
	EET_FILE_MODE_WRITE,
	EET_FILE_MODE_READ_WRITE
     } Eet_File_Mode;

   typedef enum _Eet_Error
     {
	EET_ERROR_NONE,
	EET_ERROR_BAD_OBJECT,
	EET_ERROR_EMPTY,
	EET_ERROR_NOT_WRITABLE,
	EET_ERROR_OUT_OF_MEMORY,
	EET_ERROR_WRITE_ERROR,
	EET_ERROR_WRITE_ERROR_FILE_TOO_BIG,
	EET_ERROR_WRITE_ERROR_IO_ERROR,
	EET_ERROR_WRITE_ERROR_OUT_OF_SPACE,
	EET_ERROR_WRITE_ERROR_FILE_CLOSED,
	EET_ERROR_MMAP_FAILED,
	EET_ERROR_X509_ENCODING_FAILED,
	EET_ERROR_SIGNATURE_FAILED,
	EET_ERROR_INVALID_SIGNATURE,
	EET_ERROR_NOT_SIGNED,
	EET_ERROR_NOT_IMPLEMENTED,
	EET_ERROR_PRNG_NOT_SEEDED,
	EET_ERROR_ENCRYPT_FAILED,
	EET_ERROR_DECRYPT_FAILED
     } Eet_Error;

/* prototypes of internal calls */
static Eet_Error	eet_flush2(int *ef);

/* flush out writes to a v2 eet file */
static Eet_Error
eet_flush2(int *ef)
{
    Eet_Error             error = EET_ERROR_NONE;
 
	switch (errno)
	  {
	   case EFBIG: error = EET_ERROR_WRITE_ERROR_FILE_TOO_BIG; break;
	   case EIO: error = EET_ERROR_WRITE_ERROR_IO_ERROR; break;
	   case ENOSPC: error = EET_ERROR_WRITE_ERROR_OUT_OF_SPACE; break;
	   case EPIPE: error = EET_ERROR_WRITE_ERROR_FILE_CLOSED; break;
	   default: error = EET_ERROR_WRITE_ERROR; break;
	  }
    
   return error;
}

EAPI Eet_Error
eet_close(int *ef)
{
   Eet_Error err;

   err = eet_flush2(ef);
  
   return err;
} // L134 : where gcc crash


If I comment the errno variable inside the switch and replace it by 1 for
instance, it compiles fine.
Where should I start ?







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

* Re: Problem with  a cross-compiler based on gcc-trunk
  2009-03-23 18:42 Problem with a cross-compiler based on gcc-trunk Vincent R.
@ 2009-03-23 18:55 ` Dave Korn
  2009-03-23 19:35   ` Vincent R.
  0 siblings, 1 reply; 3+ messages in thread
From: Dave Korn @ 2009-03-23 18:55 UTC (permalink / raw)
  To: Vincent R.; +Cc: gcc

Vincent R. wrote:

> vincent@vincent-pc:~/projects$ arm-mingw32ce-gcc -std=gnu99 -save-temps
> -I/home/vincent/local/wince/include -DNDEBUG -O3 -c cegcc-errno-bug.c 
> -DDLL_EXPORT -DPIC -o libeet_la-eet_lib.o
> cegcc-errno-bug.c: In function 'eet_close':
> cegcc-errno-bug.c:134: error: unrecognizable insn:
> (insn 6 5 7 3 cegcc-errno-bug.c:114 (set (reg/f:SI 138)
>         (symbol_ref:SI ("errno") [flags 0x4c0] <var_decl 0xb7db26e0
> errno>)) -1 (nil))
> cegcc-errno-bug.c:134: internal compiler error: in extract_insn, at
> recog.c:2048

> Of course I could report a bug but since original sources are patched the
> bug might be due to one of the modifications.
> And here is the testcase :

  You could probably have cut that down just to the definition of errno,
Eet_Error and eet_flush2.  Which actual definition of EAPI were you using?

> If I comment the errno variable inside the switch and replace it by 1 for
> instance, it compiles fine.
> Where should I start ?

  First thing would be to try and figure out why the insn isn't being
recognized.  This is rather odd unless your patch has affected the movsi
definition in the .md file.  Does the error go away if you make sure there is
no dllimport/export attribute?

    cheers,
      DaveK


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

* Re: Problem with  a cross-compiler based on gcc-trunk
  2009-03-23 18:55 ` Dave Korn
@ 2009-03-23 19:35   ` Vincent R.
  0 siblings, 0 replies; 3+ messages in thread
From: Vincent R. @ 2009-03-23 19:35 UTC (permalink / raw)
  To: gcc

On Mon, 23 Mar 2009 18:51:50 +0000, Dave Korn
<dave.korn.cygwin@googlemail.com> wrote:
> Vincent R. wrote:
> 
>> vincent@vincent-pc:~/projects$ arm-mingw32ce-gcc -std=gnu99 -save-temps
>> -I/home/vincent/local/wince/include -DNDEBUG -O3 -c cegcc-errno-bug.c 
>> -DDLL_EXPORT -DPIC -o libeet_la-eet_lib.o
>> cegcc-errno-bug.c: In function 'eet_close':
>> cegcc-errno-bug.c:134: error: unrecognizable insn:
>> (insn 6 5 7 3 cegcc-errno-bug.c:114 (set (reg/f:SI 138)
>>         (symbol_ref:SI ("errno") [flags 0x4c0] <var_decl 0xb7db26e0
>> errno>)) -1 (nil))
>> cegcc-errno-bug.c:134: internal compiler error: in extract_insn, at
>> recog.c:2048
> 
>> Of course I could report a bug but since original sources are patched
the
>> bug might be due to one of the modifications.
>> And here is the testcase :
> 
>   You could probably have cut that down just to the definition of errno,
> Eet_Error and eet_flush2.  Which actual definition of EAPI were you
using?
> 
>> If I comment the errno variable inside the switch and replace it by 1
for
>> instance, it compiles fine.
>> Where should I start ?
> 
>   First thing would be to try and figure out why the insn isn't being
> recognized.  This is rather odd unless your patch has affected the movsi
> definition in the .md file.  Does the error go away if you make sure
there
> is
> no dllimport/export attribute?
> 
>     cheers,
>       DaveK

Yes I think I forgot to apply some patch about dllimport/export.
That's the problem when maintaining something outside gcc trunk.
I will try to add the modification and test again.



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

end of thread, other threads:[~2009-03-23 18:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-23 18:42 Problem with a cross-compiler based on gcc-trunk Vincent R.
2009-03-23 18:55 ` Dave Korn
2009-03-23 19:35   ` Vincent R.

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).