diff options
author | Rolf Eike Beer <eb@emlix.com> | 2019-03-26 13:48:39 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2019-03-28 08:32:01 -0400 |
commit | 056d28d135bca0b1d0908990338e00e9dadaf057 (patch) | |
tree | e4c4bb1e57d8b4f898dedcb277441ff2555a0e65 /tools | |
parent | cfa637cb20e96fe8cf44b867a7d7c34649cbf8eb (diff) |
objtool: Query pkg-config for libelf location
If it is not in the default location, compilation fails at several points.
Signed-off-by: Rolf Eike Beer <eb@emlix.com>
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: stable@vger.kernel.org
Link: https://lkml.kernel.org/r/91a25e992566a7968fedc89ec80e7f4c83ad0548.1553622500.git.jpoimboe@redhat.com
Diffstat (limited to 'tools')
-rw-r--r-- | tools/objtool/Makefile | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/tools/objtool/Makefile b/tools/objtool/Makefile index c9d038f91af6..53f8be0f4a1f 100644 --- a/tools/objtool/Makefile +++ b/tools/objtool/Makefile | |||
@@ -25,14 +25,17 @@ LIBSUBCMD = $(LIBSUBCMD_OUTPUT)libsubcmd.a | |||
25 | OBJTOOL := $(OUTPUT)objtool | 25 | OBJTOOL := $(OUTPUT)objtool |
26 | OBJTOOL_IN := $(OBJTOOL)-in.o | 26 | OBJTOOL_IN := $(OBJTOOL)-in.o |
27 | 27 | ||
28 | LIBELF_FLAGS := $(shell pkg-config libelf --cflags 2>/dev/null) | ||
29 | LIBELF_LIBS := $(shell pkg-config libelf --libs 2>/dev/null || echo -lelf) | ||
30 | |||
28 | all: $(OBJTOOL) | 31 | all: $(OBJTOOL) |
29 | 32 | ||
30 | INCLUDES := -I$(srctree)/tools/include \ | 33 | INCLUDES := -I$(srctree)/tools/include \ |
31 | -I$(srctree)/tools/arch/$(HOSTARCH)/include/uapi \ | 34 | -I$(srctree)/tools/arch/$(HOSTARCH)/include/uapi \ |
32 | -I$(srctree)/tools/objtool/arch/$(ARCH)/include | 35 | -I$(srctree)/tools/objtool/arch/$(ARCH)/include |
33 | WARNINGS := $(EXTRA_WARNINGS) -Wno-switch-default -Wno-switch-enum -Wno-packed | 36 | WARNINGS := $(EXTRA_WARNINGS) -Wno-switch-default -Wno-switch-enum -Wno-packed |
34 | CFLAGS += -Werror $(WARNINGS) $(KBUILD_HOSTCFLAGS) -g $(INCLUDES) | 37 | CFLAGS += -Werror $(WARNINGS) $(KBUILD_HOSTCFLAGS) -g $(INCLUDES) $(LIBELF_FLAGS) |
35 | LDFLAGS += -lelf $(LIBSUBCMD) $(KBUILD_HOSTLDFLAGS) | 38 | LDFLAGS += $(LIBELF_LIBS) $(LIBSUBCMD) $(KBUILD_HOSTLDFLAGS) |
36 | 39 | ||
37 | # Allow old libelf to be used: | 40 | # Allow old libelf to be used: |
38 | elfshdr := $(shell echo '$(pound)include <libelf.h>' | $(CC) $(CFLAGS) -x c -E - | grep elf_getshdr) | 41 | elfshdr := $(shell echo '$(pound)include <libelf.h>' | $(CC) $(CFLAGS) -x c -E - | grep elf_getshdr) |