OSDev.org

The Place to Start for Operating System Developers
It is currently Tue Mar 19, 2019 12:20 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Necessary to cross-compile nasm?
PostPosted: Sun Nov 04, 2018 7:01 pm 
Offline

Joined: Fri Oct 26, 2018 12:54 pm
Posts: 19
I am, currently, using the cross-compiled GCC tools as shown on the OSDev wiki.

I am using ATT syntax for my assembly files, which is fine. But, I see that most people use Intel syntax with nasm.

If I want to use Intel syntax, is it necessary for me to make a cross-compiled nasm, just like I made a cross compiled i386-elf-as ?


Top
 Profile  
 
 Post subject: Re: Necessary to cross-compile nasm?
PostPosted: Sun Nov 04, 2018 7:06 pm 
Offline
Member
Member
User avatar

Joined: Sat Oct 16, 2010 3:38 pm
Posts: 626
Bowlslaw wrote:
I am, currently, using the cross-compiled GCC tools as shown on the OSDev wiki.

I am using ATT syntax for my assembly files, which is fine. But, I see that most people use Intel syntax with nasm.

If I want to use Intel syntax, is it necessary for me to make a cross-compiled nasm, just like I made a cross compiled i386-elf-as ?


GNU assembler supports Intel syntax with some option.

You don't need a cross-compiler for nasm, because it doesn't do any OS-specific things. Just specify the correct output format on the command line, and write code which works under your OS, and your normal 'nasm' will work.

_________________
Glidix: An x86_64 POSIX-compliant operating system, aiming to be as optimized as possible, especially in graphics.
https://glidix.madd-games.org/


Top
 Profile  
 
 Post subject: Re: Necessary to cross-compile nasm?
PostPosted: Sun Nov 04, 2018 7:36 pm 
Offline
Member
Member

Joined: Tue Mar 04, 2014 5:27 am
Posts: 940
No. Unlike g++, which would generate code according to your OS/CPU, NASM will do what you ask it to, every instruction and every directive.


Top
 Profile  
 
 Post subject: Re: Necessary to cross-compile nasm?
PostPosted: Tue Nov 06, 2018 4:15 am 
Offline
Member
Member
User avatar

Joined: Fri Mar 07, 2008 5:36 pm
Posts: 2092
Location: Bucharest, Romania
Cross-compilers for OS development aren't about preventing your toolchain from doing OS-specific things as you can generally disable anything you don't want with the appropriate command-line options. It's really about having a non-default configuration that is appropriate for your needs (e.g., support for a different set of features, a different architecture, a different executable file format, etc.). NASM likely has everything you need already but you can consider your requirements and compare them against the configuration options to make sure. Also, we like to encourage people on this forum to build cross-compilers because a lot of them are not self-reliant so at least when they ask questions we can get more predictable outcomes without having to ask them about their toolchains.

_________________
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]


Top
 Profile  
 
 Post subject: Re: Necessary to cross-compile nasm?
PostPosted: Tue Nov 06, 2018 9:14 am 
Offline

Joined: Fri Oct 26, 2018 12:54 pm
Posts: 19
Thanks for the great answers.


Top
 Profile  
 
 Post subject: Re: Necessary to cross-compile nasm?
PostPosted: Wed Nov 07, 2018 2:31 am 
Offline
Member
Member
User avatar

Joined: Thu Nov 16, 2006 12:01 pm
Posts: 7348
Location: Germany
@Schol-R-Lea:

Note that your first and last statement are a bit contradictory. Yes, you can disable OS-specific things given the "correct" command-line options. But with an appropriate cross-compiler setup you don't have to, which is why we encourage it (so we don't have to go down the "which compiler on which OS are you using" tree).

Also, eventually you will need your own toolchain configuration, to which a "neutral" cross-compiler is the first step, so why not take that step right at the beginning.

_________________
Every good solution is obvious once you've found it.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group