Quick Search:

Mode

Context

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

Other Diffs

Ignore

Blank Lines Whitespace: Expand:

Diff

1.21
 
1.22
 
MAIN:ragge:20101016123806
 
local.c
_>7171 {
 7272         struct symtab *sp = IALLOC(sizeof(struct symtab));
 7373         size_t len = strlen(p) + strlen(s) + strlen(s2) + 1;
<>74 -        
  74+
7575         sp->sname = sp->soname = IALLOC(len);
 7676         strlcpy(sp->soname, p, len);
 7777         strlcat(sp->soname, s, len);
     
 !
8383 
 8484 int gotnr; /* tempnum for GOT register */
 8585 int argstacksize;
<> 86+static int ininval;
8687 
 8788 /*
<>88 - * Create a reference for an extern variable.
  89+ * Create a reference for an extern variable or function.
8990  */
 9091 static NODE *
 9192 picext(NODE *p)
 9293 {
 9394         NODE *q;
 9495         struct symtab *sp;
<>95 -        char *c;
  96+        char *c, *g;
9697 
<> 98+        if (p->n_sp->sflags & SBEENHERE)
  99+                return p;
  100+
97101         c = p->n_sp->soname ? p->n_sp->soname : p->n_sp->sname;
<>98 -        sp = picsymtab("", c, "@GOTPCREL(%rip)");
  102+#ifdef notdef
  103+        g = ISFTN(p->n_sp->stype) ? "@PLT" : "@GOTPCREL";
  104+#endif
  105+        g = "@GOTPCREL";
  106+        sp = picsymtab("", c, g);
  107+        sp->sflags = SBEENHERE;
99108         q = block(NAME, NIL, NIL, INCREF(p->n_type), p->n_df, p->n_ap);
 100109         q->n_sp = sp;
 101110         q = block(UMUL, q, 0, p->n_type, p->n_df, p->n_ap);
     
 !
117126                 snprintf(c = buf, 32, LABFMT, (int)p->n_sp->soffset);
 118127         else
 119128                 c = p->n_sp->soname ? p->n_sp->soname : p->n_sp->sname;
<>120 -        sp = picsymtab("", c, "(%rip)");
  129+        sp = picsymtab("", c, "");
121130         sp->sclass = STATIC;
 122131         sp->stype = p->n_sp->stype;
 123132         p->n_sp = sp;
     
 !
257266                                 break;
 258267                         }
 259268 #endif
<> 269+#ifdef notdef
260270                         if (kflag == 0) {
 261271                                 if (q->slevel == 0)
 262272                                         break;
 263273                                 p->n_lval = 0;
<>264 -                        } else if (blevel > 0)
 265 -                                p = picstatic(p);
  274+                        } else if (blevel > 0) {
  275+                                if (!ISFTN(q->stype))
  276+                                        p = picstatic(p);
  277+                        }
  278+#endif
266279                         break;
 267280 
 268281                 case REGISTER:
     
 !
373386                 if (l->n_op == ADDROF && l->n_left->n_op == TEMP)
 374387                         break;
 375388 
<> 389+#ifdef notdef
376390                 /* if conversion to another pointer type, just remove */
<> 391+                /* XXX breaks ADDROF NAME */
377392                 if (p->n_type > BTMASK && l->n_type > BTMASK)
 378393                         goto delp;
<> 394+#endif
379395                 break;
 380396 
 381397         delp:   l->n_type = p->n_type;
     
 !
547563                 p->n_right = block(SCONV, p->n_right, NIL,
 548564                     CHAR, 0, MKAP(CHAR));
 549565                 break;
<>550 -
551566         }
 552567 #ifdef PCC_DEBUG
 553568         if (xdebug) {
     
 !
558573         return(p);
 559574 }
 560575 
<>561 -/*
 562 - * Change CALL references to either direct (static) or PLT.
 563 - */
 564 -static void
 565 -fixnames(NODE *p, void *arg)
 566 -{
 567 -        struct symtab *sp;
 568 -        NODE *q;
 569 -        char *c;
 570 -
 571 -        if ((cdope(p->n_op) & CALLFLG) == 0)
 572 -                return;
 573 -        if (p->n_left->n_op != UMUL || p->n_left->n_left->n_op != NAME)
 574 -                return;
 575 -        q = p->n_left->n_left;
 576 -
 577 -
 578 -        sp = q->n_sp;
 579 -
 580 -        if (sp == NULL)
 581 -                return/* nothing to do */
 582 -        if (sp->sclass == STATIC && !ISFTN(sp->stype))
 583 -                return; /* function pointer */
 584 -
 585 -        if (sp->sclass != STATIC && sp->sclass != EXTERN &&
 586 -            sp->sclass != EXTDEF)
 587 -                cerror("fixnames");
 588 -
 589 -        if ((c = strstr(sp->soname, "@GOT")) == NULL)
 590 -                cerror("fixnames2");
 591 -        if (sp->sclass == STATIC) {
 592 -                *c = 0;
 593 -        } else
 594 -                memcpy(c, "@PLT", sizeof("@PLT"));
 595 -
 596 -        
 597 -        *p->n_left = *q;
 598 -        p->n_left->n_op = ICON;
 599 -        nfree(q);
 600 -}
 601 -
