We can only use position-dependent global variables (R_*_COPY) in
injected code, not the position-independent R_*_GLOB_DAT as used in
shared objects.
And being able to modify the tool itself turns out to be a cool thing to
be able to.
INCLUDES := $(patsubst %, -I%, $(INCLUDEDIR) $(SRCDIR)) $(LIBELF_INCLUDES)
-CFLAGS := -g -Wall -std=gnu99 -pedantic -fPIC $(LIBELF_CFLAGS)
+CFLAGS := -g -Wall -std=gnu99 -pedantic $(LIBELF_CFLAGS)
LDFLAGS := $(LIBELF_LDFLAGS)
$(EXE): $(EXEOBJS) $(STATICLIB)
gcc -o $@ $^ $(LDFLAGS)
-$(SHAREDLIB): $(LIBOBJS)
- gcc -shared -Wl,-soname,lib$(LIBNAME).so.$(SHARED_VERMAJ) -o $@ $^ $(LDFLAGS)
+$(SHAREDLIB): $(LIBSRCS)
+ gcc $(INCLUDES) $(CFLAGS) -shared -fPIC -Wl,-soname,lib$(LIBNAME).so.$(SHARED_VERMAJ) -o $@ $^ $(LDFLAGS)
$(STATICLIB): $(LIBOBJS)
ar rcs $@ $^