Quick Search:

Mode

Context

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

Other Diffs

Ignore

Blank Lines Whitespace: Expand:

Diff

1.57
 
1.58
 
MAIN:ragge:20110623133823
 
code.c
_>6767 static NODE *movtoreg(NODE *p, int rno);
 6868 void varattrib(char *name, struct attr *sap);
 6969 
<>70 -static char *sectail;
  70+/*
  71+ * Print out assembler segment name.
  72+ */
  73+void
  74+setseg(int seg, char *name)
  75+{
  76+        switch (seg) {
  77+        case PROG: name = ".text"; break;
  78+        case DATA:
  79+        case LDATA: name = ".data"; break;
  80+        case STRNG:
  81+        case RDATA: name = ".section .rodata"; break;
  82+        case UDATA: break;
  83+#ifdef MACHOABI
  84+        case PICLDATA:
  85+        case PICDATA: name = ".section .data.rel.rw,\"aw\""; break;
  86+        case PICRDATA: name = ".section .data.rel.ro,\"aw\""; break;
  87+#else
  88+        case PICLDATA:
  89+        case PICDATA: name = ".section .data.rel.rw,\"aw\",@progbits"; break;
  90+        case PICRDATA: name = ".section .data.rel.ro,\"aw\",@progbits"; break;
  91+#endif
  92+        case TLSDATA: name = ".section .tdata,\"awT\",@progbits"; break;
  93+        case TLSUDATA: name = ".section .tbss,\"awT\",@nobits"; break;
  94+        case CTORS: name = ".section\t.ctors,\"aw\",@progbits"; break;
  95+        case DTORS: name = ".section\t.dtors,\"aw\",@progbits"; break;
  96+        case NMSEG:
  97+                printf("\t.section %s,\"aw\",@progbits\n", name);
  98+                return;
  99+        }
  100+        printf("\t%s\n", name);
  101+}
71102 
 72103 /*
 73104  * Define everything needed to print out some data (or text).
     
 !
76107 void
 77108 defloc(struct symtab *sp)
 78109 {
<>79 -        extern char *nextsect;
 80 -        static char *loctbl[] = { "text", "data", "section .rodata" };
 81 -        extern int tbss;
82110         char *name;
<>83 -        TWORD t;
 84 -        int s;
85111 
<>86 -        if (sp == NULL) {
 87 -                lastloc = -1;
 88 -                return;
 89 -        }
 90 -        if (kflag) {
 91 -#ifdef MACHOABI
 92 -                loctbl[DATA] = "section .data.rel.rw,\"aw\"";
 93 -                loctbl[RDATA] = "section .data.rel.ro,\"aw\"";
 94 -#else
 95 -                loctbl[DATA] = "section .data.rel.rw,\"aw\",@progbits";
 96 -                loctbl[RDATA] = "section .data.rel.ro,\"aw\",@progbits";
 97 -#endif
 98 -        }
 99 -        t = sp->stype;
 100 -        s = ISFTN(t) ? PROG : ISCON(cqual(t, sp->squal)) ? RDATA : DATA;
101112         if ((name = sp->soname) == NULL)
 102113                 name = exname(sp->sname);
 103114 
<>104 -        if (sp->sflags & STLS) {
 105 -                if (s != DATA)
 106 -                        cerror("non-data symbol in tls section");
 107 -                if (tbss)
 108 -                        nextsect = ".tbss,\"awT\",@nobits";
 109 -                else
 110 -                        nextsect = ".tdata,\"awT\",@progbits";
 111 -                tbss = 0;
 112 -                lastloc = -1;
 113 -        }
 114 -
 115 -        varattrib(name, sp->sap);
 116 -
 117 -        if (nextsect) {
 118 -                if (sectail == NULL)
 119 -                        sectail = "";
 120 -                printf("        .section %s%s\n", nextsect, sectail);
 121 -                sectail = nextsect = NULL;
 122 -                s = -1;
 123 -        } else if (s != lastloc)
 124 -                printf("        .%s\n", loctbl[s]);
 125 -        lastloc = s;
 126 -        while (ISARY(t))
 127 -                t = DECREF(t);
 128 -        s = ISFTN(t) ? ALINT : talign(t, sp->sap);
 129 -        if (s > ALCHAR)
 130 -                printf("        .align %d\n", s/ALCHAR);
131115         if (sp->sclass == EXTDEF) {
 132116                 printf("\t.globl %s\n", name);
 133117 #ifndef MACHOABI
 134118                 printf("\t.type %s,@%s\n", name,
<>135 -                    ISFTN(t)? "function" : "object");
  119+                    ISFTN(sp->stype)? "function" : "object");
136120 #endif
 137121         }
 138122         if (sp->slevel == 0)
     
 !
142126 }
 143127 
 144128 /*
<>145 - * Print out variable attributes.
 146 - */
 147 -void
 148 -varattrib(char *name, struct attr *sap)
 149 -{
 150 -        extern char *nextsect;
 151 -        struct attr *ga;
 152 -
 153 -        if ((ga = attr_find(sap, GCC_ATYP_SECTION)) != NULL) {
 154 -                nextsect = ga->sarg(0);
 155 -                sectail = ",\"aw\",@progbits";
 156 -        }
 157 -        if ((ga = attr_find(sap, GCC_ATYP_WEAK)) != NULL)
 158 -                printf("        .weak %s\n", name);
 159 -        if (attr_find(sap, GCC_ATYP_DESTRUCTOR)) {
 160 -                printf("\t.section\t.dtors,\"aw\",@progbits\n");
 161 -                printf("\t.align 8\n\t.quad\t%s\n", name);
 162 -                lastloc = -1;
 163 -        }
 164 -        if (attr_find(sap, GCC_ATYP_CONSTRUCTOR)) {
 165 -                printf("\t.section\t.ctors,\"aw\",@progbits\n");
 166 -                printf("\t.align 8\n\t.quad\t%s\n", name);
 167 -                lastloc = -1;
 168 -        }
 169 -        if ((ga = attr_find(sap, GCC_ATYP_VISIBILITY)) &&
 170 -            strcmp(ga->sarg(0), "default"))
 171 -                printf("\t.%s %s\n", ga->sarg(0), name);
 172 -        if ((ga = attr_find(sap, GCC_ATYP_ALIASWEAK))) {
 173 -                printf("        .weak %s\n", ga->sarg(0));
 174 -                printf("        .set %s,%s\n", ga->sarg(0), name);
 175 -        }
 176 -}
 177 -
 178 -/*
<_179129  * code for the end of a function
 180130  * deals with struct return here
 181131  * The return value is in (or pointed to by) RETREG.
FishEye: Open Source License registered to PCC.
Your maintenance has expired. You can renew your license at http://www.atlassian.com/fisheye/renew
Atlassian FishEye, CVS analysis. (Version:1.6.3 Build:build-336 2008-11-04) - Administration - Page generated 2014-10-01 02:02 +0200