This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

binutils on arm - research on Pedro's stuff


Guys,

I can confirm that Pedro's work (the binutils-head-wince_edited.diff
file that he posted) does provide a solution for my problems.

The solution is only partial, but that may not be a binutils problem.

Here's the detail :
- I created a Makefile (attached) to call gcc, gas, and ld in the same
way as demonstrated by an example from Pedro
- Pedro's example that just calls MessageBoxW() works with that.
- My example that calls fopen/fprintf/fclose doesn't do anything.
- In file2.c I made a mixture between both to call MessageBoxW before
and after the fopen call. Only the MessageBoxW call before fopen
happens, the one after is never reached. This is on a PDA, no other
feedback comes, the process is just gone. This may not be a binutils
issue at all.

So I would encourage you to look into Pedro's patch because it
transforms a clearly broken binutils (on ARM) into one that appears to
work.

	Danny
-- 
Danny Backx ; danny.backx - at - scarlet.be ; http://danny.backx.info
typedef unsigned short wchar_t;
typedef wchar_t WCHAR;
typedef const WCHAR* LPCWSTR;
typedef void* HWND;
typedef unsigned int UINT;

int MessageBoxW ( HWND hWnd , LPCWSTR lpText, LPCWSTR lpCaption, UINT uType);

int WinMainCRTStartup()
{
	  MessageBoxW(0, L"HELLO!", L"H3LLO!", 0);
}
struct FILE_;
typedef struct FILE_ FILE;
typedef unsigned short wchar_t;

FILE* fopen (const char *, const char *);
int fprintf (FILE *, const char *, ...);
int fclose (FILE *);

#define _C ' '
#define _S 'a'
#define _P 'a'
#define _N 'a'
#define _L 'a'
#define _X 'a'
#define _B 'c'
#define _U 'a'

#define _CTYPE_DATA_0_127 \
  _C,	_C,	_C,	_C,	_C,	_C,	_C,	_C, \
  _C,	_C|_S,	_C|_S,	_C|_S,	_C|_S,	_C|_S,	_C,	_C, \
  _C,	_C,	_C,	_C,	_C,	_C,	_C,	_C, \
  _C,	_C,	_C,	_C,	_C,	_C,	_C,	_C, \
  _S|_B,	_P,	_P,	_P,	_P,	_P,	_P,	_P, \
  _P,	_P,	_P,	_P,	_P,	_P,	_P,	_P, \
  _N,	_N,	_N,	_N,	_N,	_N,	_N,	_N, \
  _N,	_N,	_P,	_P,	_P,	_P,	_P,	_P, \
  _P,	_U|_X,	_U|_X,	_U|_X,	_U|_X,	_U|_X,	_U|_X,	_U, \
  _U,	_U,	_U,	_U,	_U,	_U,	_U,	_U, \
  _U,	_U,	_U,	_U,	_U,	_U,	_U,	_U, \
  _U,	_U,	_U,	_P,	_P,	_P,	_P,	_P, \
  _P,	_L|_X,	_L|_X,	_L|_X,	_L|_X,	_L|_X,	_L|_X,	_L, \
  _L,	_L,	_L,	_L,	_L,	_L,	_L,	_L, \
  _L,	_L,	_L,	_L,	_L,	_L,	_L,	_L, \
  _L,	_L,	_L,	_P,	_P,	_P,	_P,	_C

#define _CTYPE_DATA_128_256 \
  0,	0,	0,	0,	0,	0,	0,	0, \
  0,	0,	0,	0,	0,	0,	0,	0, \
  0,	0,	0,	0,	0,	0,	0,	0, \
  0,	0,	0,	0,	0,	0,	0,	0, \
  0,	0,	0,	0,	0,	0,	0,	0, \
  0,	0,	0,	0,	0,	0,	0,	0, \
  0,	0,	0,	0,	0,	0,	0,	0, \
  0,	0,	0,	0,	0,	0,	0,	0, \
  0,	0,	0,	0,	0,	0,	0,	0, \
  0,	0,	0,	0,	0,	0,	0,	0, \
  0,	0,	0,	0,	0,	0,	0,	0, \
  0,	0,	0,	0,	0,	0,	0,	0, \
  0,	0,	0,	0,	0,	0,	0,	0, \
  0,	0,	0,	0,	0,	0,	0,	0, \
  0,	0,	0,	0,	0,	0,	0,	0, \
  0,	0,	0,	0,	0,	0,	0,	0

const char _ctype_[1 + 256] = {
  0,
  _CTYPE_DATA_0_127,
  _CTYPE_DATA_128_256
};

const char* __ctype_ptr = _ctype_ + 1;

int local_fun(void)
{
  FILE	*f;

  f = fopen("/log.txt", "w");
  fprintf(f, "Hello\r\n");
  fprintf(f, "Hello %p\r\n", *__ctype_ptr);
  fclose(f);
  //	exit(0);
  return 0;
}

int WinMainCRTStartup(void)
{
#define TRIGGER

#ifndef TRIGGER
  FILE	*f;

  f = fopen("/log.txt", "w");
  fprintf(f, "Hello\r\n");
  fclose(f);
  //	exit(0);
  return 0;
#else
  return local_fun();
#endif
}
struct FILE_;
typedef struct FILE_ FILE;
typedef unsigned short wchar_t;

FILE* fopen (const char *, const char *);
int fprintf (FILE *, const char *, ...);
int fclose (FILE *);

#define _C ' '
#define _S 'a'
#define _P 'a'
#define _N 'a'
#define _L 'a'
#define _X 'a'
#define _B 'c'
#define _U 'a'

#define _CTYPE_DATA_0_127 \
  _C,	_C,	_C,	_C,	_C,	_C,	_C,	_C, \
  _C,	_C|_S,	_C|_S,	_C|_S,	_C|_S,	_C|_S,	_C,	_C, \
  _C,	_C,	_C,	_C,	_C,	_C,	_C,	_C, \
  _C,	_C,	_C,	_C,	_C,	_C,	_C,	_C, \
  _S|_B,	_P,	_P,	_P,	_P,	_P,	_P,	_P, \
  _P,	_P,	_P,	_P,	_P,	_P,	_P,	_P, \
  _N,	_N,	_N,	_N,	_N,	_N,	_N,	_N, \
  _N,	_N,	_P,	_P,	_P,	_P,	_P,	_P, \
  _P,	_U|_X,	_U|_X,	_U|_X,	_U|_X,	_U|_X,	_U|_X,	_U, \
  _U,	_U,	_U,	_U,	_U,	_U,	_U,	_U, \
  _U,	_U,	_U,	_U,	_U,	_U,	_U,	_U, \
  _U,	_U,	_U,	_P,	_P,	_P,	_P,	_P, \
  _P,	_L|_X,	_L|_X,	_L|_X,	_L|_X,	_L|_X,	_L|_X,	_L, \
  _L,	_L,	_L,	_L,	_L,	_L,	_L,	_L, \
  _L,	_L,	_L,	_L,	_L,	_L,	_L,	_L, \
  _L,	_L,	_L,	_P,	_P,	_P,	_P,	_C

#define _CTYPE_DATA_128_256 \
  0,	0,	0,	0,	0,	0,	0,	0, \
  0,	0,	0,	0,	0,	0,	0,	0, \
  0,	0,	0,	0,	0,	0,	0,	0, \
  0,	0,	0,	0,	0,	0,	0,	0, \
  0,	0,	0,	0,	0,	0,	0,	0, \
  0,	0,	0,	0,	0,	0,	0,	0, \
  0,	0,	0,	0,	0,	0,	0,	0, \
  0,	0,	0,	0,	0,	0,	0,	0, \
  0,	0,	0,	0,	0,	0,	0,	0, \
  0,	0,	0,	0,	0,	0,	0,	0, \
  0,	0,	0,	0,	0,	0,	0,	0, \
  0,	0,	0,	0,	0,	0,	0,	0, \
  0,	0,	0,	0,	0,	0,	0,	0, \
  0,	0,	0,	0,	0,	0,	0,	0, \
  0,	0,	0,	0,	0,	0,	0,	0, \
  0,	0,	0,	0,	0,	0,	0,	0

const char _ctype_[1 + 256] = {
  0,
  _CTYPE_DATA_0_127,
  _CTYPE_DATA_128_256
};

const char* __ctype_ptr = _ctype_ + 1;

int local_fun(void)
{
  FILE	*f;

  MessageBoxW(0, L"before file open", L"H3LLO!", 0);
  f = fopen("/storage card/devel/log.txt", "w");
  MessageBoxW(0, L"after file open", L"H3LLO!", 0);
  fprintf(f, "Hello\r\n");
  fprintf(f, "Hello %p\r\n", *__ctype_ptr);
  fclose(f);
  //	exit(0);
  return 0;
}

int WinMainCRTStartup(void)
{
  return local_fun();
}
.SUFFIXES:
.SUFFIXES:	.c .o .s .exe .dist .exedump .objdump

P=              /usr/ppc/bin/arm-wince-pe
STARTUP=	-e_WinMainCRTStartup		# -e_WinMain causes crash
PCC=            ${P}-gcc ${CFLAGS} ${STARTUP}
PAS=            ${P}-as
PLD=            ${P}-ld ${STARTUP}
WINDRES=        ${P}-windres

CFLAGS=         -DUNICODE -D_UNICODE -DWINE_UNICODE_NATIVE -DWINCE \
		${VERBOSE} ${INCLUDE}
#LDFLAGS=        -Wl,--major-subsystem-version=4,--minor-subsystem-version=20
CCLDFLAGS=        -Wl,--major-subsystem-version=3,--minor-subsystem-version=0
LDFLAGS=        --major-subsystem-version=3 --minor-subsystem-version=0
#INCLUDE=       -I/usr/include/wine/windows -I/usr/include/wine
INCLUDE=        -I/usr/ppc/arm-wince-pe/include \
		-I/usr/ppc/arm-wince-pe/sys-include/windows
VERBOSE=        # -v
PDADIR=         ":/storage card/devel"

LDPATH=		-L/usr/ppc/lib/gcc/arm-wince-pe/4.1.0
#LIBS=		-lcoredll
LIBS=		${LDPATH} -lcoredll -lwinsock -lgcc -lc -lcoredll -lwinsock -lgcc -lc

all::	dialog.exe dialog.exedump dialog.dist

.exe.dist:
	pcp $*.exe ${PDADIR}/$*.exe

.c.o:
	${PCC} -S -o $*.s $?
	${PAS} -o $@ $*.s

.c.s:
	${PCC} -S -o $@ $?

.s.o:
	${PAS} -o $@ $?

.o.exe:
	${PLD} -o $@ $? ${LDFLAGS} ${LIBS}

.exe.exedump:
	${P}-objdump -x -s -g -D $*.exe > $*.exedump

.o.objdump:
	${P}-objdump -x -s -g -D $*.o > $*.objdump

clean::
	-rm -f dialog.exe dialog.s dialog.o dialog.objdump dialog.exedump
	-rm -f hello.exe hello.s hello.o hello.objdump hello.exedump
	-rm -f file1.exe file1.s file1.o file1.objdump file1.exedump
	-rm -f file2.exe file2.s file2.o file2.objdump file2.exedump

all::	file1.exe file1.dist file1.exedump
all::	file2.exe file2.dist file2.exedump

Attachment: signature.asc
Description: This is a digitally signed message part


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]