summaryrefslogtreecommitdiff
path: root/compiler/x86/agx86att.pas
blob: d2bc40bad94f08ce833b7e466fd6038a8a194208 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
{
    Copyright (c) 1998-2002 by Florian Klaempfl

    This unit implements an asmoutput class for i386 AT&T syntax

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

 ****************************************************************************
}
{ This unit implements an asmoutput class for i386 AT&T syntax
}
unit agx86att;

{$i fpcdefs.inc}

interface

    uses
      cpubase,systems,
      globtype,cgutils,
      aasmtai,assemble,aggas;

    type
      Tx86ATTAssembler=class(TGNUassembler)
        constructor CreateWithWriter(info: pasminfo; wr: TExternalAssemblerOutputFile; freewriter, smart: boolean); override;
        function MakeCmdLine: TCmdStr; override;
      end;

      Tx86AppleGNUAssembler=class(TAppleGNUassembler)
        constructor CreateWithWriter(info: pasminfo; wr: TExternalAssemblerOutputFile; freewriter, smart: boolean); override;
      end;

      Tx86AoutGNUAssembler=class(TAoutGNUassembler)
        constructor CreateWithWriter(info: pasminfo; wr: TExternalAssemblerOutputFile; freewriter, smart: boolean); override;
      end;


     Tx86InstrWriter=class(TCPUInstrWriter)
       private
        procedure WriteReference(var ref : treference);
        procedure WriteOper(const o:toper);
        procedure WriteOper_jmp(const o:toper);
       protected
        fskipPopcountSuffix: boolean;
        { http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56656 }
        fNoInterUnitMovQ: boolean;
       public
        procedure WriteInstruction(hp: tai);override;
     end;



  implementation

    uses
      cutils,
      verbose,
      itcpugas,
      cgbase,
      aasmcpu;


{****************************************************************************
                            Tx86ATTAssembler
 ****************************************************************************}

    constructor Tx86ATTAssembler.CreateWithWriter(info: pasminfo; wr: TExternalAssemblerOutputFile; freewriter, smart: boolean);
      begin
        inherited;
        InstrWriter := Tx86InstrWriter.create(self);
      end;

    function TX86ATTAssembler.MakeCmdLine: TCmdStr;
      var
        FormatName : string;
      begin
        result:=Inherited MakeCmdLine;
{$ifdef i386}
        case target_info.system of
          system_i386_go32v2:
            FormatName:='coff';
          system_i386_wdosx,
          system_i386_win32:
            FormatName:='win32';
          system_i386_embedded:
            FormatName:='obj';
          system_i386_linux,
          system_i386_beos:
            FormatName:='elf';
          system_i386_darwin:
            FormatName:='macho32';
        else
          FormatName:='elf';
        end;
{$endif i386}
{$ifdef x86_64}
        case target_info.system of
          system_x86_64_win64:
            FormatName:='win64';
          system_x86_64_darwin:
            FormatName:='macho64';
          system_x86_64_embedded:
            FormatName:='obj';
          system_x86_64_linux:
            FormatName:='elf64';
        else
          FormatName:='elf64';
        end;
{$endif x86_64}
        Replace(result,'$FORMAT',FormatName);
      end;

{****************************************************************************
                          Tx86AppleGNUAssembler
 ****************************************************************************}

    constructor Tx86AppleGNUAssembler.CreateWithWriter(info: pasminfo; wr: TExternalAssemblerOutputFile; freewriter, smart: boolean);
      begin
        inherited;
        InstrWriter := Tx86InstrWriter.create(self);
        { Apple's assembler does not support a size suffix for popcount }
        Tx86InstrWriter(InstrWriter).fskipPopcountSuffix := true;
        { Apple's assembler is broken regarding some movq suffix handling }
        Tx86InstrWriter(InstrWriter).fNoInterUnitMovQ := true;
      end;

{****************************************************************************
                          Tx86AoutGNUAssembler
 ****************************************************************************}

    constructor Tx86AoutGNUAssembler.CreateWithWriter(info: pasminfo; wr: TExternalAssemblerOutputFile; freewriter, smart: boolean);
      begin
        inherited;
        InstrWriter := Tx86InstrWriter.create(self);
      end;

{****************************************************************************
                            Tx86InstrWriter
 ****************************************************************************}

    procedure Tx86InstrWriter.WriteReference(var ref : treference);
      begin
        with ref do
         begin
           { do we have a segment prefix ? }
           { These are probably not correctly handled under GAS }
           { should be replaced by coding the segment override  }
           { directly! - DJGPP FAQ                              }
           if segment<>NR_NO then
             owner.writer.AsmWrite(gas_regname(segment)+':');
           if assigned(symbol) then
             owner.writer.AsmWrite(symbol.name);
           if assigned(relsymbol) then
             owner.writer.AsmWrite('-'+relsymbol.name);
           case ref.refaddr of
             addr_pic:
               begin
                 { @GOT and @GOTPCREL references are only allowed for symbol alone,
                   indexing, relsymbol or offset cannot be present. }
                 if assigned(relsymbol) or (offset<>0) or (index<>NR_NO) then
                   InternalError(2015011801);
{$ifdef x86_64}
                 if (base<>NR_RIP) then
                   InternalError(2015011802);
                 owner.writer.AsmWrite('@GOTPCREL');
{$else x86_64}
                 owner.writer.AsmWrite('@GOT');
{$endif x86_64}
               end;
{$ifdef i386}
             addr_ntpoff:
               owner.writer.AsmWrite('@ntpoff');
             addr_tlsgd:
               owner.writer.AsmWrite('@tlsgd');
{$endif i386}
{$ifdef x86_64}
             addr_tpoff:
               owner.writer.AsmWrite('@tpoff');
             addr_tlsgd:
               owner.writer.AsmWrite('@tlsgd');
{$endif x86_64}
             else
               ;
           end;

           if offset<0 then
             owner.writer.AsmWrite(tostr(offset))
           else
            if (offset>0) then
             begin
               if assigned(symbol) then
                owner.writer.AsmWrite('+'+tostr(offset))
               else
                owner.writer.AsmWrite(tostr(offset));
             end
           else if (index=NR_NO) and (base=NR_NO) and (not assigned(symbol)) then
             owner.writer.AsmWrite('0');
           if (index<>NR_NO) and (base=NR_NO) then
            begin
              owner.writer.AsmWrite('(,'+gas_regname(index));
              if scalefactor<>0 then
                owner.writer.AsmWrite(','+tostr(scalefactor));
              owner.writer.AsmWrite(')');
            end
           else
            if (index=NR_NO) and (base<>NR_NO) then
              owner.writer.AsmWrite('('+gas_regname(base)+')')
            else
             if (index<>NR_NO) and (base<>NR_NO) then
              begin
                owner.writer.AsmWrite('('+gas_regname(base)+','+gas_regname(index));
                if scalefactor<>0 then
                 owner.writer.AsmWrite(','+tostr(scalefactor));
                owner.writer.AsmWrite(')');
              end;
         end;
      end;


    procedure Tx86InstrWriter.WriteOper(const o:toper);
      begin
        if o.vopext and OTVE_VECTOR_SAE = OTVE_VECTOR_SAE then
         owner.writer.AsmWrite('{sae},');

        if o.vopext and OTVE_VECTOR_ER_MASK = OTVE_VECTOR_RNSAE then
         owner.writer.AsmWrite('{rn-sae},');

        if o.vopext and OTVE_VECTOR_ER_MASK = OTVE_VECTOR_RDSAE then
         owner.writer.AsmWrite('{rd-sae},');

        if o.vopext and OTVE_VECTOR_ER_MASK = OTVE_VECTOR_RUSAE then
         owner.writer.AsmWrite('{ru-sae},');

        if o.vopext and OTVE_VECTOR_ER_MASK = OTVE_VECTOR_RZSAE then
         owner.writer.AsmWrite('{rz-sae},');

        case o.typ of
          top_reg :
            { Solaris assembler does not accept %st instead of %st(0) }
            if (owner.asminfo^.id=as_solaris_as) and (o.reg=NR_ST) then
              owner.writer.AsmWrite(gas_regname(NR_ST0))
            else
              owner.writer.AsmWrite(gas_regname(o.reg));
          top_ref :
            if o.ref^.refaddr in [addr_no,addr_pic,addr_pic_no_got
              {$ifdef i386},addr_ntpoff,addr_tlsgd{$endif i386}
              {$ifdef x86_64},addr_tpoff,addr_tlsgd{$endif x86_64}
              ] then
              WriteReference(o.ref^)
            else
              begin
                owner.writer.AsmWrite('$');
                if assigned(o.ref^.symbol) then
                 owner.writer.AsmWrite(o.ref^.symbol.name);
                if o.ref^.offset>0 then
                 owner.writer.AsmWrite('+'+tostr(o.ref^.offset))
                else
                 if o.ref^.offset<0 then
                  owner.writer.AsmWrite(tostr(o.ref^.offset))
                else
                 if not(assigned(o.ref^.symbol)) then
                   owner.writer.AsmWrite('0');
              end;
          top_const :
              owner.writer.AsmWrite('$'+tostr(o.val));
          else
            internalerror(10001);
        end;

           if o.vopext and OTVE_VECTOR_WRITEMASK = OTVE_VECTOR_WRITEMASK then
            begin
              owner.writer.AsmWrite('{%k' + tostr(o.vopext and $07) + '} ');
              if o.vopext and OTVE_VECTOR_ZERO = OTVE_VECTOR_ZERO then
               owner.writer.AsmWrite('{z}');
            end;


           if o.vopext and OTVE_VECTOR_BCST = OTVE_VECTOR_BCST then
            begin
              case o.vopext and (OTVE_VECTOR_BCST2 or OTVE_VECTOR_BCST4 or OTVE_VECTOR_BCST8 or OTVE_VECTOR_BCST16) of
                 OTVE_VECTOR_BCST2: owner.writer.AsmWrite('{1to2}');
                 OTVE_VECTOR_BCST4: owner.writer.AsmWrite('{1to4}');
                 OTVE_VECTOR_BCST8: owner.writer.AsmWrite('{1to8}');
                OTVE_VECTOR_BCST16: owner.writer.AsmWrite('{1to16}');
                               else ; //TG TODO errormsg
              end;
            end;

      end;


    procedure Tx86InstrWriter.WriteOper_jmp(const o:toper);
      begin
        case o.typ of
          top_reg :
            owner.writer.AsmWrite('*'+gas_regname(o.reg));
          top_ref :
            begin
              if o.ref^.refaddr in [addr_no,addr_pic_no_got] then
                begin
                  owner.writer.AsmWrite('*');
                  WriteReference(o.ref^);
                end
              else
                begin
                  owner.writer.AsmWrite(o.ref^.symbol.name);
                  if o.ref^.refaddr=addr_pic then
                    owner.writer.AsmWrite('@PLT');
                  if o.ref^.offset>0 then
                   owner.writer.AsmWrite('+'+tostr(o.ref^.offset))
                  else
                   if o.ref^.offset<0 then
                    owner.writer.AsmWrite(tostr(o.ref^.offset));
                end;
            end;
          top_const :
            owner.writer.AsmWrite(tostr(o.val));
          else
            internalerror(10001);
        end;
      end;


    procedure Tx86InstrWriter.WriteInstruction(hp: tai);
      var
       op       : tasmop;
       calljmp  : boolean;
       i        : integer;
      begin
        if hp.typ <> ait_instruction then
          exit;
        taicpu(hp).SetOperandOrder(op_att);
        op:=taicpu(hp).opcode;
        calljmp:=is_calljmp(op);

        { see fNoInterUnitMovQ declaration comment }
        if fNoInterUnitMovQ then
          begin
            if ((op=A_MOVQ) or
                (op=A_VMOVQ)) and
               (((taicpu(hp).oper[0]^.typ=top_reg) and
                 (getregtype(taicpu(hp).oper[0]^.reg)=R_INTREGISTER)) or
                ((taicpu(hp).oper[1]^.typ=top_reg) and
                 (getregtype(taicpu(hp).oper[1]^.reg)=R_INTREGISTER))) then
              begin
                if op=A_MOVQ then
                  op:=A_MOVD
                else
                  op:=A_VMOVD;
                taicpu(hp).opcode:=op;
              end;
          end;
        owner.writer.AsmWrite(#9);
        { movsd should not be translated to movsl when there
          are (xmm) arguments }
        if (op=A_MOVSD) and (taicpu(hp).ops>0) then
          owner.writer.AsmWrite('movsd')
        { the same applies to cmpsd as well }
        else if (op=A_CMPSD) and (taicpu(hp).ops>0) then
          owner.writer.AsmWrite('cmpsd')
        else
          owner.writer.AsmWrite(gas_op2str[op]);
        owner.writer.AsmWrite(cond2str[taicpu(hp).condition]);
        { suffix needed ?  fnstsw,fldcw don't support suffixes
          with binutils 2.9.5 under linux }
{        if (Taicpu(hp).oper[0]^.typ=top_reg) and
            (Taicpu(hp).oper[0]^.reg.enum>lastreg) then
          internalerror(200301081);}

        if (not calljmp) and
           (gas_needsuffix[op]<>AttSufNONE) and
           (op<>A_FNSTSW) and
           (op<>A_FSTSW) and
           (op<>A_FNSTCW) and
           (op<>A_FSTCW) and
           (op<>A_FLDCW) and
           (not fskipPopcountSuffix or
            (op<>A_POPCNT)) and
           ((owner.asminfo^.id<>as_solaris_as) or (op<>A_Jcc) and (op<>A_SETcc)) and
           not(
               (taicpu(hp).ops<>0) and
               (taicpu(hp).oper[0]^.typ=top_reg) and
               (getregtype(taicpu(hp).oper[0]^.reg)=R_FPUREGISTER)
              ) then
        begin
          owner.writer.AsmWrite(gas_opsize2str[taicpu(hp).opsize]);
        end;

        { process operands }
        if taicpu(hp).ops<>0 then
          begin
            if calljmp then
             begin
               owner.writer.AsmWrite(#9);
               WriteOper_jmp(taicpu(hp).oper[0]^);
             end
            else
             begin
               for i:=0 to taicpu(hp).ops-1 do
                 begin
                   if i=0 then
                     owner.writer.AsmWrite(#9)
                   else
                     owner.writer.AsmWrite(',');
                   WriteOper(taicpu(hp).oper[i]^);
                 end;
             end;
          end;
        owner.writer.AsmLn;
      end;


{*****************************************************************************
                                  Initialize
*****************************************************************************}

    const
{$ifdef x86_64}
       as_x86_64_as_info : tasminfo =
          (
            id     : as_gas;
            idtxt  : 'AS';
            asmbin : 'as';
            asmcmd : '--64 -o $OBJ $BIGOBJ $EXTRAOPT $ASM';
            supported_targets : [system_x86_64_linux,system_x86_64_freebsd,
                                 system_x86_64_win64,system_x86_64_embedded,
                                 system_x86_64_openbsd,system_x86_64_netbsd,
                                 system_x86_64_dragonfly,system_x86_64_aros,
                                 system_x86_64_android,system_x86_64_haiku];
            flags : [af_needar,af_smartlink_sections,af_supports_dwarf];
            labelprefix : '.L';
            labelmaxlen : -1;
            comment : '# ';
            dollarsign: '$';
          );

       as_x86_64_yasm_info : tasminfo =
          (
            id     : as_yasm;
            idtxt  : 'YASM';
            asmbin : 'yasm';
            asmcmd : '-a x86 -p gas -f $FORMAT -o $OBJ $EXTRAOPT $ASM';
            supported_targets : [system_x86_64_linux,system_x86_64_freebsd,system_x86_64_win64,system_x86_64_embedded];
            flags : [af_needar,af_smartlink_sections,af_supports_dwarf];
            labelprefix : '.L';
            labelmaxlen : -1;
            comment : '# ';
            dollarsign: '$';
          );

       as_x86_64_gas_info : tasminfo =
          (
            id     : as_ggas;
            idtxt  : 'GAS';
            asmbin : 'gas';
            asmcmd : '--64 -o $OBJ $EXTRAOPT $ASM';
            supported_targets : [system_x86_64_solaris];
            flags : [af_needar,af_smartlink_sections,af_supports_dwarf];
            labelprefix : '.L';
            labelmaxlen : -1;
            comment : '# ';
            dollarsign: '$';
          );


       as_x86_64_solaris_info : tasminfo =
          (
            id     : as_solaris_as;
            idtxt  : 'AS-SOL';
            asmbin : 'as';
            asmcmd : ' -m64 -o $OBJ $EXTRAOPT $ASM';
            supported_targets : [system_x86_64_solaris];
            flags : [af_needar,af_smartlink_sections,af_supports_dwarf];
            labelprefix : '.L';
            labelmaxlen : -1;
            comment : '# ';
            dollarsign: '$';
          );



       as_x86_64_gas_darwin_info : tasminfo =
          (
            id     : as_darwin;
            idtxt  : 'AS-DARWIN';
            asmbin : 'as';
            asmcmd : '-o $OBJ $EXTRAOPT $ASM -arch x86_64';
            supported_targets : [system_x86_64_darwin,system_x86_64_iphonesim];
            flags : [af_needar,af_smartlink_sections,af_supports_dwarf];
            labelprefix : 'L';
            labelmaxlen : -1;
            comment : '# ';
            dollarsign: '$';
          );

       as_x86_64_clang_darwin_info : tasminfo =
          (
            id     : as_clang;
            idtxt  : 'CLANG';
            asmbin : 'clang';
            asmcmd : '-c -o $OBJ $EXTRAOPT -arch x86_64 $DARWINVERSION -x assembler $ASM';
            supported_targets : [system_x86_64_darwin,system_x86_64_iphonesim];
            flags : [af_needar,af_smartlink_sections,af_supports_dwarf,af_no_stabs];
            labelprefix : 'L';
            labelmaxlen : -1;
            comment : '# ';
            dollarsign: '$';
          );

{$else x86_64}
       as_i386_as_info : tasminfo =
          (
            id     : as_gas;
            idtxt  : 'AS';
            asmbin : 'as';
            asmcmd : '--32 -o $OBJ $BIGOBJ $EXTRAOPT $ASM';
            supported_targets : [system_i386_GO32V2,system_i386_linux,system_i386_Win32,system_i386_freebsd,system_i386_solaris,system_i386_beos,
                                system_i386_netbsd,system_i386_Netware,system_i386_wdosx,system_i386_openbsd,
                                system_i386_netwlibc,system_i386_wince,system_i386_embedded,system_i386_symbian,system_i386_haiku,system_x86_6432_linux,
                                system_i386_nativent,system_i386_android,system_i386_aros];
            flags : [af_needar,af_smartlink_sections,af_supports_dwarf];
            labelprefix : '.L';
            labelmaxlen : -1;
            comment : '# ';
            dollarsign: '$';
          );

       as_i386_yasm_info : tasminfo =
          (
            id     : as_yasm;
            idtxt  : 'YASM';
            asmbin : 'yasm';
            asmcmd : '-a x86 -p gas -f $FORMAT -o $OBJ $EXTRAOPT $ASM';
            supported_targets : [system_i386_GO32V2,system_i386_linux,system_i386_Win32,system_i386_freebsd,system_i386_solaris,system_i386_beos,
                                system_i386_netbsd,system_i386_Netware,system_i386_wdosx,system_i386_openbsd,
                                system_i386_netwlibc,system_i386_wince,system_i386_embedded,system_i386_symbian,system_i386_haiku,system_x86_6432_linux,
                                system_i386_nativent];
            flags : [af_needar,af_smartlink_sections,af_supports_dwarf];
            labelprefix : '.L';
            labelmaxlen : -1;
            comment : '# ';
            dollarsign: '$';
          );


       as_i386_as_aout_info : tasminfo =
          (
            id           : as_i386_as_aout;
            idtxt  : 'AS_AOUT';
            asmbin : 'as';
            asmcmd : '-o $OBJ $EXTRAOPT $ASM';
            supported_targets : [system_i386_linux,system_i386_OS2,system_i386_freebsd,system_i386_netbsd,system_i386_openbsd,system_i386_EMX,system_i386_embedded];
            flags : [af_needar,af_stabs_use_function_absolute_addresses];
            labelprefix : 'L';
            labelmaxlen : -1;
            comment : '# ';
            dollarsign: '$';
          );


       as_i386_gas_darwin_info : tasminfo =
          (
            id     : as_darwin;
            idtxt  : 'AS-DARWIN';
            asmbin : 'as';
            asmcmd : '-o $OBJ $EXTRAOPT $ASM -arch i386';
            supported_targets : [system_i386_darwin,system_i386_iphonesim];
            flags : [af_needar,af_smartlink_sections,af_supports_dwarf,af_stabs_use_function_absolute_addresses];
            labelprefix : 'L';
            labelmaxlen : -1;
            comment : '# ';
            dollarsign: '$';
          );

       as_i386_clang_darwin_info : tasminfo =
          (
            id     : as_clang;
            idtxt  : 'CLANG';
            asmbin : 'clang';
            asmcmd : '-c -o $OBJ $EXTRAOPT -arch i386 $DARWINVERSION -x assembler $ASM';
            supported_targets : [system_i386_darwin,system_i386_iphonesim];
            flags : [af_needar,af_smartlink_sections,af_supports_dwarf,af_no_stabs];
            labelprefix : 'L';
            labelmaxlen : -1;
            comment : '# ';
            dollarsign: '$';
          );

       as_i386_gas_info : tasminfo =
          (
            id     : as_ggas;
            idtxt  : 'GAS';
            asmbin : 'gas';
            asmcmd : '--32 -o $OBJ $EXTRAOPT $ASM';
            supported_targets : [system_i386_GO32V2,system_i386_linux,system_i386_Win32,system_i386_freebsd,system_i386_solaris,system_i386_beos,
                                system_i386_netbsd,system_i386_Netware,system_i386_wdosx,system_i386_openbsd,
                                system_i386_netwlibc,system_i386_wince,system_i386_embedded,system_i386_symbian,system_i386_haiku,
                                system_x86_6432_linux,system_i386_android];
            flags : [af_needar,af_smartlink_sections,af_supports_dwarf];
            labelprefix : '.L';
            labelmaxlen : -1;
            comment : '# ';
            dollarsign: '$';
          );

       as_i386_solaris_info : tasminfo =
          (
            id     : as_solaris_as;
            idtxt  : 'AS-SOL';
            asmbin : 'as';
            asmcmd : ' -o $OBJ $EXTRAOPT $ASM';
            supported_targets : [system_i386_solaris];
            flags : [af_needar,af_smartlink_sections,af_supports_dwarf];
            labelprefix : '.L';
            labelmaxlen : -1;
            comment : '# ';
            dollarsign: '$';
          );


{$endif x86_64}

initialization
{$ifdef x86_64}
  RegisterAssembler(as_x86_64_as_info,Tx86ATTAssembler);
  RegisterAssembler(as_x86_64_yasm_info,Tx86ATTAssembler);
  RegisterAssembler(as_x86_64_gas_info,Tx86ATTAssembler);
  RegisterAssembler(as_x86_64_gas_darwin_info,Tx86AppleGNUAssembler);
  RegisterAssembler(as_x86_64_clang_darwin_info,Tx86AppleGNUAssembler);
  RegisterAssembler(as_x86_64_solaris_info,Tx86ATTAssembler);
{$else x86_64}
  RegisterAssembler(as_i386_as_info,Tx86ATTAssembler);
  RegisterAssembler(as_i386_gas_info,Tx86ATTAssembler);
  RegisterAssembler(as_i386_yasm_info,Tx86ATTAssembler);
  RegisterAssembler(as_i386_gas_darwin_info,Tx86AppleGNUAssembler);
  RegisterAssembler(as_i386_clang_darwin_info,Tx86AppleGNUAssembler);
  RegisterAssembler(as_i386_as_aout_info,Tx86AoutGNUAssembler);
  RegisterAssembler(as_i386_solaris_info,Tx86ATTAssembler);
{$endif x86_64}
end.