4 ms·
to extend on it, _start is where .text begins and address of that is set by linker
by Keyframe 3y ago
to extend on it, _start is where .text begins and address of that is set by linker
- a-priori 3y agoThe entry point can be anywhere in the .text section, and often won't be at the beginning of the section.
- Retr0id 3y agoTechnically it doesn't even need to be in the .text section, it could be anywhere in the address space. You'll get a segfault if it's not somewhere executable though (assuming you're on a system with an appropriately configured MMU)
- Keyframe 3y agoyes and then you'll have a bad time, but at the same time per convention _start is where .text begins. You can see where it starts with readelf --file-header <executable> and look at Entry point address field. You can change it, yes.
- logdahl 3y agoA common hack to reduce ELF size is actually to start the first section (possibly the .text) right on the elf header, as this circumvents the alignment requirements.
- Keyframe 3y agoprobably not even mandatory.. lots of /usr/bin stuff on my ubuntu machine have __libc_start_main only
- Retr0id 3y agoNo, it's not even a convention, _start is most commonly not where .text begins. Compiling a static hello world binary on my system (aarch64 fedora 39, gcc -static hello.c -o hello), .text starts at 0x410080, e_entry is at 0x4103c0, and the _start symbol is also at 0x4103c0. This is not unusual at all.
- deleted 3y ago[deleted]