PATCH: gcc4 alias fixes
Hi, This is the patch I use for gcc4.0 here. I am not really sure why this aliasing was introduced, but it will not work this way anymore. Ciao, Marcus diff -ruN -x CVS wine-20050419/include/msvcrt/conio.h marcus-wine-20050419/include/msvcrt/conio.h --- wine-20050419/include/msvcrt/conio.h2004-07-19 13:07:44.0 +0200 +++ marcus-wine-20050419/include/msvcrt/conio.h 2005-04-13 13:03:23.0 +0200 @@ -53,7 +53,7 @@ static inline unsigned short outpw(unsigned short i, unsigned short j) { return _outpw(i, j); } #endif -#ifdef __GNUC__ +#if defined(__GNUC__) && (__GNUC__ < 4) extern int cprintf(const char*,...) __attribute__((alias("_cprintf"),format(printf,1,2))); extern int cscanf(const char*,...) __attribute__((alias("_cscanf"),format(scanf,1,2))); #else diff -ruN -x CVS wine-20050419/include/msvcrt/io.h marcus-wine-20050419/include/msvcrt/io.h --- wine-20050419/include/msvcrt/io.h 2004-07-19 13:07:44.0 +0200 +++ marcus-wine-20050419/include/msvcrt/io.h2005-04-13 13:03:23.0 +0200 @@ -175,7 +175,7 @@ #endif static inline int write(int fd, const void* buf, unsigned int size) { return _write(fd, buf, size); } -#ifdef __GNUC__ +#if defined(__GNUC__) && (__GNUC__ < 4) extern int open(const char*,int,...) __attribute__((alias("_open"))); extern int sopen(const char*,int,int,...) __attribute__((alias("_sopen"))); #else diff -ruN -x CVS wine-20050419/include/msvcrt/process.h marcus-wine-20050419/include/msvcrt/process.h --- wine-20050419/include/msvcrt/process.h 2004-07-19 13:07:44.0 +0200 +++ marcus-wine-20050419/include/msvcrt/process.h 2005-04-13 13:03:23.0 +0200 @@ -125,7 +125,7 @@ static inline int spawnvp(int flags, const char* name, const char* const* argv) { return _spawnvp(flags, name, argv); } static inline int spawnvpe(int flags, const char* name, const char* const* argv, const char* const* envv) { return _spawnvpe(flags, name, argv, envv); } -#ifdef __GNUC__ +#if defined(__GNUC__) && (__GNUC__ < 4) extern int execl(const char*,const char*,...) __attribute__((alias("_execl"))); extern int execle(const char*,const char*,...) __attribute__((alias("_execle"))); extern int execlp(const char*,const char*,...) __attribute__((alias("_execlp"))); pgpmW8D8PmwoK.pgp Description: PGP signature
Re: PATCH: gcc4 alias fixes
On Sun, Apr 24, 2005 at 10:02:47PM +0200, Marcus Meissner wrote: > Hi, > > This is the patch I use for gcc4.0 here. > > I am not really sure why this aliasing was introduced, > but it will not work this way anymore. I still don't understand why it doesn't work. It was introduced because using macros it not always acceptable. Some source uses these functions in ways that break if they are defined as macros. Defining them as inline functions work, but we can't do so for varargs, in which case we used aliases. What was the reason to break them, and why they don't work? They are aliasing to things that _are_ defined, so I'm not sure what is going on there. -- Dimi.
Re: PATCH: gcc4 alias fixes
Dimitrie O. Paun wrote: This is the patch I use for gcc4.0 here. I am not really sure why this aliasing was introduced, but it will not work this way anymore. I still don't understand why it doesn't work. It was introduced because using macros it not always acceptable. Some source uses these functions in ways that break if they are defined as macros. Defining them as inline functions work, but we can't do so for varargs, in which case we used aliases. What was the reason to break them, and why they don't work? They are aliasing to things that _are_ defined, so I'm not sure what is going on there. http://www.gnu.org/software/gcc/gcc-4.0/changes.html says (not that I really understand it totally): --- snip --- Given __attribute__((alias("target"))) it is now an error if target is not a symbol, defined in the same translation unit. This also applies to aliases created by #pragma weak alias=target. This is because it's meaningless to define an alias to an undefined symbol. On Solaris, the native assembler would have caught this error, but GNU as does not. --- snip --- - Dan -- Trying to get a job as a c++ developer? See http://kegel.com/academy/getting-hired.html
Re: PATCH: gcc4 alias fixes
On Mon, Apr 25, 2005 at 10:43:09PM -0700, Dan Kegel wrote: > Dimitrie O. Paun wrote: > >>This is the patch I use for gcc4.0 here. > >> > >>I am not really sure why this aliasing was introduced, > >>but it will not work this way anymore. > > > >I still don't understand why it doesn't work. > > > >It was introduced because using macros it not always acceptable. > >Some source uses these functions in ways that break if they are > >defined as macros. > > > >Defining them as inline functions work, but we can't do so for > >varargs, in which case we used aliases. > > > >What was the reason to break them, and why they don't work? > >They are aliasing to things that _are_ defined, so I'm not > >sure what is going on there. > > http://www.gnu.org/software/gcc/gcc-4.0/changes.html > says (not that I really understand it totally): > > --- snip --- > Given __attribute__((alias("target"))) it is now an > error if target is not a symbol, defined in the same > translation unit. This also applies to aliases created > by #pragma weak alias=target. > This is because it's meaningless to define an alias to > an undefined symbol. On Solaris, the native assembler > would have caught this error, but GNU as does not. > --- snip --- Yes, thats what I found out too. The problem is that "aliases" are only useable for renaming functions in the compilation units where they are defined, not for some kind of highlevel "#define" method. Ciao, Marcus pgp5XiZuNcrtj.pgp Description: PGP signature