Questions tagged [elf]
ELF stands for Executable and Linkable Format, a file format for files containing machine code. Use this tag for questions about the ELF format itself, or for questions which are specifically about reading/writing ELF files.
2,383
questions
0
votes
0
answers
40
views
CMAKE error while building the application (No SOURCES given to target)
I am trying to build an application that will generate an .elf file. This build is done with the Hi-tech compiler and CMAKE environment. I have some .c source files, corresponding .h files, and ...
0
votes
0
answers
67
views
Error cross compiling on windows 64 bit to x86 32bit with i368-gcc - "Warning: .type pseudo-op used outside of .def/.endef ignored."
I'm trying to make a simple os that uses the x86 32 bit architecture,
my kernel is the following: kernel.c:
void dummy_test_entrypoint() {
}
void main() {
char* video_memory = (char*) 0xb8000;
...
0
votes
0
answers
47
views
signal SIGSEGV: address access protected in __run_exit_handlers
I'm trying to do a packer project for my school, it is made in C and ASM, and for the moment it is supposed to target only ELF files.
I have managed to do my section injection, correctly align my new ...
0
votes
0
answers
31
views
Why is my assembly code giving extra output? [duplicate]
Before I start, it's important to say I am a complete beginner to Assembly, so I might be missing something very obvious.
I was trying to make an Assembly program where it prints the following output ...
0
votes
0
answers
18
views
Relocating a ELF in a freestanding env
Well I am making an OS and I want to make my Programs/Kernel elf's but I want them relocated so that I can protect programs more to memory editing.
I did not yet try something because I don't know ...
0
votes
0
answers
32
views
Use linker on M1 macOS to link bash and C files to compile simple kernel
I am following this tutorial on M1 MacBook (macOS Sonoma 14.5):
https://github.com/debashisbarman/Simple-Kernel-in-C-and-Assembly.
The kernel should connect to C.
I have following three files with the ...
0
votes
1
answer
32
views
readelf -R (--relocated-dump) option
Can anyone explain how the contents of a section are relocated using the -R option for readelf?
I would like to see an example of this so I can understand how it works.
When I build an executable ...
0
votes
0
answers
60
views
Path to source file not being included in ELF file debug section
I am trying to develop a C++ application for the RTEMS RTOS but I am having trouble getting debugging to work. They have a basic LED blinky example written in C that I am able to debug. However, ...
1
vote
0
answers
54
views
Unable to access mapped memory
Why can not access the memory after 0x010ff8
(gdb) br *0x0100e2
Breakpoint 1 at 0x100e2
(gdb) run
...
Breakpoint 1, 0x00000000000100e2 in ?? ()
(gdb) info proc mappings
process 2563326
Mapped address ...
2
votes
1
answer
29
views
Why gcc-7.5.0 generate different relocation entry
I am studying elf relocation and note that in our school's container, compile the c file below:
int sum(int *a, int n)
{
return a[0]+a[1];
}
int array[2] = {1, 2};
int main()
{
int val = sum(...
7
votes
1
answer
579
views
The meaning of these 16 bytes in the `.data` segment
I wrote a C++ program (t.cc) that only has an empty main function:
int main() {
}
I used g++ t.cc -o a.out to compile it into an executable program, and then used objdump --section=.data -s a.out to ...
0
votes
1
answer
52
views
Troubleshooting Execution Failure of the musl-libc Shared Library
Problem Description
I am currently working on a project involving shared library reconstruction (on a x64, Linux virtual machine), specifically targeting the musl-libc (verion: 1.1.15).
After ...
0
votes
0
answers
29
views
How to get Type:FUNC and its name from a ELF file? [duplicate]
include <stdio.h>
#include <stdlib.h>
#include <elf.h>
#include <string.h>
#include <fcntl.h>
int main(int argc, char *argv[]) {
if (argc != 2) {
fprintf(...
0
votes
1
answer
42
views
Analyzing Relocations in ARM for cortex-m4
I'm trying to understand how to correctly read the relocation entries generated by my ARM compiler (I'm using (GNU Arm Embedded Toolchain 9-2020-q2-update) 9.3.1 20200408 (release)).
To my ...
2
votes
1
answer
83
views
How to parse correctly the `.note.gnu.property` section of an ELF executable?
I am writing an ELF parser as a side project and I have encountered a problem while trying to parse .note* sections.
The documentation for ELF32 and ELF64 (available here and here, pages 42 and 13 ...