cmd/link: silently performs incorrect relocations when linking foreign objects #24321
Comments
Can you show us a self-contained example? Does it work if you use Perhaps we should default to external linking mode in the presence of any syso files. |
Timed out in state WaitingForInfo. Closing. (I am just a bot, though. Please speak up if this is a mistake or you have the requested information.) |
Reopening, I can provide a test case from FiloSottile/ed25519-dalek-rustgo#1. |
Removing the WaitingForInfo tag worked around GopherBot fighting you :P. |
@ianlancetaylor I encountered this issue while looking into #30890. Also, whilst typing in my issue number I discovered the very next issue filed was also about relocations - interesting/amusing coincidence: #30891. .text
.file "-"
.globl exampleFunc # -- Begin function exampleFunc
.p2align 4, 0x90
.type exampleFunc,@function
exampleFunc: # @exampleFunc
.Lfunc_begin0:
.cfi_startproc
movzbl .L__const.exampleFunc.one(%rip), %eax
movl %eax, 8(%rsp)
retq
.Lfunc_end0:
.size exampleFunc, .Lfunc_end0-exampleFunc
.cfi_endproc
.type .L__const.exampleFunc.one,@object # @__const.exampleFunc.one
.section .rodata.cst4,"aM",@progbits,4
.p2align 2
.L__const.exampleFunc.one:
.long 1 # 0x1
.size .L__const.exampleFunc.one, 4 If I build this with
but it's missing in the go binary:
|
For example, when linking syso files.
Adding
go:cgo_import_dynamic
helps but (1) it was recently disabled for security reasons for non-cgo files, then reenabled because solaris needs it, so it's unclear if this policy will persist in the long-run for all architectures, and (2) you need to specify it for specific symbols rather than for all symbols. In any case, an error should be raised with a hint on what to do, rather than succeeding silently with invalid output.The equivalent thing in Haskell Just Works with no extra annotations.
The text was updated successfully, but these errors were encountered: