This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Difference between -shared, -symbolic, and -G?


I forgot to mention one thing that confuses me: Using -Wl,-G -fpic to
make a binary, then cleaning and using -shared -fpic -mimpure-text to
make a binary, results in two differently sized executables O_o Which
means that -G must have some additional effects other than just
changing whether it cares if you're mixing fpic and nonfpic code.

On Mon, Oct 19, 2009 at 3:02 PM, Joseph Garvin
<joseph.h.garvin@gmail.com> wrote:
> Can anyone explain the differences between using -shared, -symbolic, and -G?
>
> I've noticed two differences:
>
> 1. If I compile a shared library with -G, will contain an undefined
> reference to main that will prevent linking if -z defs is present. If
> I compile with -shared or -symbolic, the reference doesn't exist.
>
> 2. If I compile a shared library with -G, it doesn't matter if I
> statically link libraries. If I use -shared or -symbolic, I get
> millions of unresolved text relocation errors unless I add
> -mimpure-text.
>
> What is the -G option actually doing differently? The man page simply
> recommends you use -shared or -symbolic instead, but doesn't explain
> why or how to choose. Are shared and symbolic synonyms? The man page
> says share and symbolic only work on certain platforms, but it's
> unclear if it's the same platforms in both cases.
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]