Skip to content

Support the long specifier and ensure ABI compliance #312

@DrXiao

Description

@DrXiao

Description

The current parser cannot recognize the long specifier, so shecc cannot handle related types such as long, long long, long long int.

Therefore, this issue is created to track the long specifier implementation.

Target

  • long / long int (32-bit or 64-bit)
  • long long / long long int (at least 64-bit)
  • Combined with unsigned modifier
  • Ensure the ABI compliance when using the relevant types.

For example:

#include <stdio.h>
int test_ll(int a, int b, int c, int d, long long e) {
    return (e == 1000LL) ? 0 : 1;
}

int main() {
    if (test_ll(1, 2, 3, 4, 1000LL) == 0) {
        printf("PASS\n");
        return 0;
    }
    printf("FAIL: long long corrupted\n");
    return 1;
}

Under the Arm Architecture, it is required to ensure that the stack is 8-byte aligned when calling a function that has 8 byte object(s) on the stack. Besides, when passing 8 byte object(s) to registers, the use of registers should also comply with the ABI requirements.

When targeting the RISC-V architecture, the corresponding ABI compliance should also be ensured.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions