gcc 64비트로 빌드된 Apache 바이너리에 32비트와 64비트가 혼합되어 있는 이유는 무엇입니까?

gcc 64비트로 빌드된 Apache 바이너리에 32비트와 64비트가 혼합되어 있는 이유는 무엇입니까?

Solaris 10에서는 64비트 gcc 4.9.0을 구축했습니다. 적어도 나는 그랬다고 생각한다. Apache 및 기타 필요한 도구를 기반으로 스택을 구축 중입니다.

Apache를 빌드하면 file64비트 httpd가 표시됩니다.

file apache-test/bin/httpd 
apache-test/bin/httpd:        ELF 64-bit MSB executable SPARCV9 Version 1, dynamically linked, not stripped, no debugging information available

따라서 이는 내 GCC가 64비트임을 나타냅니다. 그러나 바이너리를 빌드한 디렉터리에서 for f in *; do file $f; done얻은 전체 디렉터리에 대해 파일을 실행합니다.

for f in *; do file $f; done 
a.out:          empty file 
addr2line:      ELF 32-bit MSB executable SPARC32PLUS Version 1, V8+ Required, UltraSPARC3 Extensions Required [CBCOND VIS3 VIS], dynamically linked, not stripped
ar:             ELF 32-bit MSB executable SPARC32PLUS Version 1, V8+ Required, UltraSPARC3 Extensions Required [CBCOND VIS3 VIS], dynamically linked, not stripped
as:             ELF 32-bit MSB executable SPARC32PLUS Version 1, V8+ Required, UltraSPARC3 Extensions Required [CBCOND VIS3 VIS], dynamically linked, not stripped
c_rehash:       executable /usr/bin/perl script 
c++:            ELF 32-bit MSB executable SPARC32PLUS Version 1, V8+ Required, UltraSPARC3 Extensions Required [CBCOND VIS3 FMAF VIS], dynamically linked, not stripped
c++filt:        ELF 32-bit MSB executable SPARC32PLUS Version 1, V8+ Required, UltraSPARC3 Extensions Required [CBCOND VIS3 VIS], dynamically linked, not stripped
compile_et:     executable shell script 
cpp:            ELF 32-bit MSB executable SPARC32PLUS Version 1, V8+ Required, UltraSPARC3 Extensions Required [CBCOND VIS3 FMAF VIS], dynamically linked, not stripped
elfedit:        ELF 32-bit MSB executable SPARC32PLUS Version 1, V8+ Required, UltraSPARC3 Extensions Required [CBCOND VIS3], dynamically linked, not stripped
g++:            ELF 32-bit MSB executable SPARC32PLUS Version 1, V8+ Required, UltraSPARC3 Extensions Required [CBCOND VIS3 FMAF VIS], dynamically linked, not stripped
gcc:            ELF 32-bit MSB executable SPARC32PLUS Version 1, V8+ Required, UltraSPARC3 Extensions Required [CBCOND VIS3 FMAF VIS], dynamically linked, not stripped
gcc-ar:         ELF 32-bit MSB executable SPARC32PLUS Version 1, V8+ Required, UltraSPARC3 Extensions Required [CBCOND VIS3], dynamically linked, not stripped
gcc-nm:         ELF 32-bit MSB executable SPARC32PLUS Version 1, V8+ Required, UltraSPARC3 Extensions Required [CBCOND VIS3], dynamically linked, not stripped
gcc-ranlib:     ELF 32-bit MSB executable SPARC32PLUS Version 1, V8+ Required, UltraSPARC3 Extensions Required [CBCOND VIS3], dynamically linked, not stripped
gcov:           ELF 32-bit MSB executable SPARC32PLUS Version 1, V8+ Required, UltraSPARC3 Extensions Required [CBCOND VIS3 FMAF VIS POPC], dynamically linked, not stripped
gprof:          ELF 32-bit MSB executable SPARC32PLUS Version 1, V8+ Required, UltraSPARC3 Extensions Required [CBCOND VIS3 FMAF VIS], dynamically linked, not stripped
gss-client:     ELF 64-bit MSB executable SPARCV9 Version 1, dynamically linked, not stripped, no debugging information available
k5srvutil:      executable shell script 
kadmin:         ELF 64-bit MSB executable SPARCV9 Version 1, dynamically linked, not stripped, no debugging information available
kdestroy:       ELF 64-bit MSB executable SPARCV9 Version 1, dynamically linked, not stripped, no debugging information available
kinit:          ELF 64-bit MSB executable SPARCV9 Version 1, dynamically linked, not stripped, no debugging information available
klist:          ELF 64-bit MSB executable SPARCV9 Version 1, dynamically linked, not stripped, no debugging information available
kpasswd:        ELF 64-bit MSB executable SPARCV9 Version 1, dynamically linked, not stripped, no debugging information available
krb5-config:    executable shell script 
kswitch:        ELF 64-bit MSB executable SPARCV9 Version 1, dynamically linked, not stripped, no debugging information available
ktutil:         ELF 64-bit MSB executable SPARCV9 Version 1, dynamically linked, not stripped, no debugging information available
kvno:           ELF 64-bit MSB executable SPARCV9 Version 1, dynamically linked, not stripped, no debugging information available
ld:             ELF 32-bit MSB executable SPARC32PLUS Version 1, V8+ Required, UltraSPARC3 Extensions Required [CBCOND VIS3 VIS], dynamically linked, not stripped
ld.bfd:         ELF 32-bit MSB executable SPARC32PLUS Version 1, V8+ Required, UltraSPARC3 Extensions Required [CBCOND VIS3 VIS], dynamically linked, not stripped
nm:             ELF 32-bit MSB executable SPARC32PLUS Version 1, V8+ Required, UltraSPARC3 Extensions Required [CBCOND VIS3 VIS], dynamically linked, not stripped
objcopy:        ELF 32-bit MSB executable SPARC32PLUS Version 1, V8+ Required, UltraSPARC3 Extensions Required [CBCOND VIS3 VIS], dynamically linked, not stripped
objdump:        ELF 32-bit MSB executable SPARC32PLUS Version 1, V8+ Required, UltraSPARC3 Extensions Required [CBCOND VIS3 VIS], dynamically linked, not stripped
openssl:        ELF 64-bit MSB executable SPARCV9 Version 1, UltraSPARC1 Extensions Required, dynamically linked, not stripped, no debugging information available
pcre-config:    executable shell script 
pcregrep:       ELF 64-bit MSB executable SPARCV9 Version 1, UltraSPARC3 Extensions Required, dynamically linked, not stripped
pcretest:       ELF 64-bit MSB executable SPARCV9 Version 1, UltraSPARC3 Extensions Required, dynamically linked, not stripped
ranlib:         ELF 32-bit MSB executable SPARC32PLUS Version 1, V8+ Required, UltraSPARC3 Extensions Required [CBCOND VIS3 VIS], dynamically linked, not stripped
readelf:        ELF 32-bit MSB executable SPARC32PLUS Version 1, V8+ Required, UltraSPARC3 Extensions Required [CBCOND VIS3 VIS], dynamically linked, not stripped
sclient:        ELF 64-bit MSB executable SPARCV9 Version 1, dynamically linked, not stripped, no debugging information available
sim_client:     ELF 64-bit MSB executable SPARCV9 Version 1, dynamically linked, not stripped, no debugging information available
size:           ELF 32-bit MSB executable SPARC32PLUS Version 1, V8+ Required, UltraSPARC3 Extensions Required [CBCOND VIS3 VIS], dynamically linked, not stripped
sparc-sun-solaris2.10-c++:      ELF 32-bit MSB executable SPARC32PLUS Version 1, V8+ Required, UltraSPARC3 Extensions Required [CBCOND VIS3 FMAF VIS], dynamically linked, not stripped
sparc-sun-solaris2.10-g++:      ELF 32-bit MSB executable SPARC32PLUS Version 1, V8+ Required, UltraSPARC3 Extensions Required [CBCOND VIS3 FMAF VIS], dynamically linked, not stripped
sparc-sun-solaris2.10-gcc:      ELF 32-bit MSB executable SPARC32PLUS Version 1, V8+ Required, UltraSPARC3 Extensions Required [CBCOND VIS3 FMAF VIS], dynamically linked, not stripped
sparc-sun-solaris2.10-gcc-4.9.0:        ELF 32-bit MSB executable SPARC32PLUS Version 1, V8+ Required, UltraSPARC3 Extensions Required [CBCOND VIS3 FMAF VIS], dynamically linked, not stripped
sparc-sun-solaris2.10-gcc-ar:   ELF 32-bit MSB executable SPARC32PLUS Version 1, V8+ Required, UltraSPARC3 Extensions Required [CBCOND VIS3], dynamically linked, not stripped
sparc-sun-solaris2.10-gcc-nm:   ELF 32-bit MSB executable SPARC32PLUS Version 1, V8+ Required, UltraSPARC3 Extensions Required [CBCOND VIS3], dynamically linked, not stripped
sparc-sun-solaris2.10-gcc-ranlib:       ELF 32-bit MSB executable SPARC32PLUS Version 1, V8+ Required, UltraSPARC3 Extensions Required [CBCOND VIS3], dynamically linked, not stripped
strings:        ELF 32-bit MSB executable SPARC32PLUS Version 1, V8+ Required, UltraSPARC3 Extensions Required [CBCOND VIS3 VIS], dynamically linked, not stripped
strip:          ELF 32-bit MSB executable SPARC32PLUS Version 1, V8+ Required, UltraSPARC3 Extensions Required [CBCOND VIS3 VIS], dynamically linked, not stripped
uuclient:       ELF 64-bit MSB executable SPARCV9 Version 1, dynamically linked, not stripped, no debugging information available

