]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/ld: fix gcdata and gcbss symbols
authorAnthony Martin <ality@pbrane.org>
Tue, 4 Jun 2013 14:07:22 +0000 (07:07 -0700)
committerIan Lance Taylor <iant@golang.org>
Tue, 4 Jun 2013 14:07:22 +0000 (07:07 -0700)
These two symbols don't show up in the Go symbol table
since they're defined in dodata which is called sometime
after symtab. They do, however, show up in the ELF symbol
table.

This regression was introduced in changeset 01c40d533367.

Also, remove the corresponding strings from the ELF strtab
section now that they're unused.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/8650043

src/cmd/ld/data.c
src/cmd/ld/elf.c
src/cmd/ld/symtab.c

index 23fc23e5fc3da17747894b071f5fda0310bfeb9a..93718ad1d16da82fa9843a82ae82d5f2e94e27c4 100644 (file)
@@ -1047,13 +1047,8 @@ dodata(void)
                Bprint(&bso, "%5.2f dodata\n", cputime());
        Bflush(&bso);
 
-       // define garbage collection symbols
        gcdata1 = lookup("gcdata", 0);
-       gcdata1->type = STYPE;
-       gcdata1->reachable = 1;
        gcbss1 = lookup("gcbss", 0);
-       gcbss1->type = STYPE;
-       gcbss1->reachable = 1;
 
        // size of .data and .bss section. the zero value is later replaced by the actual size of the section.
        adduintxx(gcdata1, 0, PtrSize);
@@ -1477,11 +1472,11 @@ address(void)
        }
 
        sym = lookup("gcdata", 0);
-       xdefine("egcdata", STYPE, symaddr(sym) + sym->size);
+       xdefine("egcdata", SRODATA, symaddr(sym) + sym->size);
        lookup("egcdata", 0)->sect = sym->sect;
 
        sym = lookup("gcbss", 0);
-       xdefine("egcbss", STYPE, symaddr(sym) + sym->size);
+       xdefine("egcbss", SRODATA, symaddr(sym) + sym->size);
        lookup("egcbss", 0)->sect = sym->sect;
 
        xdefine("symtab", SRODATA, symtab->vaddr);
index 3ab909979fe7ae093f8c84efd76167b91ace272d..46d7056665255df061f7d787d5058fefaac866f0 100644 (file)
@@ -905,8 +905,6 @@ doelf(void)
        addstring(shstrtab, ".typelink");
        if(flag_shared)
                addstring(shstrtab, ".data.rel.ro");
-       addstring(shstrtab, ".gcdata");
-       addstring(shstrtab, ".gcbss");
        addstring(shstrtab, ".gosymtab");
        addstring(shstrtab, ".gopclntab");
        
@@ -918,8 +916,6 @@ doelf(void)
                        addstring(shstrtab, ".rela.text");
                        addstring(shstrtab, ".rela.rodata");
                        addstring(shstrtab, ".rela.typelink");
-                       addstring(shstrtab, ".rela.gcdata");
-                       addstring(shstrtab, ".rela.gcbss");
                        addstring(shstrtab, ".rela.gosymtab");
                        addstring(shstrtab, ".rela.gopclntab");
                        addstring(shstrtab, ".rela.noptrdata");
@@ -928,8 +924,6 @@ doelf(void)
                        addstring(shstrtab, ".rel.text");
                        addstring(shstrtab, ".rel.rodata");
                        addstring(shstrtab, ".rel.typelink");
-                       addstring(shstrtab, ".rel.gcdata");
-                       addstring(shstrtab, ".rel.gcbss");
                        addstring(shstrtab, ".rel.gosymtab");
                        addstring(shstrtab, ".rel.gopclntab");
                        addstring(shstrtab, ".rel.noptrdata");
index 7c8ba642fbd23193900ae8148b60681a09d5e4d3..2764d50ba45b035bec6613bd8392e1db18ec6476 100644 (file)
@@ -481,8 +481,6 @@ symtab(void)
                xdefine("datarelro", SDATARELRO, 0);
                xdefine("edatarelro", SDATARELRO, 0);
        }
-       xdefine("egcdata", STYPE, 0);
-       xdefine("egcbss", STYPE, 0);
        xdefine("noptrdata", SNOPTRDATA, 0);
        xdefine("enoptrdata", SNOPTRDATA, 0);
        xdefine("data", SDATA, 0);
@@ -495,6 +493,19 @@ symtab(void)
        xdefine("epclntab", SRODATA, 0);
        xdefine("esymtab", SRODATA, 0);
 
+       // garbage collection symbols
+       s = lookup("gcdata", 0);
+       s->type = SRODATA;
+       s->size = 0;
+       s->reachable = 1;
+       xdefine("egcdata", SRODATA, 0);
+
+       s = lookup("gcbss", 0);
+       s->type = SRODATA;
+       s->size = 0;
+       s->reachable = 1;
+       xdefine("egcbss", SRODATA, 0);
+
        // pseudo-symbols to mark locations of type, string, and go string data.
        s = lookup("type.*", 0);
        s->type = STYPE;