On Dec 9, 2012, at 11:28 AM, Garrett Cooper wrote:

> On Sun, Dec 9, 2012 at 11:06 AM, Garrett Cooper <yaneg...@gmail.com> 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 majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to