I have one interesting compilation problem. At first, please see code to be compiled.
$ ls
Makefile main.c sub.c sub.h
$ gcc -v
...
gcc version 4.8.5 20150623 (Red Hat 4.8.5-16) (GCC)
Run Code Online (Sandbox Code Playgroud)
## Makefile
%.o: CFLAGS+=-fPIE #[2]
main.so: main.o sub.o
$(CC) -shared -fPIC -o $@ $^
Run Code Online (Sandbox Code Playgroud)
$ ls
Makefile main.c sub.c sub.h
$ gcc -v
...
gcc version 4.8.5 20150623 (Red Hat 4.8.5-16) (GCC)
Run Code Online (Sandbox Code Playgroud)
## Makefile
%.o: CFLAGS+=-fPIE #[2]
main.so: main.o sub.o
$(CC) -shared -fPIC -o $@ $^
Run Code Online (Sandbox Code Playgroud)
//main.c
#include …Run Code Online (Sandbox Code Playgroud)