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

AOT doesn't know how to produce assembly for XCOFF binaries #9

Open
3 of 5 tasks
NattyNarwhal opened this issue Mar 1, 2018 · 3 comments
Open
3 of 5 tasks
Labels
area: JIT This issue affects the Mono JIT os: aix This issue affects AIX os: i This issue affects i priority; low This issue isn't too important type: enhancement New feature or request

Comments

@NattyNarwhal
Copy link
Member

NattyNarwhal commented Mar 1, 2018

AOT code can't be generated because the assembly generator for the runtime spits out code not appropriate for XCOFF, let alone IBM as.

I think AIX is closer to Windows than anything ELF?

Checklist of known tasks:

  • Verify we're using the 64-bit assembler mode

  • Verify if we want to use IBM instead of GNU as

    • This involves another dependency.
  • Disable DWARF output

    • Down the road, we could theoretically emit XCOFF debug info instead
  • Squash GNU syntax assumptions for PowerPC emitting

    • Seems contained within aot-runtime.c.
  • Squash ELF assumptions

    • I've conducted very brief experiments using GAS instead; it expicitly tells you what's not supported on AIX.
@NattyNarwhal NattyNarwhal added type: enhancement New feature or request os: aix This issue affects AIX os: i This issue affects i labels Mar 1, 2018
@NattyNarwhal
Copy link
Member Author

Initial experimentation

Looks like we need to figure out what's with section headers - does AIX not support subsections? This should be fine on ELF systems, but of course, AIX ain't ELF.

Some other stuff like that might need tweaking...

@NattyNarwhal
Copy link
Member Author

It turns out the answer for GNU vs. IBM as is "don't even bother with GNU as on AIX" in gentler terms. This will require a lot of refactoring....

@edelsohn
Copy link

edelsohn commented Jul 2, 2018

Note that GNU as on AIX is AIX XCOFF syntax. GNU as on AIX does not accept ELF-like syntax as input and translate it to XCOFF format on output.

AIX now supports DWARF debugging. The internals of the DWARF sections are standard DWARF. The names of the sections and DWARF section headers are slightly different. AIX assembler mostly accepts GCC-generated DWARF unchanged.

The rhythm for AIX assembler is a little different, especially the syntax introducing a function. There are pseudo-ops with identical purpose but different name.

The main difference is addressing. AIX XCOFF and Linux ELF are very similar in the concept of position independent addressing, but ELF was designed to delegate the creation of the address table to the linker (Global Offset Table aka GOT), while XCOFF was designed for the compiler to create and manage the address table (Table of Contents aka TOC). It's the same purpose and similar behavior, but requires a little more verbiage in the assembler files.

AIX only supports the traditional COFF sections (text, data, bss) and a few others. For finer granularity, it uses a concept called CSECT

    .csect .my_named_text_section[PR]

    .csect .my_named_data_section[RW]

The "[PR]" and "[RW]" are what XCOFF calls mapping classes. This is a decoration after the CSECT name that instructs the linker how to map the CSECTs to COFF sections. PR for PRogram maps to text. RW for Read/Write maps to data. RO for Read Only maps to text.

One needs a code address (with the dot) and function descriptor (without the dot) for functions.

GCC assembly language output for AIX is a good example to follow.

@NattyNarwhal NattyNarwhal added area: JIT This issue affects the Mono JIT priority; low This issue isn't too important labels Jul 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: JIT This issue affects the Mono JIT os: aix This issue affects AIX os: i This issue affects i priority; low This issue isn't too important type: enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants