Re: Success with MinGW and AVR and LTO - almost

2010-01-10 Thread Richard Guenther
On Sun, Jan 10, 2010 at 10:36 PM, Andrew Hutchinson wrote: > > > Kai Tietz wrote: >> >> Well, open call there aren't that much but point of interest is in >> 'c-pch.c:  fd = open (name, O_RDONLY | O_BINARY, 0666);' as it uses >> O_BINARY, too. See also for pattern in libiberty mkstemps.c >> >> Reg

Re: Success with MinGW and AVR and LTO - almost

2010-01-10 Thread Andrew Hutchinson
Kai Tietz wrote: Well, open call there aren't that much but point of interest is in 'c-pch.c: fd = open (name, O_RDONLY | O_BINARY, 0666);' as it uses O_BINARY, too. See also for pattern in libiberty mkstemps.c Regards, Kai It looks like O_BINARY is already defined in system.h, so all

Re: Success with MinGW and AVR and LTO - almost

2010-01-10 Thread Kai Tietz
2010/1/10 Kai Tietz : > 2010/1/10 Andrew Hutchinson : >> >> >> Kai Tietz wrote: >>> >>> Well, on linux (libc) fopen/freopen/etc the "b" is an nop (but >>> handled). For O_BINARY the common approach here is to do the following >>> condifition before use: >>> >>> #ifndef O_BINARY >>> #define O_BINARY

Re: Success with MinGW and AVR and LTO - almost

2010-01-10 Thread Kai Tietz
2010/1/10 Andrew Hutchinson : > > > Kai Tietz wrote: >> >> Well, on linux (libc) fopen/freopen/etc the "b" is an nop (but >> handled). For O_BINARY the common approach here is to do the following >> condifition before use: >> >> #ifndef O_BINARY >> #define O_BINARY 0 >> #endif >> >> This is a patte

Re: Success with MinGW and AVR and LTO - almost

2010-01-10 Thread Andrew Hutchinson
Kai Tietz wrote: Well, on linux (libc) fopen/freopen/etc the "b" is an nop (but handled). For O_BINARY the common approach here is to do the following condifition before use: #ifndef O_BINARY #define O_BINARY 0 #endif This is a pattern pretty often used. To rely here on binmode.o is a way, t

Re: Success with MinGW and AVR and LTO - almost

2010-01-10 Thread Kai Tietz
2010/1/10 Andrew Hutchinson : > I think  "rb" is nop. However, O_BINARY is less portable. > > There is another way. If  MinGW hosted build  is linked with binmode.o - the > default for files become binary > Some other methods are here: > > http://oldwiki.mingw.org/index.php/binary > > > > > Rafael

Re: Success with MinGW and AVR and LTO - almost

2010-01-10 Thread Andrew Hutchinson
I think "rb" is nop. However, O_BINARY is less portable. There is another way. If MinGW hosted build is linked with binmode.o - the default for files become binary Some other methods are here: http://oldwiki.mingw.org/index.php/binary Rafael Espindola wrote: I hacked fopen/open calls i

Re: Success with MinGW and AVR and LTO - almost

2010-01-10 Thread Rafael Espindola
> I hacked fopen/open calls in  lto.c and lto-elf.c to use O_BINARY and "rb" > and compilation with -flto was then successful! > > I am not sure how this should be fixed properly. Using O_BINARY and "rb" should be a nop on unix, no? Is it wrong to use them on any arch we care about? > Andy Cheer

Success with MinGW and AVR and LTO - almost

2010-01-10 Thread Andrew Hutchinson
I have just succeed in building last snapshot version 4.5.0 20100107 for AVR target with working LTO on both LINUX and MinGW hosts! As noted before #define LINKER_NAME has to be deleted from target avr.h (I will raise patch for this) I also built avr target for MINGW under MSYS and this has