From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1164f8,c9824e214e2c21c X-Google-Attributes: gid1164f8,public From: mogul@pa.dec.com (Jeffrey Mogul) Subject: a little more about -xtaso and -taso in Digital UNIX Date: 1995/12/16 Message-ID: <4at731$17e@usenet.pa.dec.com>#1/1 X-Deja-AN: 121941112 references: <4angp1$bp5@topaz.sensor.com> organization: DEC Western Research newsgroups: comp.sys.dec In article danpop@mail.cern.ch (Dan Pop) writes: >Second, the way -xtaso works. Your pointers are still 64-bit, but the >most significant 32 bits are zero. This can be easily proved: > > ues5:~/tmp 76> cat test.c > #include > main(int argc, char **argv) > { > char *p; > printf("%ld\n", (long)sizeof p); > return 0; > } > ues5:~/tmp 77> cc -xtaso test.c > ues5:~/tmp 78> ./a.out > 8 Actually, this is still a little confused. There are two different kinds of flags: -taso tells the *linker* to load the program in a 32-bit address space (i.e., all program addresses have the upper 32 bits zero). -xtaso tells the *compiler* to pay attention to the #pragma pointer_size directives Here's another example program (dan.c): #include main(int argc, char **argv) { char *p = "Hello WRL"; printf("%ld %p\n", (long)sizeof p, p); return 0; } and here is the result of compiling it several ways. % cc dan.c % a.out 8 140000010 % cc -xtaso dan.c % a.out 8 140000010 Note: -xtaso has NO effect on the most significant bits of the pointer. That address has 9 hex digits % cc -taso dan.c % a.out 8 14000010 Aha. Now we have only 8 hex digits in the address. Obviously, if you are compiling a module with -xtaso (and using #pragma pointer_size (short) anywhere) you must link the program using -taso, or the results will be unpleasant. >The easiest way to get 32-bit pointers is to use -xtaso_short instead: A little too easy. I would advise never using -xtaso_short, since unless you are not #including any header files, it's likely to cause trouble. Use -xtaso and #pragma pointer_size. -Jeff