Commit 251baea1 authored by Anthony Martin's avatar Anthony Martin Committed by Ian Lance Taylor

cmd/ld: fix gcdata and gcbss symbols

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
parent 941db1ed
...@@ -1047,13 +1047,8 @@ dodata(void) ...@@ -1047,13 +1047,8 @@ dodata(void)
Bprint(&bso, "%5.2f dodata\n", cputime()); Bprint(&bso, "%5.2f dodata\n", cputime());
Bflush(&bso); Bflush(&bso);
// define garbage collection symbols
gcdata1 = lookup("gcdata", 0); gcdata1 = lookup("gcdata", 0);
gcdata1->type = STYPE;
gcdata1->reachable = 1;
gcbss1 = lookup("gcbss", 0); 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. // size of .data and .bss section. the zero value is later replaced by the actual size of the section.
adduintxx(gcdata1, 0, PtrSize); adduintxx(gcdata1, 0, PtrSize);
...@@ -1477,11 +1472,11 @@ address(void) ...@@ -1477,11 +1472,11 @@ address(void)
} }
sym = lookup("gcdata", 0); sym = lookup("gcdata", 0);
xdefine("egcdata", STYPE, symaddr(sym) + sym->size); xdefine("egcdata", SRODATA, symaddr(sym) + sym->size);
lookup("egcdata", 0)->sect = sym->sect; lookup("egcdata", 0)->sect = sym->sect;
sym = lookup("gcbss", 0); sym = lookup("gcbss", 0);
xdefine("egcbss", STYPE, symaddr(sym) + sym->size); xdefine("egcbss", SRODATA, symaddr(sym) + sym->size);
lookup("egcbss", 0)->sect = sym->sect; lookup("egcbss", 0)->sect = sym->sect;
xdefine("symtab", SRODATA, symtab->vaddr); xdefine("symtab", SRODATA, symtab->vaddr);
......
...@@ -905,8 +905,6 @@ doelf(void) ...@@ -905,8 +905,6 @@ doelf(void)
addstring(shstrtab, ".typelink"); addstring(shstrtab, ".typelink");
if(flag_shared) if(flag_shared)
addstring(shstrtab, ".data.rel.ro"); addstring(shstrtab, ".data.rel.ro");
addstring(shstrtab, ".gcdata");
addstring(shstrtab, ".gcbss");
addstring(shstrtab, ".gosymtab"); addstring(shstrtab, ".gosymtab");
addstring(shstrtab, ".gopclntab"); addstring(shstrtab, ".gopclntab");
...@@ -918,8 +916,6 @@ doelf(void) ...@@ -918,8 +916,6 @@ doelf(void)
addstring(shstrtab, ".rela.text"); addstring(shstrtab, ".rela.text");
addstring(shstrtab, ".rela.rodata"); addstring(shstrtab, ".rela.rodata");
addstring(shstrtab, ".rela.typelink"); addstring(shstrtab, ".rela.typelink");
addstring(shstrtab, ".rela.gcdata");
addstring(shstrtab, ".rela.gcbss");
addstring(shstrtab, ".rela.gosymtab"); addstring(shstrtab, ".rela.gosymtab");
addstring(shstrtab, ".rela.gopclntab"); addstring(shstrtab, ".rela.gopclntab");
addstring(shstrtab, ".rela.noptrdata"); addstring(shstrtab, ".rela.noptrdata");
...@@ -928,8 +924,6 @@ doelf(void) ...@@ -928,8 +924,6 @@ doelf(void)
addstring(shstrtab, ".rel.text"); addstring(shstrtab, ".rel.text");
addstring(shstrtab, ".rel.rodata"); addstring(shstrtab, ".rel.rodata");
addstring(shstrtab, ".rel.typelink"); addstring(shstrtab, ".rel.typelink");
addstring(shstrtab, ".rel.gcdata");
addstring(shstrtab, ".rel.gcbss");
addstring(shstrtab, ".rel.gosymtab"); addstring(shstrtab, ".rel.gosymtab");
addstring(shstrtab, ".rel.gopclntab"); addstring(shstrtab, ".rel.gopclntab");
addstring(shstrtab, ".rel.noptrdata"); addstring(shstrtab, ".rel.noptrdata");
......
...@@ -481,8 +481,6 @@ symtab(void) ...@@ -481,8 +481,6 @@ symtab(void)
xdefine("datarelro", SDATARELRO, 0); xdefine("datarelro", SDATARELRO, 0);
xdefine("edatarelro", SDATARELRO, 0); xdefine("edatarelro", SDATARELRO, 0);
} }
xdefine("egcdata", STYPE, 0);
xdefine("egcbss", STYPE, 0);
xdefine("noptrdata", SNOPTRDATA, 0); xdefine("noptrdata", SNOPTRDATA, 0);
xdefine("enoptrdata", SNOPTRDATA, 0); xdefine("enoptrdata", SNOPTRDATA, 0);
xdefine("data", SDATA, 0); xdefine("data", SDATA, 0);
...@@ -495,6 +493,19 @@ symtab(void) ...@@ -495,6 +493,19 @@ symtab(void)
xdefine("epclntab", SRODATA, 0); xdefine("epclntab", SRODATA, 0);
xdefine("esymtab", 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. // pseudo-symbols to mark locations of type, string, and go string data.
s = lookup("type.*", 0); s = lookup("type.*", 0);
s->type = STYPE; s->type = STYPE;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment