public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
* primitive type size
@ 2017-10-05 21:31 Onorato Vaticone
  2017-10-05 22:28 ` Jonathan Wakely
  0 siblings, 1 reply; 6+ messages in thread
From: Onorato Vaticone @ 2017-10-05 21:31 UTC (permalink / raw)
  To: libstdc++

Hi all,

I have a question I hope you can help to clarify.

Context: I know Unix/*Linux uses the data model LP64.
http://www.unix.org/version2/whatsnew/lp64_wp.html

I'd like to know if gcc uses the data model information of the underlying
OS to decide the size of the primitive type since the C++ standard does not
dictate any size.

appreciated any help.
/Ono

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: primitive type size
  2017-10-05 21:31 primitive type size Onorato Vaticone
@ 2017-10-05 22:28 ` Jonathan Wakely
  2017-10-06 10:45   ` Onorato Vaticone
  0 siblings, 1 reply; 6+ messages in thread
From: Jonathan Wakely @ 2017-10-05 22:28 UTC (permalink / raw)
  To: Onorato Vaticone; +Cc: libstdc++

On 5 October 2017 at 22:31, Onorato Vaticone wrote:
> Hi all,
>
> I have a question I hope you can help to clarify.
>
> Context: I know Unix/*Linux uses the data model LP64.
> http://www.unix.org/version2/whatsnew/lp64_wp.html

For 64-bit, yes, but ILP32 for 32-bit.

> I'd like to know if gcc uses the data model information of the underlying
> OS to decide the size of the primitive type since the C++ standard does not
> dictate any size.

The type sizes used by the OS are dictated by the psABI document for
the processor. GCC follows the relevant psABI for the target.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: primitive type size
  2017-10-05 22:28 ` Jonathan Wakely
@ 2017-10-06 10:45   ` Onorato Vaticone
  2017-10-06 11:20     ` Jonathan Wakely
  0 siblings, 1 reply; 6+ messages in thread
From: Onorato Vaticone @ 2017-10-06 10:45 UTC (permalink / raw)
  To: Jonathan Wakely; +Cc: libstdc++

that is a relevant piece of information! Thanks a lot.
Based on what you've said gcc doesn't care if Linux is 32 or 64 bit (i.e.:
using ILP32 or LP64) as it just refers to the psABI. Is this correct? Do
you guys have more info on this? white paper, post, code to look, etc ?

thanks in advance.
Ono

On 5 October 2017 at 23:28, Jonathan Wakely <jwakely.gcc@gmail.com> wrote:

> On 5 October 2017 at 22:31, Onorato Vaticone wrote:
> > Hi all,
> >
> > I have a question I hope you can help to clarify.
> >
> > Context: I know Unix/*Linux uses the data model LP64.
> > http://www.unix.org/version2/whatsnew/lp64_wp.html
>
> For 64-bit, yes, but ILP32 for 32-bit.
>
> > I'd like to know if gcc uses the data model information of the underlying
> > OS to decide the size of the primitive type since the C++ standard does
> not
> > dictate any size.
>
> The type sizes used by the OS are dictated by the psABI document for
> the processor. GCC follows the relevant psABI for the target.
>



-- 
Onorato Vaticone
m : +393 85 2152462
email : onorato.vaticone@gmail.com
web : www.onoratovaticone.it

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: primitive type size
  2017-10-06 10:45   ` Onorato Vaticone
@ 2017-10-06 11:20     ` Jonathan Wakely
  2017-10-06 11:37       ` Jonathan Wakely
  0 siblings, 1 reply; 6+ messages in thread
From: Jonathan Wakely @ 2017-10-06 11:20 UTC (permalink / raw)
  To: Onorato Vaticone; +Cc: libstdc++

On 6 October 2017 at 11:45, Onorato Vaticone wrote:
> that is a relevant piece of information! Thanks a lot.
> Based on what you've said gcc doesn't care if Linux is 32 or 64 bit (i.e.:
> using ILP32 or LP64) as it just refers to the psABI. Is this correct? Do you

It certainly _cares_, because it needs to know whether it's generating
32-bit or 64-bit code, but it supports both. And it doesn't make up
its own rules, it follows the psABI for the processor.


> guys have more info on this? white paper, post, code to look, etc ?

More info on what? The psABI or the fact that GCC uses it?

What exactly are you trying to find out? And why are you asking on the
libstdc++ list?

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: primitive type size
  2017-10-06 11:20     ` Jonathan Wakely
@ 2017-10-06 11:37       ` Jonathan Wakely
  2017-10-06 11:55         ` Onorato Vaticone
  0 siblings, 1 reply; 6+ messages in thread
From: Jonathan Wakely @ 2017-10-06 11:37 UTC (permalink / raw)
  To: Onorato Vaticone; +Cc: libstdc++

On 6 October 2017 at 12:20, Jonathan Wakely wrote:
> On 6 October 2017 at 11:45, Onorato Vaticone wrote:
>> that is a relevant piece of information! Thanks a lot.
>> Based on what you've said gcc doesn't care if Linux is 32 or 64 bit (i.e.:
>> using ILP32 or LP64) as it just refers to the psABI. Is this correct? Do you
>
> It certainly _cares_, because it needs to know whether it's generating
> 32-bit or 64-bit code, but it supports both. And it doesn't make up
> its own rules, it follows the psABI for the processor.
>
>
>> guys have more info on this? white paper, post, code to look, etc ?
>
> More info on what? The psABI or the fact that GCC uses it?
>
> What exactly are you trying to find out? And why are you asking on the
> libstdc++ list?

http://wiki.osdev.org/System_V_ABI might give you some useful links.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: primitive type size
  2017-10-06 11:37       ` Jonathan Wakely
@ 2017-10-06 11:55         ` Onorato Vaticone
  0 siblings, 0 replies; 6+ messages in thread
From: Onorato Vaticone @ 2017-10-06 11:55 UTC (permalink / raw)
  To: Jonathan Wakely; +Cc: libstdc++

it certainly does, thanks!
I'm looking at the gcc code and I've found a couple of things interesting.

- the primitive data types are ultimately defined by the TARGET_ABI_X32 ...
etc ...
- each target has it's own header (e.g.: cygming.h, i386, dragonfly.h, etc
...) which redefine (if necessary some define).

that is all I needed :-)
thanks a lot and I'm sorry if I've been writing here!

On 6 October 2017 at 12:37, Jonathan Wakely <jwakely.gcc@gmail.com> wrote:

> On 6 October 2017 at 12:20, Jonathan Wakely wrote:
> > On 6 October 2017 at 11:45, Onorato Vaticone wrote:
> >> that is a relevant piece of information! Thanks a lot.
> >> Based on what you've said gcc doesn't care if Linux is 32 or 64 bit
> (i.e.:
> >> using ILP32 or LP64) as it just refers to the psABI. Is this correct?
> Do you
> >
> > It certainly _cares_, because it needs to know whether it's generating
> > 32-bit or 64-bit code, but it supports both. And it doesn't make up
> > its own rules, it follows the psABI for the processor.
> >
> >
> >> guys have more info on this? white paper, post, code to look, etc ?
> >
> > More info on what? The psABI or the fact that GCC uses it?
> >
> > What exactly are you trying to find out? And why are you asking on the
> > libstdc++ list?
>
> http://wiki.osdev.org/System_V_ABI might give you some useful links.
>



-- 
Onorato Vaticone
m : +393 85 2152462
email : onorato.vaticone@gmail.com
web : www.onoratovaticone.it

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-10-06 11:55 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-05 21:31 primitive type size Onorato Vaticone
2017-10-05 22:28 ` Jonathan Wakely
2017-10-06 10:45   ` Onorato Vaticone
2017-10-06 11:20     ` Jonathan Wakely
2017-10-06 11:37       ` Jonathan Wakely
2017-10-06 11:55         ` Onorato Vaticone

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).