From: Garrett Cooper <yanegomi-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Bart Van Assche <bvanassche-HInyCGIudOg@public.gmane.org>
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH 3/3] Avoid linker error with clang 3.0
Date: Sun, 9 Dec 2012 13:47:03 -0800 [thread overview]
Message-ID: <ABB9B291-3AB5-4AE6-8CE2-5FE691E1AE02@gmail.com> (raw)
In-Reply-To: <CAGH67wQt48zEp0KiN44w=wfYZy+FA6oc=ehuAHUL2QBo=A1nhw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
On Dec 9, 2012, at 11:28 AM, Garrett Cooper wrote:
> On Sun, Dec 9, 2012 at 11:06 AM, Garrett Cooper <yanegomi-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> ...
>
> It's still an issue with clang 3.2; going to file a bug upstream,
> but the attached patch allows the linker stage to go through properly.
> Thanks,
> -Garrett
>
> # clang -o /root/test_inline /root/test_inline.c
> /tmp/test_inline-JRJ1GD.o: In function `foo':
> /root/test_inline.c:(.text+0x36): undefined reference to `bar'
> /root/test_inline.c:(.text+0x5f): undefined reference to `bar'
> /root/test_inline.c:(.text+0x88): undefined reference to `bar'
> /root/test_inline.c:(.text+0xb1): undefined reference to `bar'
> clang: error: linker command failed with exit code 1 (use -v to see invocation)
> # clang
> clang clang++ clang-cpp clang-tblgen
> # clang --version
> FreeBSD clang version 3.2 (branches/release_32 168974) 20121130
> Target: i386-unknown-freebsd10.0
> Thread model: posix
> # cat /root/test_inline.c
> #include <stdio.h>
>
> inline int
> bar(int i)
> {
>
> return (42 < i && i < 84 ? i : -1);
> }
>
> static void
> foo(void)
> {
>
> printf("-4: %d\n", bar(-4));
> printf("41: %d\n", bar(41));
> printf("43: %d\n", bar(43));
> printf("85: %d\n", bar(85));
> }
>
> int
> main(void)
> {
>
> foo();
> return (0);
> }
After talking with some other more knowledgeable people than myself, it looks like opensm is depending upon gcc inline behavior: http://freebsd.1045724.n5.nabble.com/C99-inlines-td4157849.html , http://wiki.freebsd.org/PortsAndClang (look for "undefined or duplicate symbols while linking"). The previously attached patch should be ok for dealing with the linking problem as it just changes the scoping. Definitely learned a few things today about gcc :).
Thanks,
-Garrett--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2012-12-09 21:47 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-09 11:07 [PATCH 3/3] Avoid linker error with clang 3.0 Garrett Cooper
[not found] ` <alpine.BSF.2.00.1212090306300.64779-Fqwm7F1mg36Nj9Bq2fkWzw@public.gmane.org>
2012-12-09 13:23 ` Bart Van Assche
[not found] ` <50C490D9.1000301-HInyCGIudOg@public.gmane.org>
2012-12-09 19:06 ` Garrett Cooper
[not found] ` <CAGH67wS1P43ssD+-VFyCupLw3CT8U73wT-aT6N2AS5ddWApAoA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-12-09 19:28 ` Garrett Cooper
[not found] ` <CAGH67wQt48zEp0KiN44w=wfYZy+FA6oc=ehuAHUL2QBo=A1nhw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-12-09 21:47 ` Garrett Cooper [this message]
[not found] ` <ABB9B291-3AB5-4AE6-8CE2-5FE691E1AE02-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-12-10 6:06 ` Jason Gunthorpe
[not found] ` <20121210060600.GA30472-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2012-12-10 6:12 ` Garrett Cooper
[not found] ` <CAGH67wQ9ER9JLHR9ZKmzwMaGuV4m_5LdsHbKZvfYw1ekojik2Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-12-11 10:08 ` Garrett Cooper
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=ABB9B291-3AB5-4AE6-8CE2-5FE691E1AE02@gmail.com \
--to=yanegomi-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
--cc=bvanassche-HInyCGIudOg@public.gmane.org \
--cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.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