linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Xi Wang <xi.wang@gmail.com>
To: Christopher Li <sparse@chrisli.org>
Cc: linux-sparse@vger.kernel.org, Pekka Enberg <penberg@kernel.org>
Subject: Re: [PATCH] sparse, llvm: fix link errors
Date: Sat, 11 May 2013 22:10:24 -0400	[thread overview]
Message-ID: <518EFA10.6040108@gmail.com> (raw)
In-Reply-To: <518E8CEE.6060001@chrisli.org>

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)

  reply	other threads:[~2013-05-12  2:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2013-05-15 10:09     ` Christopher Li
2013-05-15 12:02       ` Pekka Enberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=518EFA10.6040108@gmail.com \
    --to=xi.wang@gmail.com \
    --cc=linux-sparse@vger.kernel.org \
    --cc=penberg@kernel.org \
    --cc=sparse@chrisli.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).