]> Cypherpunks.ru repositories - gostls13.git/commit
cmd/link: allow enabling DWARF with -s
authorCherry Mui <cherryyz@google.com>
Fri, 5 May 2023 17:31:05 +0000 (13:31 -0400)
committerCherry Mui <cherryyz@google.com>
Fri, 21 Jul 2023 15:48:57 +0000 (15:48 +0000)
commit15eea6a193ec0a6c4fe0bfee14eae0fd6c02c815
tree2502fa98ea7606b1cbaba62d5ce420fe5a8e9ead
parentf29c4fa55e44c0ca835bc7e2d3e6ca8bfc01a9cd
cmd/link: allow enabling DWARF with -s

The -s flag is to documented to disable symbol table, not DWARF
(which is the -w flag). However, due to a bug (#15166), -s was
made to also disable DWARF. That bug can be fixed without
disabling DWARF. So do that, and make it possible to enable DWARF
with -s.

Since -s has been disabling DWARF for quite some time, and users
who use -s may want to suppress all symbol information, as DWARF
also contains symbol information, we keep the current behavior,
having -s continue to disable DWARF by default. But we allow
enabling DWARF by specifying -w=0 (or false).

In summary, this is the behavior now:
-s       no symbol table, no DWARF
-w       has symbol table, no DWARF
-s -w    no symbol table, no DWARF (same as -s)
-s -w=0  no symbol table, has DWARF

Change-Id: I1883f0aa3618abccfd735d104d983f7f531813d2
Reviewed-on: https://go-review.googlesource.com/c/go/+/492984
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
src/cmd/link/internal/ld/config.go
src/cmd/link/internal/ld/dwarf.go
src/cmd/link/internal/ld/elf.go
src/cmd/link/internal/ld/main.go