Page 1 of 1

Post deleted

Posted: Wed Feb 24, 2021 11:57 am
by rpio
Post deleted

Re: The OS does not link correctly on x86_64

Posted: Wed Feb 24, 2021 12:21 pm
by austanss
try switching --target x86_64-elf and --arch x86_64-elf to --target=x86_64-elf and -march=x86_64

Re: The OS does not link correctly on x86_64

Posted: Wed Feb 24, 2021 1:17 pm
by rpio
Post deleted

Re: The OS does not link correctly on x86_64

Posted: Wed Feb 24, 2021 1:31 pm
by austanss
ngx wrote:
rizxt wrote:try switching --target x86_64-elf and --arch x86_64-elf to --target=x86_64-elf and -march=x86_64
Yes thanks, that also compiles well, but what exactly is the difference between -march and -arch for the linker - because linker said it would ignore -arch, but does not say same thing when I use -march?

But I probably figured out the problem with the address printing, I checked if the address is correct and not garbage not by looking at printf output, but instead by using the if comparison and it showed that the variable stores the right address. The problem is then with my printf implementation, I would be very grateful if you helped me to figure out the problem with printf(I think it is somehow related to 64-Bit mode switch because it worked in 32-Bit mode)

My printf implementation is starting on line 149 in https://pastebin.com/5LhRHSUA
I don't believe the -arch switch exists. I believe you were attempting to use -march.

Re: The OS does not link correctly on x86_64

Posted: Wed Feb 24, 2021 1:33 pm
by austanss
ngx wrote:
rizxt wrote:try switching --target x86_64-elf and --arch x86_64-elf to --target=x86_64-elf and -march=x86_64
Yes thanks, that also compiles well, but what exactly is the difference between -march and -arch for the linker - because linker said it would ignore -arch, but does not say same thing when I use -march?

But I probably figured out the problem with the address printing, I checked if the address is correct and not garbage not by looking at printf output, but instead by using the if comparison and it showed that the variable stores the right address. The problem is then with my printf implementation, I would be very grateful if you helped me to figure out the problem with printf(I think it is somehow related to 64-Bit mode switch because it worked in 32-Bit mode)

My printf implementation is starting on line 149 in https://pastebin.com/5LhRHSUA
Your printf function probably only supports 64-bit integers.

I have printf errors too! :lol:

Re: The OS does not link correctly on x86_64

Posted: Wed Feb 24, 2021 2:16 pm
by rpio
Post deleted

Re: The OS does not link correctly on x86_64

Posted: Wed Feb 24, 2021 2:19 pm
by rpio
Post deleted

Re: The OS does not link correctly on x86_64

Posted: Wed Feb 24, 2021 8:25 pm
by Octocontrabass
You need to use the stdarg.h macros to read the arguments to your printf function.