fix(rtl): blaise_atomic uses Pointer params, not a public PInteger alias

blaise_atomic exported a PInteger = ^Integer type that collides with the same
alias in blaise_arc when the RTL units are compiled together into one program
(the pasbuild library / whole-program path), giving 'Duplicate type name
PInteger'.  The per-unit Makefile build never saw it.  Type the params as
Pointer (the asm body reads through %rdi regardless); the external-name callers
in blaise_arc are unaffected (link is by symbol).  Prerequisite for compiling
the RTL units together (RTL-unification).
This commit is contained in:
Graeme Geldenhuys 2026-06-25 15:23:05 +01:00
parent 0c4a22f5e2
commit 743ca4f5e6

View file

@ -22,16 +22,17 @@ unit blaise_atomic;
interface
type
PInteger = ^Integer;
function _AtomicAddInt32(Ptr: PInteger; Delta: Integer): Integer;
function _AtomicSubInt32(Ptr: PInteger; Delta: Integer): Integer;
{ Ptr addresses a 32-bit integer. Typed as Pointer (not a `PInteger` alias) so
this unit does not export a type name that collides with the same alias in
other RTL units when they are compiled together (e.g. blaise_arc's PInteger).
The body reads/writes through %rdi regardless of the Pascal pointer type. }
function _AtomicAddInt32(Ptr: Pointer; Delta: Integer): Integer;
function _AtomicSubInt32(Ptr: Pointer; Delta: Integer): Integer;
implementation
{ return *Ptr (old); *Ptr += Delta — atomically. }
function _AtomicAddInt32(Ptr: PInteger; Delta: Integer): Integer;
function _AtomicAddInt32(Ptr: Pointer; Delta: Integer): Integer;
assembler; nostackframe;
asm
movl %esi, %eax
@ -40,7 +41,7 @@ asm
end;
{ return *Ptr (old); *Ptr -= Delta — atomically (xadd of the negated delta). }
function _AtomicSubInt32(Ptr: PInteger; Delta: Integer): Integer;
function _AtomicSubInt32(Ptr: Pointer; Delta: Integer): Integer;
assembler; nostackframe;
asm
negl %esi