]> Cypherpunks repositories - gostls13.git/commitdiff
ld: don't attempt to build dynamic sections unnecessarily
authorGustavo Niemeyer <gustavo@niemeyer.net>
Wed, 22 Jun 2011 19:12:22 +0000 (15:12 -0400)
committerRuss Cox <rsc@golang.org>
Wed, 22 Jun 2011 19:12:22 +0000 (15:12 -0400)
This prevents ld from generating zeroed symtab entries for
sections that aren't going to be generated because dynamic
linkage has been disabled (-d was used or no dynamic libs
were seen).  Even though they were not explicitly added by
doelf, the section creation process was making them
reachable again.

The windows head is being disconsidered for this because
apparently it's not taking into account debug['d'].

This makes elflint 0.1% happier.

R=golang-dev, rsc, gustavo
CC=golang-dev
https://golang.org/cl/4638050

src/cmd/ld/data.c

index 9d9cd109b8353143984e45514fb10ace28709805..bdad58ff9acce9acf8cf964b469155cae6d96b0d 100644 (file)
@@ -278,6 +278,10 @@ dynreloc(void)
 {
        Sym *s;
        
+       // -d supresses dynamic loader format, so we may as well not
+       // compute these sections or mark their symbols as reachable.
+       if(debug['d'] && HEADTYPE != Hwindows)
+               return;
        if(debug['v'])
                Bprint(&bso, "%5.2f reloc\n", cputime());
        Bflush(&bso);