This also points out a problem with our CI loops in that they don't do test builds from installed copies of the ODP shared library.
On Thu, Mar 9, 2017 at 11:30 AM, Bill Fischofer <[email protected]> wrote: > Looks like you found a legit bug, however I'd fix this by adding an > ODP_VISIBLE macro and using that rather than directly using the > __attribute__ on this struct. That keeps things consistent with other ODP > indirect specification of attributes. > > On Wed, Mar 8, 2017 at 5:57 PM, Peltonen, Janne (Nokia - FI/Espoo) < > [email protected]> wrote: > >> Hi, >> >> I have hard time getting the following fine ODP application linked >> against the shared ODP library when ODP has been configured with >> --disable-abi-compat. It seems to me that the problem is in the >> 'local' binding of the _odp_packet_inline symbol in the .so, caused >> by the -fvisibility=hidden argument in the ODP compilation. >> >> $ cat test.c >> #include <odp_api.h> >> >> int main(void) >> { >> return !odp_packet_user_ptr(0); >> } >> >> $ gcc -pthread -I../ODP/include test.c -L../ODP/lib -lodp-linux >> /tmp/cc8GPUfA.o: In function `_odp_packet_user_ptr': >> test.c:(.text+0xb): undefined reference to `_odp_packet_inline' >> collect2: error: ld returned 1 exit status >> Makefile:10: recipe for target 'dynamic2' failed >> make: *** [dynamic2] Error 1 >> >> $ objdump -t ../ODP/lib/libodp-linux.so | grep _odp_packet_inline >> 000000000003b040 l O .rodata 0000000000000070 >> _odp_packet_inline >> >> Linking statically works. In the archive the symbol is global, >> although marked hidden: >> >> $ objdump -t ../ODP/lib/libodp-linux.a | grep 'rodata.*_odp_packet_inline' >> 0000000000000080 g O .rodata 0000000000000070 .hidden >> _odp_packet_inline >> >> I have no idea what the right fix is, but I got things working >> with this: >> >> diff --git a/platform/linux-generic/odp_packet.c >> b/platform/linux-generic/odp_packet.c >> index 60eef3a..10a99ca 100644 >> --- a/platform/linux-generic/odp_packet.c >> +++ b/platform/linux-generic/odp_packet.c >> @@ -25,7 +25,7 @@ >> #define BASE_LEN CONFIG_PACKET_MAX_SEG_LEN >> >> /* Fill in packet header field offsets for inline functions */ >> -const _odp_packet_inline_offset_t _odp_packet_inline ODP_ALIGNED_CACHE = >> { >> +const _odp_packet_inline_offset_t _odp_packet_inline ODP_ALIGNED_CACHE >> __attribute__ ((visibility ("default"))) = { >> .data = offsetof(odp_packet_hdr_t, buf_hdr.seg[0].data), >> .seg_len = offsetof(odp_packet_hdr_t, buf_hdr.seg[0].len), >> .frame_len = offsetof(odp_packet_hdr_t, frame_len), >> >> >> After this patch: >> $ objdump -t ../ODP/lib/libodp-linux.so | grep _odp_packet_inline >> 000000000003b080 g O .rodata 0000000000000070 >> _odp_packet_inline >> >> So, should this now be fixed in ODP or should I do something >> differently when compiling and linking ODP apps against ODP >> without ABI compatibility? >> >> Janne >> >> >> >
