Author Topic: ELF files are confusing.  (Read 14084 times)

Offline ben321

  • Full Member
  • **
  • Posts: 185
ELF files are confusing.
« on: August 09, 2023, 11:16:11 PM »
While Windows PE EXE files just have named sections as defined by section headers, ELF files have named sections, but also something called "program segments", which are unnamed, and are defined by a separate table of headers called program headers. What's up with that?

Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2667
  • Country: us
Re: ELF files are confusing.
« Reply #1 on: August 10, 2023, 01:57:33 AM »
Hi Ben,

I don't know. Where are you seeing this? Possibly 4k (usually) memory "pages"? If ypu can't dp anything  about it, I wouldn't worry about it.

Best,
Frank

 

Offline fredericopissarra

  • Full Member
  • **
  • Posts: 373
  • Country: br
Re: ELF files are confusing.
« Reply #2 on: August 11, 2023, 11:55:00 AM »
Aren't you confusing with "Program Header Table"?

In general, ELF is simplier then PE (and PE+).

Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2667
  • Country: us
Re: ELF files are confusing.
« Reply #3 on: August 12, 2023, 04:01:43 AM »
Yeah, I am probably confused. Should have stopped after "I don't know'"

Best,
Frank


Offline vitsoft

  • Jr. Member
  • *
  • Posts: 17
  • Country: cz
    • About me
Re: ELF files are confusing.
« Reply #4 on: August 13, 2023, 07:15:32 PM »
While ELF Sections are used by the linker, ELF Program Segments are used by the (dynamic) loader at the Linux program execution.
Section header tells where is the section's contents located in the file. This is used mostly at link-time.

Program segments instruct the loader at load-time about virtual address where should each segment be memory-mapped at, and what privileges should it be assigned (read,write,execute). See also ELF specification.

If you want to inspect ELF files in Windows, install Linux emulator WSL and use
readelf -aW ElfFile

Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2667
  • Country: us
Re: ELF files are confusing.
« Reply #5 on: August 13, 2023, 07:58:55 PM »
Thank you!

Frank


Offline fredericopissarra

  • Full Member
  • **
  • Posts: 373
  • Country: br
Re: ELF files are confusing.
« Reply #6 on: August 14, 2023, 12:13:01 PM »
Yeah, I am probably confused. Should have stopped after "I don't know'"

Best,
Frank
Frank, I was talking about the "program headers" in the original post.

[]s
Fred

Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2667
  • Country: us
Re: ELF files are confusing.
« Reply #7 on: August 14, 2023, 01:04:52 PM »
Okay, I'm confused on general principles. :)

Are you straightened out, Ben?

Frank