]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/ld: mark hostobj sections as containing no pointers
authorDmitriy Vyukov <dvyukov@google.com>
Tue, 22 Jul 2014 08:10:18 +0000 (12:10 +0400)
committerDmitriy Vyukov <dvyukov@google.com>
Tue, 22 Jul 2014 08:10:18 +0000 (12:10 +0400)
Currently they are scanned conservatively.
But there is no reason to scan them. C world must not contain
pointers into Go heap. Moreover, we don't have enough information
to emit write barriers nor update pointers there in future.
The immediate need is that it breaks the new GC because
these are weird symbols as if with pointers but not necessary
pointer aligned.

LGTM=rsc
R=golang-codereviews, rlh, rsc
CC=golang-codereviews, iant, khr
https://golang.org/cl/117000043

src/cmd/ld/ldelf.c
src/cmd/ld/ldmacho.c
src/cmd/ld/ldpe.c

index 1d7c4c13eade96ef9107846da5ad8e270db24dd7..38e414755604a8aaffa6811f9e9ced457ee2c6af 100644 (file)
@@ -539,7 +539,7 @@ ldelf(Biobuf *f, char *pkg, int64 len, char *pn)
                        s->type = SRODATA;
                        break;
                case ElfSectFlagAlloc + ElfSectFlagWrite:
-                       s->type = SDATA;
+                       s->type = SNOPTRDATA;
                        break;
                case ElfSectFlagAlloc + ElfSectFlagExec:
                        s->type = STEXT;
@@ -572,7 +572,7 @@ ldelf(Biobuf *f, char *pkg, int64 len, char *pn)
                        if(s->size < sym.size)
                                s->size = sym.size;
                        if(s->type == 0 || s->type == SXREF)
-                               s->type = SBSS;
+                               s->type = SNOPTRBSS;
                        continue;
                }
                if(sym.shndx >= obj->nsect || sym.shndx == 0)
index 413dedabd6c46d3806d2e54f7636f929e9dce131..71cfa63dec4266ae0a3134aaf936ac68f63646ee 100644 (file)
@@ -589,10 +589,10 @@ ldmacho(Biobuf *f, char *pkg, int64 len, char *pn)
                                s->type = SRODATA;
                } else {
                        if (strcmp(sect->name, "__bss") == 0) {
-                               s->type = SBSS;
+                               s->type = SNOPTRBSS;
                                s->np = 0;
                        } else
-                               s->type = SDATA;
+                               s->type = SNOPTRDATA;
                }
                sect->sym = s;
        }
index f6eda900de787f1b71c6a034398ea2c077019d72..1b05916148ca914efa6bf950eb9df202dadac59c 100644 (file)
@@ -230,10 +230,10 @@ ldpe(Biobuf *f, char *pkg, int64 len, char *pn)
                                s->type = SRODATA;
                                break;
                        case IMAGE_SCN_CNT_UNINITIALIZED_DATA|IMAGE_SCN_MEM_READ|IMAGE_SCN_MEM_WRITE: //.bss
-                               s->type = SBSS;
+                               s->type = SNOPTRBSS;
                                break;
                        case IMAGE_SCN_CNT_INITIALIZED_DATA|IMAGE_SCN_MEM_READ|IMAGE_SCN_MEM_WRITE: //.data
-                               s->type = SDATA;
+                               s->type = SNOPTRDATA;
                                break;
                        case IMAGE_SCN_CNT_CODE|IMAGE_SCN_MEM_EXECUTE|IMAGE_SCN_MEM_READ: //.text
                                s->type = STEXT;
@@ -338,7 +338,7 @@ ldpe(Biobuf *f, char *pkg, int64 len, char *pn)
                        if(s->type == SDYNIMPORT)
                                s->plt = -2; // flag for dynimport in PE object files.
                        if (s->type == SXREF && sym->value > 0) {// global data
-                               s->type = SDATA; 
+                               s->type = SNOPTRDATA;
                                s->size = sym->value;
                        }
                        continue;