ld

significance of address 0x8048080

混江龙づ霸主 提交于 2020-08-19 17:00:33
问题 why when i debug asm source in gdb is 0x8048080 the address chosen for the starting entry point into code? this is just a relative offset, not an actual offset of into memory of an instruction, correct? 回答1: There is no special significance to address 0x8048080 , but there is one for address 0x08048000 . The latter address is the default address, on which ld starts the first PT_LOAD segment on Linux/x86. On Linux/x86_64, the default is 0x400000 , and you can change the default by using a

significance of address 0x8048080

好久不见. 提交于 2020-08-19 16:59:34
问题 why when i debug asm source in gdb is 0x8048080 the address chosen for the starting entry point into code? this is just a relative offset, not an actual offset of into memory of an instruction, correct? 回答1: There is no special significance to address 0x8048080 , but there is one for address 0x08048000 . The latter address is the default address, on which ld starts the first PT_LOAD segment on Linux/x86. On Linux/x86_64, the default is 0x400000 , and you can change the default by using a

Why did ld turn my 5 lines of library-less C into a 100MB binary?

两盒软妹~` 提交于 2020-08-05 06:15:35
问题 I'm trying to develop some very low-level x86 code following this document. I wrote the following C program: void main() { char* video_memory = (char*) 0xb8000; *video_memory = 'X'; } I compile and link it like so: gcc -m32 -fno-pie -c main.c -o main.o ld -m elf_i386 -o main.bin -Ttext 513 --oformat binary main.o This produces a binary called main.bin which is over a hundred megabytes . I disassembled that binary and it's basically my code (ten or so lines), then a hundred meg of zeros, and

Why did ld turn my 5 lines of library-less C into a 100MB binary?

自闭症网瘾萝莉.ら 提交于 2020-08-05 06:15:31
问题 I'm trying to develop some very low-level x86 code following this document. I wrote the following C program: void main() { char* video_memory = (char*) 0xb8000; *video_memory = 'X'; } I compile and link it like so: gcc -m32 -fno-pie -c main.c -o main.o ld -m elf_i386 -o main.bin -Ttext 513 --oformat binary main.o This produces a binary called main.bin which is over a hundred megabytes . I disassembled that binary and it's basically my code (ten or so lines), then a hundred meg of zeros, and

collect2: error: ld terminated with signal 11 [Segmentation fault], core dumped

不打扰是莪最后的温柔 提交于 2020-07-29 12:12:04
问题 I was learning OpenGL using GLFW, and didn't have a great understanding of makefiles at the time. I had OpenGL working, but I decided to learn makefiles more. I came up with this after a lot of websites, hours, and trial and error: EXENAME = "OpenGL Demo" CC = gcc SRCS = ../src/OpenGLDemo.c OBJS = $(SRCS: .c = .o) CFLAGS = -Wall -g -c LIBS = -L./libs -lglfw3 C:/Windows/SysWOW64/opengl32.dll C:/Windows/SysWOW64/glu32.dll all: opengldemo exe exe: $(OBJS) $(CC) $(OBJS) -o $(EXENAME) $(LIBS)

How to set breakpoint on entry of dynamically opened shared library?

◇◆丶佛笑我妖孽 提交于 2020-06-29 04:58:25
问题 For some context, I'm inspecting a simple C++ program using the experimental transactional memory model, compiled with g++. I want to know exactly where register_tm_clones is called(you can see the fn by objdumping a simple program). This function will be called even in a program like int main() {} . I want to know where in the whole scope of a general program where register_tm_clones is called. I set a breakpoint on it in GDB and I backtrace: Breakpoint 1, 0x00007ffff7c5e6e0 in register_tm

Linker error when calling printf from _start [duplicate]

為{幸葍}努か 提交于 2020-06-09 04:17:28
问题 This question already has answers here : Assembling 32-bit binaries on a 64-bit system (GNU toolchain) (2 answers) Closed 3 years ago . I tried to write simple program without main segment .data fmt db "test", 0xa, 0 segment .text global _start extern printf _start: lea rdi, [fmt] ; print simple string xor eax, eax call printf mov eax, 60 ; exit successfully xor edi, edi syscall Compile: yasm -f elf64 main.s; ld -o main main.o Got main.o: In function `_start': main.s:(.text+0xb): undefined