skeeto/lstack — pull request #1 by cengizIO (2014-09-04 11:30:05+00:00)
Title: Update Makefile for using with Eclipse CDT; Fix -O0 undefined reference ...

I wanted to read full assembly, but linking with -O0 failed.

cc -std=c11 -Wall -O0 -mcx16 -c -o main.o main.c
cc -pthread main.o lstack.o sha1.o -o main
main.o: In function `worker':
main.c:(.text+0x1c5): undefined reference to `lstack_size'
main.o: In function `main':
main.c:(.text+0x367): undefined reference to `lstack_size'
main.c:(.text+0x3b7): undefined reference to `lstack_size'
collect2: error: ld returned 1 exit status
: recipe for target 'main' failed
make: *** [main] Error 1

Found this: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=49653#c11 and added an extern declaration.

I couldn't come up with a better fix.