February 21, 2023
https://issues.dlang.org/show_bug.cgi?id=23729

          Issue ID: 23729
           Summary: ignore custom object.d for CTFE needs
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody@puremagic.com
          Reporter: ryuukk.dev@gmail.com

Hello,

I use a custom runtime because i need that for WASM and other reasons

My runtime is minimal, it doesn't include bunch of stuff on purpose

I encountered an issue on Linux only (on windows it compiles and runs fine)

```
// dmd -betterC

import core.atomic;

int count;
extern(C) void main()
{
  atomicStore(count, 0);
  count = (atomicFetchAdd(count, 1) + 1);
  count = (atomicFetchSub(count, 1) - 1);
}
```

My custom object.d: https://gist.github.com/ryuukk/ecd85032b536e431d1350afbf945c3ad


Windows: all good

Linux:

```
dmd -betterC app.d
-- using custom runtime --
/home/ryuukk/dlang/dmd-2.102.1/linux/bin64/../../src/druntime/import/core/internal/atomic.d(1107):
Error: `object._d_arrayappendT` not found. The current runtime does not support
appending array to arrays, or the runtime is corrupt.
/home/ryuukk/dlang/dmd-2.102.1/linux/bin64/../../src/druntime/import/core/internal/atomic.d(1112):
Error: `object._d_arrayappendcTXImpl` not found. The current runtime does not
support appending element to arrays, or the runtime is corrupt.
/home/ryuukk/dlang/dmd-2.102.1/linux/bin64/../../src/druntime/import/core/internal/atomic.d(1121):
Error: `object._d_arrayappendT` not found. The current runtime does not support
appending array to arrays, or the runtime is corrupt.
/home/ryuukk/dlang/dmd-2.102.1/linux/bin64/../../src/druntime/import/core/internal/atomic.d(1137):
Error: `object._d_arrayappendT` not found. The current runtime does not support
appending array to arrays, or the runtime is corrupt.
/home/ryuukk/dlang/dmd-2.102.1/linux/bin64/../../src/druntime/import/core/internal/atomic.d(324):
       called from here: `simpleFormat("\n                asm pure nothrow
@nogc @trusted\n                {\n                    naked;\n
   xchg [%0], %1;\n    ?2                mov %2, %1;\n
ret;\n                }\n            ", ((string[3] __arrayliteral_on_stack1 =
["RSI", "EDI", null];) , cast(string[])__arrayliteral_on_stack1))`
/home/ryuukk/dlang/dmd-2.102.1/linux/bin64/../../src/druntime/import/core/internal/atomic.d(233):
Error: template instance `core.internal.atomic.atomicExchange!(MemoryOrder.seq,
false, int)` error instantiating
/home/ryuukk/dlang/dmd-2.102.1/linux/bin64/../../src/druntime/import/core/atomic.d(127):
       instantiated from here: `atomicStore!(MemoryOrder.seq, int)`
app.d(6):        instantiated from here: `atomicStore!(MemoryOrder.seq, int,
int)`
/home/ryuukk/dlang/dmd-2.102.1/linux/bin64/../../src/druntime/import/core/internal/atomic.d(271):
Error: CTFE failed because of previous errors in `simpleFormat`
/home/ryuukk/dlang/dmd-2.102.1/linux/bin64/../../src/druntime/import/core/atomic.d(172):
Error: template instance `core.internal.atomic.atomicFetchAdd!(MemoryOrder.seq,
true, int)` error instantiating
app.d(7):        instantiated from here: `atomicFetchAdd!(MemoryOrder.seq,
int)`
/home/ryuukk/dlang/dmd-2.102.1/linux/bin64/../../src/druntime/import/core/atomic.d(201):
Error: template instance `core.internal.atomic.atomicFetchSub!(MemoryOrder.seq,
true, int)` error instantiating
app.d(8):        instantiated from here: `atomicFetchSub!(MemoryOrder.seq,
int)`
(dmd-2.102.1)
```

--