나무모에 미러 (일반/어두운 화면)
최근 수정 시각 : 2025-02-12 10:24:40

binutils

<colcolor=#fff><bgcolor=#a32d2a> GNU Binary Utilities
파일:GNU head.svg
<colbgcolor=#a32d2a> 종류 개발자 도구
프로젝트 빌드 시스템
링커/어셈블러
목적 파일 및 심볼 분석 도구 패키지
개발 GNU
언어 C, C++
플랫폼 GNU/Linux, BSD, Windows(MinGW)
안정 버전 v2.44(2025년 2월 2일)
라이선스 GPLv3
링크 파일:홈페이지 아이콘.svg Git
1. 개요2. 특징3. 목록
3.1. as3.2. ld3.3. gold
4. 기타5. 관련 문서

[clearfix]

1. 개요

GNU가 개발하는 C/C++ 및 C-ABI호환 ELF, DLL 목적 파일들을 대상으로 하는 링커, 어셈블러, 심볼 디버거, 정적 라이브러리 아카이브 인덱싱 및 조작 도구, 프로파일러 등 용도의 CLI라이브러리들을 다수 포함한 개발자 도구 패키지.

2. 특징

흔히 유닉스리눅스 배포판에 들어가는 기본 유틸리티로 coreutils를 생각하지만, 몇몇 중요한 툴들이 binutils에 있어 함께 포함되기도 한다. coreutils는 주로 일반 사용자, 셸 스크립트 작성용이라면 binutils는 C로 된 소스를 빌드하거나 링크하는 수준의 깊은 로우레벨 개발에 사용되는 도구들이라는 점이 차이. 하지만 이 차이가 무색하게도 유닉스 생태계에서 프로그램 하나 소스에서 빌드하려면 99.9%는 GCC와 함께 binutils를 종속성으로 요구하기 때문에 일반 사용자들도 간접적으로 많이 사용하게 된다.

3. 목록

<rowcolor=#fff> 이름 종류 비고
addr2lineCLI디버그 정보에서 찾은 명령어 주소를 원 소스의 줄 및 열 번호로 변환해 준다. 일종의 sourcemap.
arCLI정적 라이브러리 아카이브 포맷인 .a 파일을 생성하거나 압축 해제하는 데 사용한다. 사용법은 TAR과 완전히 동일. deb 포맷에서 내부적으로 사용하기도 한다.
asCLI어셈블러
c++filtCLI맹글링된 심볼을 원 소스의 식별자로 변환한다.
dlltoolCLIDLL 라이브러리 생성 툴.
elfeditCLIELF 파일 헤더 정보 수정 툴.
goldCLIELF 포맷 전용 고성능 링커. 자세한 내용은 gold 문단 참고.
gprofCLI프로파일러
gprofngCLI
ldCLI유닉스 표준 링커 구현체. 자세한 내용은 ld 문단 참고.
libbfd라이브러리일명 BFD. binutils 포함 패키지 및 GCC의 구현에서 광범위하게 쓰이는 목적 파일 관련 함수들을 묶은 라이브러리로, ELF, Windows PE를 포함해 수십 개의 목적 파일 추상화를 지원한다.[1]
libctf라이브러리
libopcodes라이브러리어셈블/디스어셈블에 쓰이는 opcode 라이브러리
libsframe라이브러리
nlmconvCLI
nmCLI목적 파일에 담긴 모든 심볼을 출력한다. objdump와 함께 자주 쓰이는 툴 중 하나.
objcopyCLI
objdumpCLI디버깅 및 리버싱에 가장 자주 쓰이는 툴 중 하나. 주로 -d 플래그로 목적 파일을 디스어셈블해 분석하는 용도로 쓰인다.
ranlibCLI정적 라이브러리 아카이브 인덱싱 툴. ar 등이 내부적으로 호출한다.
readelfCLIELF 헤더 정보, 섹션 등을 표시할 때 사용한다.
sizeCLI목적 파일의 각 섹션(.text, .data, .bss 등)별로 바이트 단위 크기를 출력한다.
stringsCLIPOSIX 표준에도 있고# 당연히 coreutils에 있을 것만 같지만 정작 binutils에 들어가 있다.
stripCLI목적 파일에서 심볼을 삭제한다. 주로 프로덕션 빌드 후 배포할 때 디버깅 심볼을 잘라내는 용도로 쓰인다.
windmcCLI
windresCLI

