Open lunixbochs opened 8 years ago
I have migrated patchkit from CGC to i386/x86_64 in my repository(https://github.com/bet4it/patchkit) and integrated my fork of lib43(https://github.com/bet4it/lib43) as the library. Now i386/x86_64 syscalls works well and most functions of lib43 can be used.
But it can't handle with global/static variables and functions in lib43/io.c seems can't flush the buffer correctly which affects functions like printf
and put
. We still need some changes in it.
This is cool. Have you looked at the compiler's output assembly to see why static isn't working? I'd rather fix static/globals than inline everything.
For example, global variables don't belong to specific function, so we should handle them like what we have done with functions. We should find all of them, declare them, and substitute their names with addresses in linker's post procedure.
If the binary enables PIE, the references to global/static variables won't be redirected, which will cause errors.
Add arch/OS support in linker and integrate lib43.