602576 void
 603577 myp2tree(NODE *p)
 604578 {
 605579         struct symtab *sp;
 606580 
<>607 -        if (kflag)
 608 -                walkf(p, fixnames, 0); /* XXX walkf not needed */
609581         if (p->n_op != FCON)
 610582                 return;
 611583 
<>612 -#if 0
 613 -        /* put floating constants in memory */
 614 -        setloc1(RDATA);
 615 -        defalign(ALLDOUBLE);
 616 -        deflab1(i = getlab());
 617 -        ninval(0, btdims[p->n_type].suesize, p);
 618 -#endif
 619 -
  584+        /* XXX should let float constants follow */
620585         sp = IALLOC(sizeof(struct symtab));
 621586         sp->sclass = STATIC;
 622587         sp->sap = MKAP(p->n_type);
     
 !
634599         p->n_sp = sp;
 635600 }
 636601 
<>637 -/*ARGSUSED*/
  602+/*
  603+ * Convert ADDROF NAME to ICON?
  604+ */
638605 int
 639606 andable(NODE *p)
 640607 {
<>641 -        return(1);      /* all names can have & taken on them */
  608+        if (ininval)
  609+                return 1;
  610+        if (p->n_sp->sclass == STATIC || p->n_sp->sclass == USTATIC)
  611+                return 0;
  612+        return 1;
642613 }
 643614 
 644615 /*
     
 !
700671         p = buildtree(AND, p, xbcon(-16, NULL, LONG));
 701672 
 702673         /* sub the size from sp */
<>703 -        sp = block(REG, NIL, NIL, p->n_type, 0, MKAP(INT));
  674+        sp = block(REG, NIL, NIL, p->n_type, 0, MKAP(LONG));
704675         sp->n_lval = 0;
 705676         sp->n_rval = STKREG;
 706677         ecomp(buildtree(MINUSEQ, sp, p));
 707678 
 708679         /* save the address of sp */
<>709 -        sp = block(REG, NIL, NIL, PTR+INT, t->n_df, t->n_ap);
  680+        sp = block(REG, NIL, NIL, PTR+LONG, t->n_df, t->n_ap);
710681         sp->n_lval = 0;
 711682         sp->n_rval = STKREG;
 712683         t->n_type = sp->n_type;
     
 !
809780 {
 810781         union { float f; double d; long double l; int i[3]; } u;
 811782         struct symtab *q;
<>812 -        char *c;
813783         TWORD t;
<> 784+        int rel = 0;
814785 
<> 786+        if (coptype(p->n_op) != LTYPE) {
  787+                ininval = 1;
  788+                p = optim(ccopy(p));
  789+                ininval = 0;
  790+                rel = 1;
  791+        }
  792+
815793         t = p->n_type;
 816794         if (t > BTMASK)
 817795                 t = LONG; /* pointer */
 818796 
<>819 -        while (p->n_op == SCONV || p->n_op == PCONV) {
 820 -                NODE *l = p->n_left;
 821 -                l->n_type = p->n_type;
 822 -                p = l;
 823 -        }
 824 -
 825 -        if (kflag && (p->n_op == PLUS || p->n_op == UMUL)) {
 826 -                if (p->n_op == UMUL)
 827 -                        p = p->n_left;
 828 -                p = p->n_right;
 829 -                q = p->n_sp;
 830 -
 831 -                if ((c = strstr(q->soname, "@GOT")) != NULL)
 832 -                        *c = 0; /* ignore GOT ref here */
 833 -        }
834797         if (p->n_op != ICON && p->n_op != FCON)
 835798                 cerror("ninval: init node not constant");
 836799 
     
 !
894857         default:
 895858                 cerror("ninval");
 896859         }
<> 860+        if (rel)
  861+                tfree(p);
897862 }
 898863 
 899864 /* make a name look like an external name in the local machine */
     
 !
1031996 fixdef(struct symtab *sp)
 1032997 {
 1033998         struct attr *ga;
<> 999+
<_10341000 #ifdef TLS
 10351001         /* may have sanity checks here */
 10361002         if (gottls)
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-09-30 12:11 +0200