[llvm] [JITLink][XCOFF] Setup initial build support for XCOFF (PR #127266)

Henry Jiang via llvm-commits llvm-commits at lists.llvm.org
Sun Feb 23 19:50:24 PST 2025


mustartt wrote:

I completed the work required to run a simple main with an immediate return code. I will clean up the patch and post it soon. But I ran into 2 problems that I need some suggestions for:

First, in order to call the main function, we need to be able to indirectly call through the function descriptor `.csect main[DS]`, which has the following structure:

```
  .globl	main[DS]                        # -- Begin function main
  .globl	.main
  
  .csect main[DS],3
  .vbyte	8, .main                        # @main
  .vbyte	8, TOC[TC0]
  .vbyte	8, 0
```

So the symbol `.main` and `main` both should have default visibility, and in the LinkGraph, they have `Scope::Default` and `Linkage::Strong`, but https://github.com/llvm/llvm-project/blob/8b1d38480b9de8992e6db742c17b3d41cb57b1c0/llvm/lib/ExecutionEngine/Orc/Core.cpp#L2914 is expecting `JITSymbolFlag::None` for `main` and `JITSymbolFlag::Callable` only.

```
In main resolving { (".main": 0xa00000000001000 [Callable]), ("main": 0xa00000000000000 [Data]) }
  Flags for .main: expected 0x20 found 0x30 // expected Callabled, found Callable and Exported
  Flags for main: expected 0x0 found 0x10 // expected None, found Exported
```




https://github.com/llvm/llvm-project/pull/127266


More information about the llvm-commits mailing list