asterisk 1.2.16
a new line have been added in utils.c ( I think it’s to include properly inline functions ?)
#define AST_API_MODULE <-- this line
#include “asterisk/lock.h”
the file does not compile anymore on a MACOS (mac mini)
(that compiles on asterisk-1.2.15 and lower)
Here is what I get when I make a single compilation:
machine:/Users/jeanyves/dev/asterisk/asterisk16/asterisk-16 root# gcc -pipe -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -g3 -Iinclude -I…/include -D_REENTRANT -D_GNU_SOURCE -O6 -fomit-frame-pointer -D__Darwin__ -DPOLLCOMPAT -c -o utils.o utils.c
{standard input}:589:Can’t relocate expression. Absolute 0 assumed.
{standard input}:589:operands given don’t match any known 386 instruction
{standard input}:3019:Can’t relocate expression. Absolute 0 assumed.
{standard input}:3019:operands given don’t match any known 386 instruction
Seconded.
Jean, there’s an update to the dev tools you don’t have yet (I think). If you have the latest, you get a slightly different, but just as obscure, error:
gcc -pipe -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -g3 -Iinclude -I…/include -D_REENTRANT -D_GNU_SOURCE -O6 -fomit-frame-pointer -D__Darwin__ -DPOLLCOMPAT -c -o utils.o utils.c
{standard input}:589:invalid character ‘%’ in mnemonic
{standard input}:3019:invalid character ‘%’ in mnemonic
Thanks for the hint on the #define, I tracked it down. There’s a new inline assembly optimization in includes/asterisk/lock.h that apple’s gcc (4.0 or 4.0.1) don’t like. It appears that you can safely comment it out, and get the old (1.2.15 & <) behavior, so we’re not even losing anything, just missing out on a gain.
The code from includes/asterisk/lock.h in question:
#if defined (__i386__)
AST_INLINE_API(int ast_atomic_fetchadd_int(volatile int *p, int v),
{
__asm __volatile (
" lock xaddl %0, %1 ; "
: "+r" (v), /* 0 (result) */
"=m" (*p) /* 1 */
: "m" (*p)); /* 2 */
return (v);
})
#else /* low performance version in utils.c */
AST_INLINE_API(int ast_atomic_fetchadd_int(volatile int *p, int v),
{
return ast_atomic_fetchadd_int_slow(p, v);
})
#endif
The quick fix is to change line 673 to read:
#if defined (__i386__) && !defined(__APPLE__)