Skip to content

Commit 6c95fe8

Browse files
committed
cv8.d: compile for all platforms
1 parent aa2c8e4 commit 6c95fe8

8 files changed

Lines changed: 47 additions & 41 deletions

File tree

dm/src/dmc/cod3.d

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -533,11 +533,13 @@ void cod3_stackalign(ref CodeBuilder cdb, int nbytes)
533533
cdb.genc2(0x81, grex | rm, -nbytes);
534534
}
535535

536-
static if (ELFOBJ)
537-
{
538536
/* Constructor that links the ModuleReference to the head of
539537
* the list pointed to by _Dmoduleref
538+
*
539+
* For ELF object files.
540540
*/
541+
static if (0)
542+
{
541543
void cod3_buildmodulector(Outbuffer* buf, int codeOffset, int refOffset)
542544
{
543545
/* ret
@@ -595,10 +597,8 @@ void cod3_buildmodulector(Outbuffer* buf, int codeOffset, int refOffset)
595597

596598
buf.writeByte(0xC3); /* ret */
597599
}
598-
599600
}
600601

601-
602602
/*****************************
603603
* Given a type, return a mask of
604604
* registers to hold that type.
@@ -1616,8 +1616,10 @@ static if (JMPJMPTABLE)
16161616
cgstate.stackclean--;
16171617
return;
16181618
}
1619-
else static if (TARGET_OSX)
1619+
else
16201620
{
1621+
if (config.exe & (EX_OSX | EX_OSX64))
1622+
{
16211623
/* CALL L1
16221624
* L1: POP R1
16231625
* ADD R1,disp[reg*4][R1]
@@ -1634,9 +1636,9 @@ else static if (TARGET_OSX)
16341636
cdb.last().IEV1.Vswitch = b;
16351637
cdb.last().Isib = modregrm(2,reg,r1);
16361638
cdb.gen2(0xFF,modregrm(3,4,r1)); // JMP R1
1637-
}
1638-
else
1639-
{
1639+
}
1640+
else
1641+
{
16401642
if (config.flags3 & CFG3pic)
16411643
{
16421644
/* MOV R1,EBX
@@ -1664,6 +1666,7 @@ else
16641666
cdb.last().IEV1.Vswitch = b;
16651667
cdb.last().Isib = modregrm(2,reg,5);
16661668
}
1669+
}
16671670
}
16681671
}
16691672
else if (I16)

dm/src/dmc/cv8.d

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,13 @@ extern (C++):
4949

5050
nothrow:
5151

52-
static if (TARGET_WINDOS)
52+
static if (1)
5353
{
5454

5555
int REGSIZE();
5656

5757
// Determine if this Symbol is stored in a COMDAT
58-
bool symbol_iscomdat(Symbol* s)
58+
private bool symbol_iscomdat4(Symbol* s)
5959
{
6060
version (MARS)
6161
{
@@ -272,7 +272,7 @@ void cv8_termfile(const(char)* objfilename)
272272
F2_buf.write(linepair.buf + fd.linepairstart, fd.linepairbytes);
273273

274274
int f2seg = seg;
275-
if (symbol_iscomdat(fd.sfunc))
275+
if (symbol_iscomdat4(fd.sfunc))
276276
{
277277
f2seg = MsCoffObj_seg_debugS_comdat(fd.sfunc);
278278
objmod.bytes(f2seg, 0, 4, &value);
@@ -356,7 +356,7 @@ void cv8_func_start(Symbol *sfunc)
356356
currentfuncdata.linepairbytes = 0;
357357
currentfuncdata.f1buf = F1_buf;
358358
currentfuncdata.f1fixup = F1fixup;
359-
if (symbol_iscomdat(sfunc))
359+
if (symbol_iscomdat4(sfunc))
360360
{
361361
// This leaks memory
362362
currentfuncdata.f1buf = cast(Outbuffer*)mem_calloc(Outbuffer.sizeof);

dm/src/dmc/dexp2.d

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4603,16 +4603,8 @@ enum LLLNG = OP64_32;
46034603
enum PTRLPTR = OPnp_fp;
46044604
enum OFFSET = OPoffset;
46054605
enum FPTR = OPvp_fp;
4606-
static if (TARGET_OSX)
4607-
{
4608-
enum TOF16 = NONE;
4609-
enum FRF16 = PAINT;
4610-
}
4611-
else
4612-
{
46134606
enum TOF16 = OPnp_f16p;
46144607
enum FRF16 = OPf16p_np;
4615-
}
46164608

46174609
enum NONE = OPMAX; /* no conversion */
46184610
enum PAINT = (OPMAX+1); /* just 'paint' new type over the old one */
@@ -5118,6 +5110,12 @@ static if (0)
51185110
e = exp2_cast(e, newt);
51195111
break;
51205112

5113+
case OPnp_f16p:
5114+
case OPf16p_np:
5115+
if (config.exe & (EX_OSX | EX_OSX64))
5116+
goto paint;
5117+
goto default;
5118+
51215119
default: /* action is operator number */
51225120
doaction:
51235121
static if (0)

dm/src/dmc/dt.d

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,10 @@ nothrow:
263263
/*****************************************
264264
* Write a reference to the data ptr[0..size+nzeros]
265265
* Params:
266+
* ty = pointer type
267+
* offset = to be added to offset of data generated
268+
* size = number of bytes pointed to by ptr
269+
* ptr = points to data bytes
266270
* nzeros = number of zero bytes to add to the end
267271
* _align = alignment of pointed-to data
268272
*/
@@ -429,7 +433,7 @@ nothrow:
429433
{
430434
dt_t *dt = dt_calloc(DT_coff);
431435

432-
static if (TARGET_SEGMENTED)
436+
if (config.exe & EX_segmented)
433437
dt.Dty = TYcptr;
434438
else
435439
dt.Dty = TYnptr;

dm/src/dmc/mscoffobj.d

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2588,6 +2588,13 @@ extern (D) private void objflush_pointerRefs()
25882588
ptrref_buf.reset();
25892589
}
25902590

2591+
}
2592+
else
2593+
{
2594+
segidx_t MsCoffObj_seg_pdata() { assert(0); }
2595+
segidx_t MsCoffObj_seg_xdata() { assert(0); }
2596+
segidx_t MsCoffObj_seg_pdata_comdat(Symbol *sfunc) { assert(0); }
2597+
segidx_t MsCoffObj_seg_xdata_comdat(Symbol *sfunc) { assert(0); }
25912598
}
25922599