왜 그렇게 많은 32비트 버전이 표시됩니까? gcc를 사용하여 Apache를 빌드하는 경우 gcc 파일에 32비트라고 표시되어 있는데 어떻게 64비트가 될 수 있습니까?

답변1

Solaris의 GCC에는 Linux의 GCC와 다른 기본값이 있습니다.

64개의 바이너리를 컴파일하려면 다음을 추가해야 합니다.

-m64

컴파일 및 링크 라인에.

이와 관련하여 GCC는 Solaris Studio C 컴파일러와 호환됩니다.

SPARC에서는 프로그램을 32비트로 컴파일해도 64비트가 추가 레지스터를 제공하는 x86과 동일한 단점이 없습니다.

답변2

컴파일러를 일부 입력에서 출력을 생성하는 함수로 생각해야 합니다.

output_program = compile_function(input_source, args)

compile_function32비트 또는 64비트 바이너리가 있으면 영향을 미칩니다.어떻게작업은 수행되지만 출력이 없습니다.

64비트의 역할을 단순히 주소 지정 가능한 메모리의 양을 늘리는 것으로 크게 단순화한다면 기술적으로 32비트 컴파일러는 출력을 생성하는 데 4GB 이상의 주소 지정 가능한 메모리가 필요한 경우에만 문제가 발생해야 합니다. 이 시나리오는 기본적으로 오늘날에는 생각할 수 없는 일입니다(비록 일부 사람들이 이것에 대한 인위적인 예를 생각해 낼 수 있다고 확신하지만).

관련 정보