-
Notifications
You must be signed in to change notification settings - Fork 23
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
Reverting 'stat.c' to original. #99
Conversation
This looks suspiciously like a llvm-mos bug that got fixed a while back --- certain relocations where being made incorrectly which resulted in the zp static data being copied from the wrong place, so any short string which was being cached in zero page was getting corrupted. Like FWIW, I've just tried it on the Oric in MAME and stat works fine on my system without modification: |
Something's broken in llvm-mos --- asm.com doesn't work any more. It's not at my end; I tried redoing a previously successful build on github, and it now fails: https://github.com/davidgiven/cpm65/actions/runs/7532135164 I wonder if this is related? |
In my latest tests it seams that ASM.COM works. EDIT: I've repeated the test with enabled option
BTW, what is the point to use |
I've just found a nasty LLVM bug: llvm-mos/llvm-mos-sdk#306 It was causing the start of the heap to not be relocated, meaning that if the binary was loaded above 0x0200 (which it usually is) then it would overwrite some of the program. This was causing the garbage out of ASM.COM in the mame tests. Unfortunately it'll take a while before the change reaches the release version of llvm-mos. |
Great news! I have some improvements for Oric and will open PR after I test all on real hardware. |
That bug hasn't gone away. I finally found out what's going on this time: llvm-mos/llvm-mos-sdk#320 The good news is that your suggestion of turning off ZP LTO should work around this for now. I'll send them a PR. |
Could this please be merged? Only LF is not how it's supposed to work. |
Sorry, yes. Merging. This was left open because of the underlying linker issue. (It's not a problem with ZP LTO, but it's provoked by ZP LTO...) |
Removing the 'ugly' hack. 'stat.c' and print() function are OK.
![bad](https://private-user-images.githubusercontent.com/1128663/292479109-f5558b69-8480-4a82-9639-1a6e85c94001.jpg?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjU1OTcwOTgsIm5iZiI6MTcyNTU5Njc5OCwicGF0aCI6Ii8xMTI4NjYzLzI5MjQ3OTEwOS1mNTU1OGI2OS04NDgwLTRhODItOTYzOS0xYTZlODVjOTQwMDEuanBnP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDkwNiUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA5MDZUMDQyNjM4WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9NjI3ZTIzNDE0YjBiMmQwMjhjMjdlY2E5ZDczZjI2ZTY1MTQ4NmIwMjI3ZDU2ZTI4OTEwNjRmMzhmMjZhMjNkYSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.TgfBjMJKYfJt620pX7uqwEdLzNqDTKM9fmoiGI8li0w)
The same issue (with printing strings passed as param) occurs also in 'objdump.c'.
My guess is that virtual registers are messing up with (some) zp variables.
Here: printed lines are overlapped and random wrong strings are displayed (i.e. 'kl' instead 'kB'):
The problem disappears when I comment out '-mlto-zp=32' line in 'mos-cpm65.cfg' file from the llvm-mos-sdk.
![set](https://private-user-images.githubusercontent.com/1128663/292480114-ef580ae1-9a4a-4180-8d78-e8da4c0b0658.jpg?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjU1OTcwOTgsIm5iZiI6MTcyNTU5Njc5OCwicGF0aCI6Ii8xMTI4NjYzLzI5MjQ4MDExNC1lZjU4MGFlMS05YTRhLTQxODAtOGQ3OC1lOGRhNGMwYjA2NTguanBnP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDkwNiUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA5MDZUMDQyNjM4WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MDhjZjFmMDM5YzM5ZTExOGRiNDlkYjNmNDY1OTc4YmVjZDI2YWNjNjAyYTIyZTNmYjQ5MzI1ZjczMWJhNzRiOSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.zrd9HLqS5p5_YWshLwMxLr3EIqC9Q1QBhoQL6ILlUnE)
As result everything works fine:
![good](https://private-user-images.githubusercontent.com/1128663/292480364-7937ae1a-ca89-4f7c-ab73-1f5b92221558.jpg?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjU1OTcwOTgsIm5iZiI6MTcyNTU5Njc5OCwicGF0aCI6Ii8xMTI4NjYzLzI5MjQ4MDM2NC03OTM3YWUxYS1jYTg5LTRmN2MtYWI3My0xZjViOTIyMjE1NTguanBnP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDkwNiUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA5MDZUMDQyNjM4WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9Y2M3MzZiMmI3YWRhN2RiNmY3MThjODU3N2ZmZDgzMjM0ZDQwMmZkYTEwMWRkNTNlMWZlOTg3NzJkNjQ5NDJiMiZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.oiMe0e1kaL6ytu4AgpGEWar_E-eAt_TnmLsqVpxbHAA)