Post deleted

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
rpio
Member
Member
Posts: 92
Joined: Sat Feb 20, 2021 3:11 pm

Post deleted

Post by rpio »

Post deleted
Last edited by rpio on Tue Aug 12, 2025 7:15 pm, edited 2 times in total.
User avatar
austanss
Member
Member
Posts: 379
Joined: Sun Oct 11, 2020 9:46 pm
Location: United States

Re: The OS does not link correctly on x86_64

Post by austanss »

try switching --target x86_64-elf and --arch x86_64-elf to --target=x86_64-elf and -march=x86_64
Skylight: https://github.com/austanss/skylight

I make stupid mistakes and my vision is terrible. Not a good combination.

NOTE: Never respond to my posts with "it's too hard".
rpio
Member
Member
Posts: 92
Joined: Sat Feb 20, 2021 3:11 pm

Re: The OS does not link correctly on x86_64

Post by rpio »

Post deleted
Last edited by rpio on Tue Aug 12, 2025 7:15 pm, edited 2 times in total.
User avatar
austanss
Member
Member
Posts: 379
Joined: Sun Oct 11, 2020 9:46 pm
Location: United States

Re: The OS does not link correctly on x86_64

Post 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.
Skylight: https://github.com/austanss/skylight

I make stupid mistakes and my vision is terrible. Not a good combination.

NOTE: Never respond to my posts with "it's too hard".
User avatar
austanss
Member
Member
Posts: 379
Joined: Sun Oct 11, 2020 9:46 pm
Location: United States

Re: The OS does not link correctly on x86_64

Post 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:
Skylight: https://github.com/austanss/skylight

I make stupid mistakes and my vision is terrible. Not a good combination.

NOTE: Never respond to my posts with "it's too hard".
rpio
Member
Member
Posts: 92
Joined: Sat Feb 20, 2021 3:11 pm

Re: The OS does not link correctly on x86_64

Post by rpio »

Post deleted
Last edited by rpio on Tue Aug 12, 2025 7:15 pm, edited 2 times in total.
rpio
Member
Member
Posts: 92
Joined: Sat Feb 20, 2021 3:11 pm

Re: The OS does not link correctly on x86_64

Post by rpio »

Post deleted
Last edited by rpio on Tue Aug 12, 2025 7:15 pm, edited 2 times in total.
Octocontrabass
Member
Member
Posts: 6277
Joined: Mon Mar 25, 2013 7:01 pm

Re: The OS does not link correctly on x86_64

Post by Octocontrabass »

You need to use the stdarg.h macros to read the arguments to your printf function.
Post Reply