기본 콘텐츠로 건너뛰기

GCC -rdynamic 플래그

GNU C 라이브러리에서 backtrace 함수를 지원하는 것 관련해서 -rdynamic 플래그를 쓰는 것에 대해 다시 볼 기회가 생겼다. (몇 년 전에 잠깐 보고 말았더랬지)

-rdynamic
    Pass the flag -export-dynamic to the ELF linker, on targets that support it. This instructs the linker to add all symbols, not only used ones, to the dynamic symbol table. This option is needed for some uses of "dlopen" or to allow obtaining backtraces from within a program.

여러번 재사용할 수 있는 심볼테이블을 만들라는 것인데, 컴파일러용 옵션이 아니라 링커용 옵션이다. 보통 DLL(리눅스에선 SO) 같은 걸 만들 때, 다른 Process가 이름(심볼)로 접근하기 위해 테이블을 만드는 것이다.

-g는 디버깅용 심볼테이블을 만드는데, 이것은 그야말로 임시용이라 strip 유틸리티 같은 걸로 날려버릴 수 있다.

참조: http://stackoverflow.com/questions/8623884/gcc-debug-symbols-g-flag-vs-linkers-rdynamic-option

댓글

이 블로그의 인기 게시물

탐색기에서 OneDrive 이 2개로 보이는 문제

왜 2개가 보이는지 모르겠지만, Registry 삭제하면 됨 HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace 하위 키에서 OneDrive 둘 중에 하나만 지워도 바로 반영됨. 참조:  https://answers.microsoft.com/en-us/msoffice/forum/all/duplicate-onedrives-in-file-explorer/49c935a6-287b-43a5-aed5-2dee2a1c1b22