All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jonathan Neuschäfer" <j.neuschaefer@gmx.net>
To: Pekka Enberg <penberg@kernel.org>
Cc: linux-sparse@vger.kernel.org, j.neuschaefer@gmx.net,
	Christopher Li <sparse@chrisli.org>,
	Jeff Garzik <jgarzik@redhat.com>,
	Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: [PATCH] sparse, llvm: Fix SIGSEGV for extern symbols
Date: Sun, 19 Aug 2012 02:41:14 +0200	[thread overview]
Message-ID: <20120819004114.GC2880@debian.debian> (raw)
In-Reply-To: <1344196054-17208-1-git-send-email-penberg@kernel.org>

On Sun, Aug 05, 2012 at 10:47:34PM +0300, Pekka Enberg wrote:
> Jonathan Neuschäfer writes:
> 
>   compiling a little real-world program with sparse-llvm, it segfaulted.
>   Using a tool called "delta"[1] and some bash scripting, I managed to
>   reduce the code to this test case:
> 
>     extern struct foo *foop;
>     extern void func(struct foo *f);
>     int main(int argc, char **argv) {
>         func(foop);
>     }
> 
> The problem is that pseudo_to_value() does not know abou the extern
> symbol because Sparse never calls output_data() on it which registers
> globals with LLVMAddGlobal().
> 
> As explained by Linus, 'extern' symbols are just names with types. They
> don't have any value associated with them, they just have the type and
> the name. Therefore we need to explicitly call LLVMAddGlobal() for
> symbols we have not encountered in pseudo_to_value().
> 
> Reported by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
> Cc: Christopher Li <sparse@chrisli.org>
> Cc: Jeff Garzik <jgarzik@redhat.com>
> Cc: Linus Torvalds <torvalds@linux-foundation.org>
> Signed-off-by: Pekka Enberg <penberg@kernel.org>

This fixes the crash, thanks.

Jonathan
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

      reply	other threads:[~2012-08-19  0:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-05 19:47 [PATCH] sparse, llvm: Fix SIGSEGV for extern symbols Pekka Enberg
2012-08-19  0:41 ` Jonathan Neuschäfer [this message]

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=20120819004114.GC2880@debian.debian \
    --to=j.neuschaefer@gmx.net \
    --cc=jgarzik@redhat.com \
    --cc=linux-sparse@vger.kernel.org \
    --cc=penberg@kernel.org \
    --cc=sparse@chrisli.org \
    --cc=torvalds@linux-foundation.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.