public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Andi Hellmund <mail@andihellmund.com>
To: kevin diggs <diggskevin38@gmail.com>
Cc: gcc-help@gcc.gnu.org
Subject: Re: options for later passes
Date: Mon, 21 Feb 2011 23:37:00 -0000	[thread overview]
Message-ID: <4D62F0C9.1010305@andihellmund.com> (raw)
In-Reply-To: <AANLkTimyLp9g+y9SXQnd2155j+8hZSaS2-AdBmnBKtY1@mail.gmail.com>

Hey Kevin,

> Is there an easy way to figure out which options need to be passed to
> later compilation passes?

Well, I think it's quite easy: it depends on what you want to build, how 
you want to build it and which library it requires. For example, 
gcc/linker can't know that function xyz() belongs to libabc.

> What should be used for assembly:
>
> gcc -c ??? gcc1test.s

I doubt that you really need to assemble a file directly, but it also 
depends on your needs. I would say that default options (though no 
specific options) could be sufficient.

> I am pretty sure the link will need the -fpic.

-fpic _should_ be used when building a shared library.

> Probably also something like -pthread?

Only, if you are building a multi-threaded application. If not, you 
don't need to specify -lpthread.

 > So as a general rule should it see the cpu (or arch) option?

Sorry, but this also depends. If you for example build an application to 
be used by a Linux distro which might run on a various number of CPUs, 
you would possible use the "generic" option, but if you are building a 
high-performance application, you would specifically tune your 
application for the target processor.

> Does anyone else need the -O2?

No, only the compiler (cc1, cc1plus, ...)

> P.S.:  Do the order of the optimization options matter: '-O2 -mcpu=750
> -mmultiple' the same as '-mmultiple -mcpu=750 -O2'?

No, it shouldn't. GCC firstly reads in the parameter and then does a 
post-processing on the options where necessary.

Best regards,
Andi

  reply	other threads:[~2011-02-21 23:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-21 20:58 kevin diggs
2011-02-21 23:37 ` Andi Hellmund [this message]
2011-02-22  0:34   ` kevin diggs
2011-02-22 15:47     ` Andi Hellmund

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4D62F0C9.1010305@andihellmund.com \
    --to=mail@andihellmund.com \
    --cc=diggskevin38@gmail.com \
    --cc=gcc-help@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).