Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

167
Views
Si no utiliza la función incorporada SIZEOF_HEADER en el script de enlace LD, el tamaño del archivo ejecutable cambia, ¿por qué?

github: https://github.com/Amyassient/link_test/tree/main

por ejemplo:Use LD 2.28 siempre que sea posible código fuente

 #include <stdio.h> int main(){ printf("hello world"); return 0; }

no use SIZEOF_HEADERS:

 PROVIDE (__executable_start = SEGMENT_START("text-segment", 0x400000)); **. = SEGMENT_START("text-segment", 0x400000);** .interp : { *(.interp) } .note.gnu.build-id : { *(.note.gnu.build-id) } .hash : { *(.hash) } .gnu.hash : { *(.gnu.hash) } .dynsym : { *(.dynsym) } .dynstr : { *(.dynstr) } .gnu.version : { *(.gnu.version) } .gnu.version_d : { *(.gnu.version_d) } .gnu.version_r : { *(.gnu.version_r) }

El tamaño del archivo:

 chang@ubuntu:~/Desktop/study/linker_test$ ls -al a.out -rwxrwxr-x 1 chang chang **2098312** Apr 11 13:54 a.out

Hay 30 encabezados de sección, comenzando en el desplazamiento 0x201970: Encabezados de sección:

 [Nr] Name Type Address Offset Size EntSize Flags Link Info Align [ 0] NULL 0000000000000000 00000000 0000000000000000 0000000000000000 0 0 0 [ 1] .interp PROGBITS 0000000000400000 00200000 000000000000001c 0000000000000000 A 0 0 1 [ 2] .note.gnu.propert NOTE 0000000000400020 00200020 00000000000000e0 0000000000000000 A 0 0 8 [ 3] .note.ABI-tag NOTE 0000000000400100 00200100

usar SIZEOF_HEADERS:

 PROVIDE (__executable_start = SEGMENT_START("text-segment", 0x400000)); **. = SEGMENT_START("text-segment", 0x400000) + SIZEOF_HEADERS;** .interp : { *(.interp) } .note.gnu.build-id : { *(.note.gnu.build-id) } .hash : { *(.hash) } .gnu.hash : { *(.gnu.hash) } .dynsym : { *(.dynsym) } .dynstr : { *(.dynstr) } .gnu.version : { *(.gnu.version) } .gnu.version_d : { *(.gnu.version_d) } .gnu.version_r : { *(.gnu.version_r) }

El tamaño del archivo:

 chang@ubuntu:~/Desktop/study/linker_test$ ls -al a.out -rwxrwxr-x 1 chang chang **1392** Apr 11 14:34 a.out

Hay 29 encabezados de sección, comenzando en el desplazamiento 0x1938:

Encabezados de sección:

 [Nr] Name Type Address Offset Size EntSize Flags Link Info Align [ 0] NULL 0000000000000000 00000000 0000000000000000 0000000000000000 0 0 0 [ 1] .interp PROGBITS 0000000000000270 00000270 000000000000001c 0000000000000000 A 0 0 1 [ 2] .note.gnu.propert NOTE 0000000000000290 00000290

El tamaño del archivo obviamente ha cambiado. ¿Por qué?

over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!