25932600
}

dm/src/dmc/obj.d

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -184,14 +184,15 @@ version (Windows)
184184
void MsCoffObj_addrel(int seg, targ_size_t offset, Symbol *targsym,
185185
uint targseg, int rtype, int val);
186186
int MsCoffObj_seg_drectve();
187-
int MsCoffObj_seg_pdata();
188-
int MsCoffObj_seg_xdata();
189-
int MsCoffObj_seg_pdata_comdat(Symbol *sfunc);
190-
int MsCoffObj_seg_xdata_comdat(Symbol *sfunc);
191187
int MsCoffObj_seg_debugS();
192188
int MsCoffObj_seg_debugS_comdat(Symbol *sfunc);
193189
}
194190

191+
int MsCoffObj_seg_pdata();
192+
int MsCoffObj_seg_xdata();
193+
int MsCoffObj_seg_pdata_comdat(Symbol *sfunc);
194+
int MsCoffObj_seg_xdata_comdat(Symbol *sfunc);
195+
195196
version (Posix)
196197
{
197198
Obj Obj_init(Outbuffer *, const(char)* filename, const(char)* csegname);

dm/src/dmc/pdata.d

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,8 @@ extern (C++):
3636

3737
nothrow:
3838

39-
static if (TARGET_WINDOS)
40-
{
41-
4239
// Determine if this Symbol is stored in a COMDAT
43-
bool symbol_iscomdat3(Symbol* s)
40+
private bool symbol_iscomdat3(Symbol* s)
4441
{
4542
version (MARS)
4643
{
@@ -65,14 +62,12 @@ enum ALLOCA_LIMIT = 0x10000;
6562
* Creates an instance of struct RUNTIME_FUNCTION:
6663
* http://msdn.microsoft.com/en-US/library/ft9x1kdx(v=vs.80).aspx
6764
*
68-
* Input:
69-
* sf function to generate unwind data for
65+
* Params:
66+
* sf = function to generate unwind data for
7067
*/
7168

72-
void win64_pdata(Symbol *sf)
69+
public void win64_pdata(Symbol *sf)
7370
{
74-
// return; // doesn't work yet
75-
7671
//printf("win64_pdata()\n");
7772
assert(config.exe == EX_WIN64);
7873

@@ -108,6 +103,8 @@ void win64_pdata(Symbol *sf)
108103
if (sflen >= ALLOCA_LIMIT) free(pdata_name);
109104
}
110105

106+
private:
107+
111108
/**************************************************
112109
* Unwind data symbol goes in the .xdata section.
113110
* Input:
@@ -116,7 +113,7 @@ void win64_pdata(Symbol *sf)
116113
* generated symbol referring to unwind data
117114
*/
118115

119-
Symbol *win64_unwind(Symbol *sf)
116+
private Symbol *win64_unwind(Symbol *sf)
120117
{
121118
// Generate the unwind name, which is $unwind$funcname
122119
size_t sflen = strlen(sf.Sident.ptr);
@@ -213,7 +210,7 @@ static if (0)
213210

214211

215212

216-
dt_t *unwind_data()
213+
private dt_t *unwind_data()
217214
{
218215
UNWIND_INFO ui;
219216

@@ -288,9 +285,4 @@ static if (1)
288285
dtb.nbytes(4 + ((ui.CountOfCodes + 1) & ~1) * 2,cast(char *)&ui);
289286
return dtb.finish();
290287
}
291-
292-
}
293-
else
294-
void win64_pdata(Symbol *sf) { }
295-
296288
}

dm/src/dmc/stubobj.d

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ class Obj
9494
int common_block(Symbol *s,int flag,targ_size_t size,targ_size_t count) { return 0; }
9595
void write_bytes(seg_data *pseg, uint nbytes, void *p) { }
9696
void gotref(Symbol *s) { }
97+
void refGOTsym() { }
9798
int jmpTableSegment(Symbol* s) { return 0; }
9899
}
99100
}

0 commit comments

Comments
 (0)