Skip to content

Commit 448ce4f

Browse files
authored
va_list, etc., improperly declared for AArch64 (dlang#21460)
1 parent a79089f commit 448ce4f

4 files changed

Lines changed: 30 additions & 3 deletions

File tree

compiler/src/dmd/main.d

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -940,7 +940,7 @@ bool parseCommandlineAndConfig(size_t argc, const(char)** argv, out Param params
940940
if (parseConfFile(environment, global.inifilename, inifilepath, cast(ubyte[])inifileBuffer[], &sections))
941941
return true;
942942

943-
const(char)[] arch = target.isX86_64 ? "64" : "32"; // use default
943+
const(char)[] arch = (target.isX86_64 || target.isAArch64) ? "64" : "32"; // use default
944944
arch = parse_arch_arg(&arguments, arch);
945945

946946
// parse architecture from DFLAGS read from [Environment] section

druntime/src/core/internal/vararg/aarch64.d

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,16 @@ extern (C++, std) struct __va_list
3535
int __vr_offs;
3636
}
3737

38-
///
39-
alias va_list = __va_list;
38+
version (DigitalMars)
39+
{
40+
///
41+
alias __va_list_tag = __va_list;
42+
///
43+
alias va_list = __va_list*;
44+
}
45+
else
46+
///
47+
alias va_list = __va_list; // kludge - va_list always passed by ref (!)
4048

4149
///
4250
T va_arg(T)(ref va_list ap)

druntime/src/core/stdc/config.d

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,23 @@ else version (DigitalMars)
260260
else version (Darwin)
261261
alias real c_long_double;
262262
}
263+
else version (AArch64)
264+
{
265+
version (linux)
266+
alias real c_long_double;
267+
else version (FreeBSD)
268+
alias real c_long_double;
269+
else version (OpenBSD)
270+
alias real c_long_double;
271+
else version (NetBSD)
272+
alias real c_long_double;
273+
else version (DragonFlyBSD)
274+
alias real c_long_double;
275+
else version (Solaris)
276+
alias real c_long_double;
277+
else version (Darwin)
278+
alias real c_long_double;
279+
}
263280
}
264281

265282
static assert(is(c_long_double), "c_long_double needs to be declared for this platform/architecture.");

druntime/src/core/stdc/stdarg.d

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,8 @@ else version (AAPCS32)
130130
else version (AAPCS64)
131131
{
132132
alias va_list = core.internal.vararg.aarch64.va_list;
133+
version (DigitalMars)
134+
public import core.internal.vararg.aarch64 : __va_list, __va_list_tag;
133135
}
134136
else version (RISCV_Any)
135137
{

0 commit comments

Comments
 (0)