Re: Getting to universal binaries for Darwin

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Getting to universal binaries for Darwin
Дата
Msg-id 28323.1216561695@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Getting to universal binaries for Darwin  (Peter Eisentraut <peter_e@gmx.net>)
Список pgsql-hackers
Peter Eisentraut <peter_e@gmx.net> writes:
> For example, I'm a bit curious on the following aspect.  This program should 
> fail to compile on 32-bit platforms but succeed on 64-bit:

> #include <stddef.h>

> struct s { char a; long b; };

> int main(int argc, char *argv[])
> {
>         int array[offsetof(struct s, b) - 5];

>         return 0;
> }

> What happens if you run gcc -arch i386 -arch ppp64 on it?  Does it require 
> success on both output architectures?

Seems so.  On a current MacBook Pro:

$ cat test.c
#include <stddef.h>

struct s { char a; long b; };

int main(int argc, char *argv[])
{       int array[offsetof(struct s, b) - 5];
       return 0;
}
$ gcc -c test.c
test.c: In function 'main':
test.c:7: error: size of array 'array' is too large
$ gcc -arch i386 -c test.c
test.c: In function 'main':
test.c:7: error: size of array 'array' is too large
$ gcc -arch x86_64 -c test.c
$ gcc -arch ppc -c test.c
test.c: In function 'main':
test.c:7: error: size of array 'array' is too large
$ gcc -arch ppc64 -c test.c
$ gcc -arch i386 -arch x86_64 -c test.c
test.c: In function 'main':
test.c:7: error: size of array 'array' is too large
lipo: can't figure out the architecture type of: /var/folders/5M/5MGusdunEbWmuxTsRCYfbk+++TI/-Tmp-//ccfrarXl.out
$ gcc -arch i386  -arch ppc -c test.c
test.c: In function 'main':
test.c:7: error: size of array 'array' is too large
test.c: In function 'main':
test.c:7: error: size of array 'array' is too large
lipo: can't figure out the architecture type of: /var/folders/5M/5MGusdunEbWmuxTsRCYfbk+++TI/-Tmp-//ccFqrJgr.out
$ 

This doesn't look amazingly well tested though: what I suspect is
happening is that it runs N instances of the compiler (note multiple
errors in the last case) and then tries to sew their output together
with lipo, whether they succeeded or not.  I'll bet the "can't figure
out" is reflecting not being able to make sense of a zero-length .o
file ...
        regards, tom lane


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: Re: Getting to universal binaries for Darwin
Следующее
От: "Heikki Linnakangas"
Дата:
Сообщение: Re: temp table problem