ld fails under Solaris/i386

Marc Glisse marc.glisse at inria.fr
Fri Jan 15 18:06:18 CET 2010

On Fri, 15 Jan 2010, Torbjorn Granlund wrote:

> Marc Glisse <marc.glisse at normalesup.org> writes:
>  As the above paragraph suggests, you just need to remove the word
>  "extern" on line 466 of gmp-h.in to let gmp compile with sunpro (well,
>  the version I tried segfaulted on the "reuse" test in gmp5, but that
>  is something else).
> Using just "inline" without some other keyword seems just wrong.
> 1. The function will appear in .o files even if not used (waste of space).
> 2. The function will appear as global in many .o files and thus cause
>   multiply defined symbol errors.

I believe you are confusing the historical (gcc) behavior of inline/extern 
inline with the current C99 behavior. What you are describing is exactly 
what is currently happening with sunpro because of extern inline. If we 
replace it with inline, the function will never appear in .o files, it 
will either be inlined or not emitted at all.

Actually you can try it with a recent (>=4.3 IIRC) gcc and -std=c99 (or 
gnu99). The main differences between sunpro and a recent gcc here is that 
gcc has an attribute (used in gmp) to give extern inline its historical 
meaning and sunpro is more lenient that gcc (it emits a symbol with extern 
inline, but when you link several .o with such a symbol it merges them. It 
doesn't merge them with a regular symbol though). I tested both gcc-4.4 
and sunpro-12 with __GMP_EXTERN_INLINE=inline and 
__GMP_INLINE_PROTOTYPES=0 and they appear to work fine.

Marc Glisse

More information about the gmp-bugs mailing list