Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/bsd/pcc/dist/pcc fix merge conflicts for pcc-20140706



details:   https://anonhg.NetBSD.org/src/rev/f48470144f26
branches:  trunk
changeset: 797628:f48470144f26
user:      plunky <plunky%NetBSD.org@localhost>
date:      Thu Jul 24 20:12:50 2014 +0000

description:
fix merge conflicts for pcc-20140706

diffstat:

 external/bsd/pcc/dist/pcc/arch/amd64/local.c   |  125 ++--
 external/bsd/pcc/dist/pcc/arch/amd64/local2.c  |   74 ++-
 external/bsd/pcc/dist/pcc/cc/cc/cc.1           |   58 +-
 external/bsd/pcc/dist/pcc/cc/ccom/ccom.1       |   16 +-
 external/bsd/pcc/dist/pcc/cc/ccom/gcc_compat.c |  569 +++++++++++++++++-
 external/bsd/pcc/dist/pcc/cc/ccom/main.c       |   20 +-
 external/bsd/pcc/dist/pcc/cc/ccom/pass1.h      |   68 +-
 external/bsd/pcc/dist/pcc/cc/ccom/pftn.c       |  742 ++++++++++++++----------
 external/bsd/pcc/dist/pcc/cc/ccom/scan.l       |  212 +++---
 external/bsd/pcc/dist/pcc/cc/ccom/trees.c      |  289 +++++----
 external/bsd/pcc/dist/pcc/cc/cpp/cpp.1         |   20 +-
 external/bsd/pcc/dist/pcc/cc/cpp/cpp.c         |  598 +++++++++++++------
 external/bsd/pcc/dist/pcc/configure.ac         |  169 +++-
 external/bsd/pcc/dist/pcc/mip/common.c         |  204 ++++--
 external/bsd/pcc/dist/pcc/mip/optim2.c         |  191 ++++--
 15 files changed, 2251 insertions(+), 1104 deletions(-)

diffs (truncated from 6240 to 300 lines):

diff -r 5e2a3005608f -r f48470144f26 external/bsd/pcc/dist/pcc/arch/amd64/local.c
--- a/external/bsd/pcc/dist/pcc/arch/amd64/local.c      Thu Jul 24 19:47:15 2014 +0000
+++ b/external/bsd/pcc/dist/pcc/arch/amd64/local.c      Thu Jul 24 20:12:50 2014 +0000
@@ -1,5 +1,5 @@
-/*     Id: local.c,v 1.66 2012/03/23 17:03:09 ragge Exp        */      
-/*     $NetBSD: local.c,v 1.2 2012/12/31 18:47:41 christos Exp $       */
+/*     Id: local.c,v 1.80 2014/07/03 14:25:51 ragge Exp        */      
+/*     $NetBSD: local.c,v 1.3 2014/07/24 20:12:50 plunky Exp $ */
 /*
  * Copyright (c) 2008 Michael Shalayeff
  * Copyright (c) 2003 Anders Magnusson (ragge%ludd.luth.se@localhost).
@@ -93,12 +93,16 @@
 {
 #if defined(ELFABI)
 
+       struct attr *ga;
        NODE *q;
        struct symtab *sp;
        char *c;
 
        if (p->n_sp->sflags & SBEENHERE)
                return p;
+       if ((ga = attr_find(p->n_sp->sap, GCC_ATYP_VISIBILITY)) &&
+           strcmp(ga->sarg(0), "hidden") == 0)
+               return p; /* no GOT reference */
 
        c = p->n_sp->soname ? p->n_sp->soname : exname(p->n_sp->sname);
        sp = picsymtab("", c, "@GOTPCREL");
@@ -386,6 +390,9 @@
                if (o == ICON) {
                        CONSZ val = l->n_lval;
 
+                       if (ISPTR(l->n_type) && !nncon(l))
+                               break; /* cannot convert named pointers */
+
                        if (!ISPTR(m)) /* Pointers don't need to be conv'd */
                            switch (m) {
                        case BOOL:
@@ -502,6 +509,12 @@
 {
        struct symtab *sp, sps;
        static int dblxor, fltxor;
+       int codeatyp(NODE *);
+
+       if (p->n_op == STCALL || p->n_op == USTCALL) {
+               /* save struct encoding */
+               p->n_su = codeatyp(p);
+       }
 
        if (p->n_op == UMINUS && (p->n_type == FLOAT || p->n_type == DOUBLE)) {
                /* Store xor code for sign change */
@@ -530,7 +543,7 @@
 
                sp = p->n_left->n_sp;
                if ((s = strstr(sp->sname, "@GOTPCREL")) != NULL) {
-                       strcpy(s, "@PLT");
+                       memcpy(s, "@PLT", sizeof("@PLT"));
                        p->n_left->n_op = ICON;
                }
                return;
@@ -578,8 +591,11 @@
 int
 andable(NODE *p)
 {
+#ifdef notdef
+       /* shared libraries cannot have direct referenced static syms */
        if (p->n_sp->sclass == STATIC || p->n_sp->sclass == USTATIC)
                return 1;
+#endif
        return !kflag;
 }
 
@@ -731,6 +747,19 @@
        off /= SZCHAR;
        al = talign(sp->stype, sp->sap)/SZCHAR;
 
+#ifdef MACHOABI
+       if (sp->sclass == STATIC) {
+               al = ispow2(al);
+               printf("\t.zerofill __DATA,__bss,");
+               if (sp->slevel == 0) {
+                       printf("%s", name);
+               } else
+                       printf(LABFMT, sp->soffset);
+               printf(",%d,%d\n", off, al);
+       } else {
+               printf("\t.comm %s,0%o,%d\n", name, off, al);
+       }
+#else
        if (sp->sclass == STATIC) {
                if (sp->slevel == 0) {
                        printf("\t.local %s\n", name);
@@ -741,20 +770,21 @@
                printf("\t.comm %s,0%o,%d\n", name, off, al);
        } else
                printf("\t.comm " LABFMT ",0%o,%d\n", sp->soffset, off, al);
+#endif
 }
 
 static char *
-section2string(char *name, int len)
+section2string(char *name)
 {
-       char *s;
-       int n;
+       int len = strlen(name);
 
        if (strncmp(name, "link_set", 8) == 0) {
-               const char *postfix = ",\"aw\",@progbits";
-               n = len + strlen(postfix) + 1;
-               s = IALLOC(n);
-               strlcpy(s, name, n);
-               strlcat(s, postfix, n);
+               const char postfix[] = ",\"aw\",@progbits";
+               char *s;
+
+               s = IALLOC(len + sizeof(postfix));
+               memcpy(s, name, len);
+               memcpy(s + len, postfix, sizeof(postfix));
                return s;
        }
 
@@ -788,7 +818,7 @@
                return 1;
        }
        if (strcmp(str, "section") == 0 && a2 != NULL) {
-               nextsect = section2string(a2, strlen(a2));
+               nextsect = section2string(a2);
                return 1;
        }
        if (strcmp(str, "alias") == 0 && a2 != NULL) {
@@ -814,12 +844,12 @@
 
 #ifdef HAVE_WEAKREF
        /* not many as'es have this directive */
-       if ((ga = gcc_get_attr(sp->sap, GCC_ATYP_WEAKREF)) != NULL) {
-               char *wr = ga->a1.sarg;
+       if ((ga = attr_find(sp->sap, GCC_ATYP_WEAKREF)) != NULL) {
+               char *wr = ga->sarg(0);
                char *sn = sp->soname ? sp->soname : sp->sname;
                if (wr == NULL) {
-                       if ((ga = gcc_get_attr(sp->sap, GCC_ATYP_ALIAS))) {
-                               wr = ga->a1.sarg;
+                       if ((ga = attr_find(sp->sap, GCC_ATYP_ALIAS))) {
+                               wr = ga->sarg(0);
                        }
                }
                if (wr == NULL)
@@ -854,60 +884,25 @@
        }
 }
 
-NODE *
-i386_builtin_return_address(NODE *f, NODE *a, TWORD t)
+/*
+ * find struct return functions and set correct return regs if needed.
+ * this is saved in the su field earlier.
+ * uses the stalign field which is otherwise unused.
+ */
+static void
+fixstcall(NODE *p, void *arg)
 {
-       int nframes;
-
-       if (a == NULL || a->n_op != ICON)
-               goto bad;
-
-       nframes = a->n_lval;
-
-       tfree(f);
-       tfree(a);
-
-       f = block(REG, NIL, NIL, PTR+VOID, 0, 0);
-       regno(f) = FPREG;
-
-       while (nframes--)
-               f = block(UMUL, f, NIL, PTR+VOID, 0, 0);
-
-       f = block(PLUS, f, bcon(4), INCREF(PTR+VOID), 0, 0);
-       f = buildtree(UMUL, f, NIL);
 
-       return f;
-bad:
-        uerror("bad argument to __builtin_return_address");
-        return bcon(0);
-}
-
-NODE *
-i386_builtin_frame_address(NODE *f, NODE *a, TWORD t)
-{
-       int nframes;
-
-       if (a == NULL || a->n_op != ICON)
-               goto bad;
-
-       nframes = a->n_lval;
-
-       tfree(f);
-       tfree(a);
-
-       f = block(REG, NIL, NIL, PTR+VOID, 0, 0);
-       regno(f) = FPREG;
-
-       while (nframes--)
-               f = block(UMUL, f, NIL, PTR+VOID, 0, 0);
-
-       return f;
-bad:
-        uerror("bad argument to __builtin_frame_address");
-        return bcon(0);
+        if (p->n_op != STCALL && p->n_op != USTCALL)
+                return;
+       p->n_stalign = p->n_su;
 }
 
 void
 pass1_lastchance(struct interpass *ip)
 {
+        if (ip->type != IP_NODE)
+                return;
+        walkf(ip->ip_node, fixstcall, 0);
 }
+
diff -r 5e2a3005608f -r f48470144f26 external/bsd/pcc/dist/pcc/arch/amd64/local2.c
--- a/external/bsd/pcc/dist/pcc/arch/amd64/local2.c     Thu Jul 24 19:47:15 2014 +0000
+++ b/external/bsd/pcc/dist/pcc/arch/amd64/local2.c     Thu Jul 24 20:12:50 2014 +0000
@@ -1,5 +1,5 @@
-/*     Id: local2.c,v 1.49 2011/09/21 21:23:09 plunky Exp      */      
-/*     $NetBSD: local2.c,v 1.2 2014/03/14 00:06:52 christos Exp $      */
+/*     Id: local2.c,v 1.54 2014/07/02 08:59:40 ragge Exp       */      
+/*     $NetBSD: local2.c,v 1.3 2014/07/24 20:12:50 plunky Exp $        */
 /*
  * Copyright (c) 2008 Michael Shalayeff
  * Copyright (c) 2003 Anders Magnusson (ragge%ludd.luth.se@localhost).
@@ -63,7 +63,7 @@
        /* save permanent registers */
        for (i = 0; i < MAXREGS; i++)
                if (TESTBIT(ipp->ipp_regs, i))
-                       fprintf(stdout, "\tmovq %s,-%d(%s)\n",
+                       printf("\tmovq %s,-%d(%s)\n",
                            rnames[i], regoff[i], rnames[FPREG]);
 }
 
@@ -166,7 +166,7 @@
                /* return from function code */
                for (i = 0; i < MAXREGS; i++)
                        if (TESTBIT(ipp->ipp_regs, i))
-                               fprintf(stdout, "       movq -%d(%s),%s\n",
+                               printf("        movq -%d(%s),%s\n",
                                    regoff[i], rnames[FPREG], rnames[i]);
 
                /* struct return needs special treatment */
@@ -414,11 +414,33 @@
                        return; /* XXX remove ZC from UCALL */
                if (pr)
                        printf("        addq $%d, %s\n", pr, rnames[RSP]);
+#define        STRREG 6
+#define        STRSSE 8
+#define        STRIF  9
+#define        STRFI  10
+#define        STRX87 11
+               if ((p->n_op == STCALL || p->n_op == USTCALL) &&
+                   p->n_stsize == 32 && p->n_stalign == STRX87) {
+                       printf("\tfstpt -%d(%%rbp)\n", stkpos);
+                       printf("\tfstpt -%d(%%rbp)\n", stkpos-16);
+                       printf("\tleaq -%d(%%rbp),%%rax\n", stkpos);
+               }
                if ((p->n_op == STCALL || p->n_op == USTCALL) &&
                    p->n_stsize <= 16) {
                        /* store reg-passed structs on stack */
-                       printf("\tmovq %%rax,-%d(%%rbp)\n", stkpos);
-                       printf("\tmovq %%rdx,-%d(%%rbp)\n", stkpos-8);
+                       if (p->n_stalign == STRREG || p->n_stalign == STRIF)
+                               printf("\tmovq %%rax,-%d(%%rbp)\n", stkpos);
+                       else
+                               printf("\tmovsd %%xmm0,-%d(%%rbp)\n", stkpos);
+                       if (p->n_stsize > 8) {
+                               if (p->n_stalign == STRREG ||
+                                   p->n_stalign == STRFI)
+                                       printf("\tmovq %%rdx,-%d(%%rbp)\n",
+                                           stkpos-8);
+                               else
+                                       printf("\tmovsd %%xmm1,-%d(%%rbp)\n",
+                                           stkpos-8);
+                       }
                        printf("\tleaq -%d(%%rbp),%%rax\n", stkpos);
                }
                break;
@@ -453,7 +475,7 @@
                break;
 
        case 'P': /* Put hidden argument in rdi */
-               if (p->n_stsize > 16)
+               if (p->n_stsize > 16 && p->n_stalign != STRX87)
                        printf("\tleaq -%d(%%rbp),%%rdi\n", stkpos);
                break;
 
@@ -613,7 +635,7 @@
        size /= SZCHAR;
        switch (p->n_op) {



Home | Main Index | Thread Index | Old Index