Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Treatment of INTEGER arguments smaller than eightbytes #2

Closed
fweimer opened this issue Dec 17, 2015 · 2 comments
Closed

Treatment of INTEGER arguments smaller than eightbytes #2

fweimer opened this issue Dec 17, 2015 · 2 comments

Comments

@fweimer
Copy link

fweimer commented Dec 17, 2015

It is currently not clear if the excess bits are zero, determined by sign extension, or undefined.

For example, if a function returns type int, the upper 32 bits of %rax could be:

  • always zero
  • all ones if the return value (as an int) is negative, zero otherwise
  • unspecified
@pcordes
Copy link

pcordes commented Aug 9, 2016

According to what I can dig up:

  • Return values have garbage outside the width of the return type.
  • Function args are different: narrow types are sign or zero extended to 32 bits, depending on their type. clang depends on this for incoming args, but gcc doesn't make that assumption. But both compilers do it when calling, so gcc code can call clang code.

The upper 32 bits of registers are always undefined garbage for types smaller than 64 bits.

@hjl-tools
Copy link
Owner

The x86-64 psABI issue should be discussed at

https://groups.google.com/forum/#!forum/x86-64-abi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants