Por que os binários do apache criados com o gcc 64-bits são misturados com 32 e 64 bits?

1

No Solaris 10, criei o gcc 4.9.0 para 64 bits. Pelo menos eu pensei que fiz. Estou construindo uma pilha baseada no Apache e outras ferramentas de pré-requisito.

Se eu criar o apache file mostra um httpd de 64 bits:

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

Portanto, isso sugere que meu GCC é de 64 bits, mas no diretório onde eu construo meus binários eu corro for f in *; do file $f; done para executar o arquivo em todo o diretório que obtenho:

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

Por que estou vendo tantas construções de 32 bits? Se eu usei o gcc para construir o apache, como ele pode ser 64 bits quando os arquivos do gcc estão mostrando 32 bits?

    
por Dr.Avalanche 28.11.2014 / 13:38

2 respostas

4

O GCC no Solaris tem alguns padrões diferentes, por exemplo, do que o GCC no Linux.

Para compilar 64 binários, você precisa adicionar

-m64

para suas linhas de compilação e link.

Isso torna o GCC compatível com o compilador Solaris Studio C, a esse respeito.

No SPARC, a compilação de programas como 32 bits não tem tantas desvantagens quanto em, e. x86, onde 64 bits também fornecem registros adicionais.

    
por 28.11.2014 / 14:24
0

Você deve pensar em um compilador como uma função que gera saída de alguma entrada, ou

output_program = compile_function(input_source, args)

A existência de compile_function como um binário de 32 ou 64 bits afeta como faz seu trabalho, mas não a saída.

Se simplificarmos grosseiramente o papel de 64 bits para simplesmente aumentar a quantidade de memória endereçável, então tecnicamente um compilador de 32 bits só deve ser problemático para situações onde mais de 4GB de memória endereçável é necessária para produzir a saída. Tal situação para os tempos atuais, é principalmente inconcebível (embora eu tenha certeza de que algumas pessoas possam chegar a um exemplo artificial que faça exatamente isso).

    
por 28.11.2014 / 16:38