From bac3bc42ef0133a7dda0870c4e1f37e5651feb99 Mon Sep 17 00:00:00 2001 From: norly Date: Thu, 27 Jun 2013 00:46:07 +0100 Subject: [PATCH] Only use -fPIC when compiling the shared object. 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. --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index a3594f7..c027c36 100644 --- a/Makefile +++ b/Makefile @@ -35,7 +35,7 @@ endif 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) @@ -58,8 +58,8 @@ debug: $(EXE) $(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 $@ $^ -- 2.30.2