cross-compile(mips) 입니다.

백연구원의 이미지

host 는 x86 머신입니다.

#include <stdio.h>
 
int main(int argc, char **argv)
{
    char    a;
 
    a = 10;
 
    __sync_lock_test_and_set(&a, 1);
    __sync_lock_release(&a);
 
    return(0);
}

gcc로는 정상 컴파일 됩니다. mips compiler로 컴파일하고자 하는데 아래와 같은 에러가 나옵니다.

/tmp/ccs0M6bI.o: In function `main':
test.c:(.text+0x40): undefined reference to `__sync_lock_test_and_set_1'
collect2: ld returned 1 exit status

뭔가.. __sync_lock_test_and_set_1 매크로가 gcc 쪽에 built-in 되어 있는 느낌인데 mips compiler로 컴파일 할 수 있는 방법이 없을까요?
컴파일러 버전은 4.1.2 입니다. (4.3 에서도 테스트 해봤습니다.)

백연구원의 이미지

자문자답입니다. gcc 버전에 따라서 built-in 되어 있는 모듈에 약간의 차이가 있나봅니다.
컴파일러 버전을 4.7.0 으로 올리고 나서 정상적으로 처리되었습니다.


소곤소곤