Closed Cr0a3 closed 2 months ago
I'll need a way to reproduce the problem. Note that it is normal to have zeroes due to alignment padding.
Is the alignment in bytes? So when i give it 0x123456 it appends an empty byte if i specfie as the alignemnt 4?
Padding is inserted before the data that needs to be aligned, not after it.
Ok, thank you.
I'll need a way to reproduce the problem. Note that it is normal to have zeroes due to alignment padding.
Here's the rough code where i use your libary: https://github.com/Cr0a3/ygen/blob/main/src/Obj/wrapper.rs#L168-L287
To test the problem you need to run ./test.bat
or these 3 commands (from the root of the repo:
cargo run -p simplelang -- -in="tools/simplelang/example.sl" -o="out.o"
llvm-objdump -d out.o --x86-asm-syntax=intel > dump.asm
gcc out.o
The issue is there only sometimes. Mostly when the add function is on top. The expected data is printed and the data from the object file is in dump.asm
.
Sorry for the incovienence
I fixed the bug. It was caused by having invalid relocation offsets in my code. Then llvm-objdump added padding zeros so that most bytes would be a valid instruction
Hi, I am writting a code generation libary where i use your libary to write my data into object files. As i debugged another error and looked at my disassemblys i found a bunch of unexppected zeros in my object file. Which are sometimes there but sometimes aren't. I don't know if it's an error in my libary but i logged the values and they seem alright when i log them.
Bye Cr0a3