Closed eh-steve closed 2 years ago
@eh-steve, thanks for your pr, but some changes cannot adapt to the lower golang version, i will review it and merge it manually.
I'm happy to port the pclntab changes to the lower versions - I might be making some more changes once I get to the bottom of some other bugs
@eh-steve
When the loader adds a symbol (ld.go:AddSymbol), if the symbol already exists in loader, the loader will be use the symbol in loader, it will be avoid to duplicate type symbol, but it will be lead to far address for R_ADDR on windows platform. As the same time, i will deal it with issue #61 and this pr.
I will merge bug fix manually, thanks for your pr
Hi, your fixes don't actually cover everything that has been fixed in this PR - would you be up for discussing these changes further?
I might add some tests which demonstrate each fix
@eh-steve Some bugs I don't find testcases. Now, I am finding golang source code by import path and ASM function warpper, if you have testcases, please give me an issue or some code, thanks.
Hi @pkujhd,
I've opened a chunky PR which hopefully demonstrates the purpose of each commit (and adds a new JIT compiler package). The jit
tests should be able to be run for each commit on the branch.
I would suggest we try to fix all the outstanding goloader bugs in that branch, then attempt to backport the changes for older Go versions rather than picking individual commits into master which aren't 100% working.
Previously, compiled code which used type assertions or switches wouldn't always work as expected, since duplicate
*_type
s would be present in both the main module and the object file, and type assertion uses pointer equality to determine whether types match (and the object code would reference the local types)This PR relocates code which references identical type descriptors (according to their compiler generated type hash being identical and type definitions being identical according to
runtime.typesEqual()
) to point at the main module's*_type
s:Example
might previously fail with
interface conversion: interface {} is []uint8, not []uint8 (types from different scopes)
, even if the incoming input is a[]byte
.Instead, in these cases you had to use reflection to (safely) extract the underlying concrete type from the interface, e.g.:
This PR fixed the broken behaviour so type assertion and type switches on duplicated types works as expected