Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/link: the last file name is missing in gopclntab #17132

Closed
cherrymui opened this issue Sep 16, 2016 · 1 comment
Closed

cmd/link: the last file name is missing in gopclntab #17132

cherrymui opened this issue Sep 16, 2016 · 1 comment
Milestone

Comments

@cherrymui
Copy link
Member

What version of Go are you using (go version)?

tip

What did you do?

$ go build hello.go 
$ go tool objdump hello

Look at the end of the output, the last two functions has file name missing:

[... ...]

TEXT runtime.kevent(SB) /Users/cherryyz/src/go-tip/src/runtime/sys_darwin_amd64.s
        sys_darwin_amd64.s:491  0x4b150 8b7c2408        MOVL 0x8(SP), DI        
        sys_darwin_amd64.s:492  0x4b154 488b742410      MOVQ 0x10(SP), SI       
        sys_darwin_amd64.s:493  0x4b159 8b542418        MOVL 0x18(SP), DX       
        sys_darwin_amd64.s:494  0x4b15d 4c8b542420      MOVQ 0x20(SP), R10      
        sys_darwin_amd64.s:495  0x4b162 448b442428      MOVL 0x28(SP), R8       
        sys_darwin_amd64.s:496  0x4b167 4c8b4c2430      MOVQ 0x30(SP), R9       
        sys_darwin_amd64.s:497  0x4b16c b86b010002      MOVL $0x200016b, AX     
        sys_darwin_amd64.s:498  0x4b171 0f05            SYSCALL                 
        sys_darwin_amd64.s:499  0x4b173 7303            JAE 0x4b178             
        sys_darwin_amd64.s:500  0x4b175 48f7d8          NEGQ AX                 
        sys_darwin_amd64.s:501  0x4b178 89442438        MOVL AX, 0x38(SP)       
        sys_darwin_amd64.s:502  0x4b17c c3              RET                     
        :-1                     0x4b17d cc              INT $0x3                
        :-1                     0x4b17e cc              INT $0x3                
        :-1                     0x4b17f cc              INT $0x3                

TEXT runtime/internal/atomic.Xaddint64(SB) 
        :59     0x4b180 e90b000000      JMP runtime/internal/atomic.Xadd64(SB)  
        :-1     0x4b185 cc              INT $0x3                                
        :-1     0x4b186 cc              INT $0x3                                
        :-1     0x4b187 cc              INT $0x3                                
        :-1     0x4b188 cc              INT $0x3                                
        :-1     0x4b189 cc              INT $0x3                                
        :-1     0x4b18a cc              INT $0x3                                
        :-1     0x4b18b cc              INT $0x3                                
        :-1     0x4b18c cc              INT $0x3                                
        :-1     0x4b18d cc              INT $0x3                                
        :-1     0x4b18e cc              INT $0x3                                
        :-1     0x4b18f cc              INT $0x3                                

TEXT runtime/internal/atomic.Xadd64(SB) 
        :92     0x4b190 488b5c2408      MOVQ 0x8(SP), BX        
        :93     0x4b195 488b442410      MOVQ 0x10(SP), AX       
        :94     0x4b19a 4889c1          MOVQ AX, CX             
        :95     0x4b19d f0480fc103      LOCK XADDQ AX, 0(BX)    
        :97     0x4b1a2 4801c8          ADDQ CX, AX             
        :98     0x4b1a5 4889442418      MOVQ AX, 0x18(SP)       
        :99     0x4b1aa c3              RET 

According to https://golang.org/s/go12symtab,

The pcfile pc-value table produces indexes into a table of source file names. That table has the format:
N+1 name1 name2 name3 … nameN

Parsing the binary manually, it has N at the place where it should be N+1. objdump does what the doc says, and so ignores the last entry.

This problem has existed since at least Go 1.6 (did not check even earlier versions.)

(runtime/internal/atomic.Xaddint64 should be intrinsified, which is another issue. I have sent a CL.)

@cherrymui cherrymui self-assigned this Sep 16, 2016
@gopherbot
Copy link

CL https://golang.org/cl/29275 mentions this issue.

@cherrymui cherrymui added this to the Go1.8 milestone Sep 16, 2016
@golang golang locked and limited conversation to collaborators Sep 16, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants