mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/link: put padding between functions, not at the end of a function
Functions should be declared to end after the last real instruction, not after the last padding byte. We achieve this by adding the padding while assembling the text section in the linker instead of adding the padding to the function symbol in the compiler. This change makes dtrace happy. TODO: check that this works with external linking Fixes #15969 Change-Id: I973e478d0cd34b61be1ddc55410552cbd645ad62 Reviewed-on: https://go-review.googlesource.com/24040 Run-TryBot: Keith Randall <khr@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
parent
595426c0d9
commit
5701174c52
4 changed files with 26 additions and 27 deletions
|
|
@ -609,7 +609,8 @@ func asmb() {
|
|||
|
||||
sect := ld.Segtext.Sect
|
||||
ld.Cseek(int64(sect.Vaddr - ld.Segtext.Vaddr + ld.Segtext.Fileoff))
|
||||
ld.Codeblk(int64(sect.Vaddr), int64(sect.Length))
|
||||
// 0xCC is INT $3 - breakpoint instruction
|
||||
ld.CodeblkPad(int64(sect.Vaddr), int64(sect.Length), []byte{0xCC})
|
||||
for sect = sect.Next; sect != nil; sect = sect.Next {
|
||||
ld.Cseek(int64(sect.Vaddr - ld.Segtext.Vaddr + ld.Segtext.Fileoff))
|
||||
ld.Datblk(int64(sect.Vaddr), int64(sect.Length))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue