Quick Search:

Mode

Context

Displaying 3 lines of context. None | Less | More | Full

Other Diffs

Ignore

Blank Lines Whitespace: Expand:

Diff

1.20
 
1.21
 
MAIN:ragge:20110728141207
 
code.c
_>3636 #include "pass1.h"
 3737 
 3838 /*
<> 39+ * Print out assembler segment name.
  40+ */
  41+void
  42+setseg(int seg, char *name)
  43+{
  44+        switch (seg) {
  45+        case PROG: name = ".text"; break;
  46+        case DATA:
  47+        case LDATA: name = ".data"; break;
  48+        case STRNG:
  49+        case RDATA: name = ".section .rodata"; break;
  50+        case UDATA: break;
  51+        case PICLDATA:
  52+        case PICDATA: name = ".section .data.rel.rw,\"aw\",@progbits"; break;
  53+        case PICRDATA: name = ".section .data.rel.ro,\"aw\",@progbits"; break;
  54+        case TLSDATA: name = ".section .tdata,\"awT\",@progbits"; break;
  55+        case TLSUDATA: name = ".section .tbss,\"awT\",@nobits"; break;
  56+        case CTORS: name = ".section\t.ctors,\"aw\",@progbits"; break;
  57+        case DTORS: name = ".section\t.dtors,\"aw\",@progbits"; break;
  58+        case NMSEG:
  59+                printf("\t.section %s,\"aw\",@progbits\n", name);
  60+                return;
  61+        }
  62+        printf("\t%s\n", name);
  63+}
  64+
  65+/*
3966  * Define everything needed to print out some data (or text).
 4067  * This means segment, alignment, visibility, etc.
 4168  */
 4269 void
 4370 defloc(struct symtab *sp)
 4471 {
<>45 -        static char *loctbl[] = { "text", "data", "section .rodata" };
 46 -        static int lastloc = -1;
 47 -        TWORD t;
4872         char *n;
<>49 -        int s;
5073 
<>51 -        if (sp == NULL) {
 52 -                lastloc = -1;
 53 -                return;
 54 -        }
 55 -        t = sp->stype;
 56 -        s = ISFTN(t) ? PROG : ISCON(cqual(t, sp->squal)) ? RDATA : DATA;
 57 -        lastloc = s;
 58 -        if (s == PROG)
 59 -                return; /* text is written in prologue() */
 60 -        if (s != lastloc)
 61 -                printf("        .%s\n", loctbl[s]);
 62 -        printf("        .p2align %d\n", ispow2(talign(t, sp->sap)));
 63 -        n = sp->soname ? sp->soname : sp->sname;
  74+        if (ISFTN(sp->stype))
  75+                return; /* XXX until fixed */
  76+
  77+        if ((n = sp->soname) == NULL)
  78+                n = exname(sp->sname);
  79+
6480         if (sp->sclass == EXTDEF)
 6581                 printf("        .globl %s\n", n);
 6682         if (sp->slevel == 0) {
 6783 #ifdef USE_GAS
<>68 -                printf("\t.type %s,@object\n", n);
 69 -                printf("\t.size %s," CONFMT "\n", n,
 70 -                    tsize(sp->stype, sp->sdf, sp->sap));
  84+                printf("\t.type %s,@%s\n", n,
  85+                    ISFTN(sp->stype) ? "function" : "object");
  86+                if (!ISFTN(sp->stype))
  87+                        printf("\t.size %s," CONFMT "\n", n,
  88+                            tsize(sp->stype, sp->sdf, sp->sap));
7189 #endif
 7290                 printf("%s:\n", n);
 7391         } else
 7492                 printf(LABFMT ":\n", sp->soffset);
 7593 }
 7694 
 7795 
<>78 -#ifdef notdef
7996 /*
 8097  * cause the alignment to become a multiple of n
<>81 - * never called for text segment.
8298  */
 8399 void
 84100 defalign(int n)
     
 !
89105         printf("\t.p2align %d\n", n);
 90106 }
 91107 
<>92 -/*
 93 - * define the current location as the name p->sname
 94 - * never called for text segment.
 95 - */
 96 -void
 97 -defnam(struct symtab *p)
 98 -{
 99 -        char *c = p->soname;
 100 -
 101 -        if (p->sclass == EXTDEF)
 102 -                printf("\t.globl %s\n", c);
 103 -#ifdef USE_GAS
 104 -        printf("\t.type %s,@object\n", c);
 105 -        printf("\t.size %s," CONFMT "\n", c, tsize(p->stype, p->sdf, p->sap));
 106 -#endif
 107 -        printf("%s:\n", c);
 108 -}
 109 -#endif
 110 -
<_111108 static int rvnr;
 112109 
 113110 /*
FishEye: Open Source License registered to PCC.
Atlassian FishEye, CVS analysis. (Version:1.6.3 Build:build-336 2008-11-04) - Administration - Page generated 2014-12-25 11:02 +0100