리눅스/커널2013. 8. 9. 17:06

출처: http://dtbaker.net/random-bits/android-unknown-symbol-_global_offset_table_/

 

커널 올리는 중에 에러가 나길래 찾아본 결과, 아래와 같은 글이 있었다.  결론적으로 이 방법이 솔루션이 되지는 못했지만, 참고 사항으로 올린다.

 

 

Android: Unknown symbol _GLOBAL_OFFSET_TABLE_

[ 1525.047424] bcm4329: Unknown symbol _GLOBAL_OFFSET_TABLE_ (err 0)

I received this error after compiling a custom Android kernel and modules using the arm-linux-androideabi-4.4.3 prebuilt toolchain.

I used arm-linux-androideabi-4.4.3 instead of arm-eabi-4.4.0 because arm-eabi-4.4.0 did not work for me on 64bit ubuntu ( * shrug * )

To fix this and to get my kernel modules loading I opened the Makefile within my kernel source folder and changed this:

MODFLAGS        = -DMODULE -march=armv7-a -mfpu=vfpv3 -ftree-vectorize

to this:

MODFLAGS        = -DMODULE -march=armv7-a -mfpu=vfpv3 -ftree-vectorize -fno-pic

Then re-built the kernel modules:

make clean
make modules

and copied my new module back over to android, away she goes!

————————-

if you cannot find MODFLAGS in the Makefile then look for:

CFLAGS_MODULE   =

and change it to

CFLAGS_MODULE   = -fno-pic

 

 

아 그리고  -fno-pic이 도대체 뭔 옵션인지 궁금해서 찾아보았다.

정말 더럽게 안 나온다.

gcc 메뉴얼을 찾아보니, -fpic에 대해 다음과 같이 설명하고 있다.

 

"타겟 머신에서 지원하는 경우, 공유 라이브러리를 위한 position-independent 코드 (PIC)을 생성한다.  이러한 코드는 global offset table(GOT)를 통해 모든 상수 주소에 대한 접근을 시도한다.  dynamic loader는 프로그램 실행의 시작시에 GOT 엔트리들을 처리한다.(참고로 dynamic loader는 GCC의 일부가 아니며 operating system의 일부이다).  ...

Position-indenpendent code 는 특정 머신의 지원이 필요하다...

이 플래그가 설정 된 경우, "__pic__""__PIC__" 는 1로 정의된다."

 

따라서 -fno-pic의 경우 position-independent 코드를 생성하지 말라는 것으로 보인다.

'리눅스 > 커널' 카테고리의 다른 글

FrameBuffer size 구하기  (0) 2013.12.11
[커널] FB 문서  (0) 2013.12.09
Kernel Oops의 Taint 종류  (0) 2013.07.25
[OS] priority inversion 해결방법  (0) 2013.01.13
monolithic vs microkernel  (0) 2013.01.13
Posted by code cat