This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch v2] convert config/vms/*crt0* files to gcc style (PR 44242)
On Sep 22, 2010, at 6:04 PM, Richard Henderson wrote:
> On 09/22/2010 04:02 AM, Tristan Gingold wrote:
>> Richard, you have traditionally approved the VMS patches so I have
>> CC'ed you. However, if the SC think the VMS files deserve a
>> maintainer, I (and/or Doug Rupp) will be happy to become maintainers
>> for the VMS specific parts.
>
> I do think one of you should become VMS maintainer.
Ok, I will forward that to the SC.
>>> - char **argv;
>>> - char **envp;
>>> -
>>> -#pragma __pointer_size long
>>> -
>>> - int i;
>>> - char **long_argv;
>>> - char **long_envp;
> ...
>>> + int argc;
>>> + int argv;
>>> + int envp;
>>> + int status;
>>> + int i;
>>> + long long *long_argv;
>>> + long long *long_envp;
>
> It would make much more sense to me if you were to use __attribute__((mode()))
> to change pointer sizes, rather than just casting between integer types.
Interesting comment, as internally we use a lot the mode() to deals with pointers
size in C.
> In particular, that would get you extension via ADDP4 on ia64, which surely is
> More Correct. It may so happen that vms is not using ia64 segmentation, but it
> feels wrong to ignore it entirely.
I am not sure that this is 'More Correct'. VMS only use segments 0 (process private space)
and 7 (system space) - this is for compatibility with Alpha; therefore addp4 might
create invalid addresses. On VMS the address must simply be signed extended.
I have double-checked with the VMS native compiler and it doesn't use addp4
to extend addresses but sxt4:
$ type extend.c
#pragma pointer_size 32
typedef char *p32;
#pragma pointer_size 64
typedef char *p64;
p64 conv (p32 a)
{
return (p64) a;
}
...
CONV:
// 000007
{ .mib
002C00204840 0000 alloc r33 = rspfs, 1, 1, 0, 0
0000B2000200 0001 sxt4 r8 = a
// r8 = r32 // 000009
004000000000 0002 nop.b 0 ;;
}
{ .mfb
000008000000 0010 nop.m 0
000008000000 0011 nop.f 0
000108001100 0012 br.ret.sptk.many rp ;;
// br0
}
.endp CONV
The use of addp4 is enabled only when TARGET_ILP32 is set - which is not true for VMS,
so using the mode() attribute is only a style choice.
With this deeper view, tell me if you prefer a version with mode() attributes. If so, I will
write and test it. (Or it might be done as a follow-up).
Tristan.