3.1. as

GNU Assembler, GAS

명령어는 as지만, 혼동을 피하기 위해 주로 gas라고 더 많이 불린다. ld와 함께 내부적으로 GCC의 백엔드로 쓰이며[2], 직접 사용할 경우 AT&T문법과 인텔 문법 모두 지원한다. 기본은 AT&T.# #

3.2. ld

유닉스의 표준 링커 구현체.# # #

유닉스에서 왜 링커가 ld라고 불리는지 다양한 설이 있는데, 가장 유력한 가설 중 하나는 link-editor의 줄임말이라는 것이다. 이외에도 ld가 loader의 줄임말이라는 설도 존재한다.[3]#

기본적으로 수많은 옵션들이 있으며, GCCClang 등의 고수준 컴파일러 툴체인을 사용할 때 흔히 -Wl 플래그로 내려보내는 것들이 전부 링커 옵션이다.[4] 조금 더 복잡한 동작을 위해서는 .ld 파일로 링커 스크립트를 작성할 수 있다.# # @

3.3. gold

2006년 구글 소속 개발자 이안 랜스 타일러(Ian Lance Taylor)가 개발한 ELF 포맷 전용 차세대 링커 구현체로, 2008년 3월에 GNU 프로젝트 산하로 이관되어 binutils에 포함되었다.[5][6][7]

상술한 BFD와 ld를 포기하고 ELF 전용으로 새로 개발한 주된 이유는 속도 때문으로[8], incremental linking을 도입한 이후 ld.bfd를 두 배 가량 뛰어넘는 성능을 보이고 있다.

GCC에서는 -fuse-ld=gold 플래그를 주면 ld 대신 사용할 수 있다.

2010년대 이후론 mold, lld 등 여러 포맷을 지원하면서 멀티스레딩으로 속도를 비약적으로 높인 alternative들의 등장으로 인해 위기론이 돌더니, 결국 2025년 2월 2일, binutils 2.44 릴리즈와 함께 deprecated되며 binutils 패키지에서 영영 사라지게 되었다. 공식적인 사유는 메인테이너의 부족 때문이라고.[9]

4. 기타

5. 관련 문서


[1] Most of these programs use BFD, the Binary File Descriptor library, to do low-level manipulation. #[2] as is primarily intended to assemble the output of the GNU C compiler gcc for use by the linker ld #[3] On Unix and Unix-like systems, the static linker is usually invoked via the command ld which is an abbreviation of LoaDer or Link eDitor. The term "loader" was used to describe the process of loading external symbols from other programs during the process of linking. #[4] if the linker is being invoked indirectly, via a compiler driver (e.g. gcc) then all the linker command line options should be prefixed by -Wl, (or whatever is appropriate for the particular compiler driver) #[5] gold was originally developed at Google, and was contributed to the Free Software Foundation in March 2008. At Google it was designed by Ian Lance Taylor #[6] I have been working on a new ELF linker for some time. With the agreement of the main GNU binutils maintainers, I have just added it to the GNU binutils. #[7] I submitted my first patch to the GNU linker in 1992. In 1993 I knew enough about its shortcomings, and started to argue that we should rewrite it from scratch. In 2006, just 13 years later, and now working at Google, I finally got a chance to do it. #[8] The linker I am now working, called gold, on will be my third. It is exclusively an ELF linker. Once again, the goal is speed, in this case being faster than my second linker. #[9] Perhaps the most significant change is the absence of the "gold" linker, which is deprecated and about to disappear entirely. Gold appeared in 2008 with some fanfare as a faster linker, but it has suffered from a lack of maintenance in recent years. (...) in this release the binutils-2.44.tar tarball does not contain the sources for the gold linker. This is because the gold linker is now deprecated and will eventually be removed unless volunteers step forward and offer to continue development and maintenance. #