* [PATCH] sparse, llvm: fix link errors
@ 2013-05-10 21:01 Xi Wang
2013-05-11 18:24 ` Christopher Li
0 siblings, 1 reply; 5+ messages in thread
From: Xi Wang @ 2013-05-10 21:01 UTC (permalink / raw)
To: sparse; +Cc: linux-sparse, Xi Wang, Pekka Enberg
This patch fixes the following link errors.
libLLVMSupport.a(Signals.o): In function `llvm::sys::PrintStackTrace(_IO_FILE*)':
Signals.inc:269: undefined reference to `dladdr'
Signals.inc:281: undefined reference to `dladdr'
Cc: Pekka Enberg <penberg@kernel.org>
Signed-off-by: Xi Wang <xi.wang@gmail.com>
---
Makefile | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Makefile b/Makefile
index 35e3801..4f53903 100644
--- a/Makefile
+++ b/Makefile
@@ -84,14 +84,14 @@ HAVE_LLVM=no
else
LLVM_PROGS := sparse-llvm
$(LLVM_PROGS): LD := g++
-LDFLAGS += $(shell llvm-config --ldflags)
+LLVM_LDFLAGS := $(shell llvm-config --ldflags)
LLVM_CFLAGS := $(shell llvm-config --cflags | sed -e "s/-DNDEBUG//g")
LLVM_LIBS := $(shell llvm-config --libs)
PROGRAMS += $(LLVM_PROGS)
INST_PROGRAMS += sparse-llvm sparsec
sparse-llvm_EXTRA_DEPS := sparse-llvm.o
sparse-llvm.o $(sparse-llvm_EXTRA_DEPS): BASIC_CFLAGS += $(LLVM_CFLAGS)
-sparse-llvm_EXTRA_OBJS := $(LLVM_LIBS)
+sparse-llvm_EXTRA_OBJS := $(LLVM_LIBS) $(LLVM_LDFLAGS)
endif
endif
--
1.8.1.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] sparse, llvm: fix link errors
2013-05-10 21:01 [PATCH] sparse, llvm: fix link errors Xi Wang
@ 2013-05-11 18:24 ` Christopher Li
2013-05-12 2:10 ` Xi Wang
0 siblings, 1 reply; 5+ messages in thread
From: Christopher Li @ 2013-05-11 18:24 UTC (permalink / raw)
To: Xi Wang; +Cc: linux-sparse, Pekka Enberg
On 05/10/2013 02:01 PM, Xi Wang wrote:
> This patch fixes the following link errors.
>
> libLLVMSupport.a(Signals.o): In function `llvm::sys::PrintStackTrace(_IO_FILE*)':
> Signals.inc:269: undefined reference to `dladdr'
> Signals.inc:281: undefined reference to `dladdr'
> -sparse-llvm_EXTRA_OBJS := $(LLVM_LIBS)
> +sparse-llvm_EXTRA_OBJS := $(LLVM_LIBS) $(LLVM_LDFLAGS)
The EXTRA_OBJS is only mean for real objects.
the LDFLAGS should be not belong to here.
I can't duplicate the link error myself.
It seems that you only want the LLVM_LDFLAGS apply to
sparse-llvm only.
Can you try this patch?
Thanks
Chris
diff --git a/Makefile b/Makefile
index 35e3801..549e669 100644
--- a/Makefile
+++ b/Makefile
@@ -84,7 +84,7 @@ HAVE_LLVM=no
else
LLVM_PROGS := sparse-llvm
$(LLVM_PROGS): LD := g++
-LDFLAGS += $(shell llvm-config --ldflags)
+$(LLVM_PROGS): LDFLAGS += $(shell llvm-config --ldflags)
LLVM_CFLAGS := $(shell llvm-config --cflags | sed -e "s/-DNDEBUG//g")
LLVM_LIBS := $(shell llvm-config --libs)
PROGRAMS += $(LLVM_PROGS)
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] sparse, llvm: fix link errors
2013-05-11 18:24 ` Christopher Li
@ 2013-05-12 2:10 ` Xi Wang
2013-05-15 10:09 ` Christopher Li
0 siblings, 1 reply; 5+ messages in thread
From: Xi Wang @ 2013-05-12 2:10 UTC (permalink / raw)
To: Christopher Li; +Cc: linux-sparse, Pekka Enberg
On 05/11/2013 02:24 PM, Christopher Li wrote:
> The EXTRA_OBJS is only mean for real objects.
> the LDFLAGS should be not belong to here.
>
> I can't duplicate the link error myself.
> It seems that you only want the LLVM_LDFLAGS apply to
> sparse-llvm only.
>
> Can you try this patch?
This doesn't work for me.
The problem is that -ldl (`llvm --ldflags`) must come _after_
-lLLVMSupport (`llvm --libs`).
Can we move LDFLAGS?
diff --git a/Makefile b/Makefile
index 35e3801..3cec8f0 100644
--- a/Makefile
+++ b/Makefile
@@ -84,7 +84,7 @@ HAVE_LLVM=no
else
LLVM_PROGS := sparse-llvm
$(LLVM_PROGS): LD := g++
-LDFLAGS += $(shell llvm-config --ldflags)
+$(LLVM_PROGS): LDFLAGS += $(shell llvm-config --ldflags)
LLVM_CFLAGS := $(shell llvm-config --cflags | sed -e "s/-DNDEBUG//g")
LLVM_LIBS := $(shell llvm-config --libs)
PROGRAMS += $(LLVM_PROGS)
@@ -173,7 +173,7 @@ compile_EXTRA_DEPS = compile-i386.o
$(foreach p,$(PROGRAMS),$(eval $(p): $($(p)_EXTRA_DEPS) $(LIBS)))
$(PROGRAMS): % : %.o
- $(QUIET_LINK)$(LD) $(LDFLAGS) -o $@ $^ $($@_EXTRA_OBJS)
+ $(QUIET_LINK)$(LD) -o $@ $^ $($@_EXTRA_OBJS) $(LDFLAGS)
$(LIB_FILE): $(LIB_OBJS)
$(QUIET_AR)$(AR) rcs $@ $(LIB_OBJS)
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] sparse, llvm: fix link errors
2013-05-12 2:10 ` Xi Wang
@ 2013-05-15 10:09 ` Christopher Li
2013-05-15 12:02 ` Pekka Enberg
0 siblings, 1 reply; 5+ messages in thread
From: Christopher Li @ 2013-05-15 10:09 UTC (permalink / raw)
To: Xi Wang; +Cc: linux-sparse, Pekka Enberg
On 05/11/2013 07:10 PM, Xi Wang wrote:
>
> This doesn't work for me.
>
> The problem is that -ldl (`llvm --ldflags`) must come _after_
> -lLLVMSupport (`llvm --libs`).
>
> Can we move LDFLAGS?
>
Sorry for the late reply.
In that case, your first patch is actually cleaner.
I apply your first patch instead. Change pushed.
BTW, Pekka, I notice that "sparse-llvm_EXTRA_DEPS" is redundant
with the next line, which also have sparse-llvm.o. Am I miss some
thing?
sparse-llvm_EXTRA_DEPS := sparse-llvm.o
sparse-llvm.o $(sparse-llvm_EXTRA_DEPS): BASIC_CFLAGS += $(LLVM_CFLAGS)
Chris
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] sparse, llvm: fix link errors
2013-05-15 10:09 ` Christopher Li
@ 2013-05-15 12:02 ` Pekka Enberg
0 siblings, 0 replies; 5+ messages in thread
From: Pekka Enberg @ 2013-05-15 12:02 UTC (permalink / raw)
To: Christopher Li; +Cc: Xi Wang, Sparse Mailing-list
On Wed, May 15, 2013 at 1:09 PM, Christopher Li <sparse@chrisli.org> wrote:
> BTW, Pekka, I notice that "sparse-llvm_EXTRA_DEPS" is redundant
> with the next line, which also have sparse-llvm.o. Am I miss some
> thing?
>
> sparse-llvm_EXTRA_DEPS := sparse-llvm.o
> sparse-llvm.o $(sparse-llvm_EXTRA_DEPS): BASIC_CFLAGS += $(LLVM_CFLAGS)
No, I you're not missing anything. Feel free to drop it.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-05-15 12:02 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-10 21:01 [PATCH] sparse, llvm: fix link errors Xi Wang
2013-05-11 18:24 ` Christopher Li
2013-05-12 2:10 ` Xi Wang
2013-05-15 10:09 ` Christopher Li
2013-05-15 12:02 ` Pekka Enberg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).