0

On my own self-learning R.E. Starting with understanding ELF and hopefully whats going on with every byte.

I build 2 simple binaries: 1 with a variable and 1 without. For some reason, the one without is larger. Why is that?

-rwxrwxrwx 1 u root 15632 Feb 19 21:30 main
-rwxrwxrwx 1 u root 15624 Feb 19 21:30 a

a.c

int main() {
    char a;
}

main.c

int main() {}

Makefile

CC=gcc
FLAGS=-O0 -fverbose-asm -no-pie

all: main a

main: main.c
    $(CC) $(FLAGS) -o $@ $^ 

a: a.c
    $(CC) $(FLAGS) -o $@ $^ 
2
  • 2
    If you are looking to learn, I suggest loading the two binaries into something that can do binary diffing to see if you can discover the answer yourself. I know Ghidra will let you do a simple difference comparison between two binaries, which may be helpful. There are likely other tools that could also do this.
    – goatshriek
    Commented Feb 21 at 16:42
  • add -S and compare the generated assembly, maybe you'll have your answer.
    – Igor Skochinsky
    Commented Feb 27 at 14:33

0

Browse other questions tagged or ask your own question.