Linking problem with lld

classic Classic list List threaded Threaded
15 messages Options
Reply | Threaded
Open this post in threaded view
|

Linking problem with lld

Willem Jan Withagen-2
Hi Ed ea,

In het ceph project, they started to use library versioning, so it seems.

But compiling/linking that now with Clang and lld I run into trouble
building the ceph-tools.

This is what I get back of one of the Devs:
--------------
My guess is that your linker doesn't support the new symbol versioning
exports and since the symbols are hidden by default they aren't visible
in the shared library. Previously there was a bug (since Luminous and
the switch the cmake) where every public and private symbol was exported
by librados.

We just need to know the magic words to use for your compiler/linker to
change the symbol visibility to public for the API methods.

--------------

Now I looked thru the options on both Clang and lld, but nothing
obviously springs into focus, as to add to change....

This is how librados is build:
  /usr/bin/c++ -fPIC  -Wall -Wtype-limits -Wignored-qualifiers
-Winit-self -Wpointer-arith -Werror=format-security -fno-strict-aliasing
-fsigned-char -Wno-unknown-pragmas -Wno-unused-function
-Wno-unused-local-typedef -Wno-varargs -Wno-gnu-designator
-Wno-missing-braces -Wno-parentheses -Wno-deprecated-register
-ftemplate-depth-1024 -Wnon-virtual-dtor -Wno-unknown-pragmas
-Wno-ignored-qualifiers -Wno-inconsistent-missing-override
-Wno-mismatched-tags -Wno-unused-private-field
-Wno-address-of-packed-member -DCEPH_DEBUG_MUTEX
-fdiagnostics-color=auto -fno-builtin-malloc -fno-builtin-calloc
-fno-builtin-realloc -fno-builtin-free  -O0 -g
-Wno-unused-command-line-argument -fuse-ld=/usr/bin/ld.lld
-Wl,--exclude-libs,ALL
-Wl,--version-script=/home/jenkins/workspace/ceph-master/src/librados/librados.map
-shared -Wl,-soname,librados.so.2 -o ../../lib/librados.so.2.0.0
CMakeFiles/librados.dir/librados_c.cc.o
CMakeFiles/librados.dir/librados_cxx.cc.o
../common/CMakeFiles/common_buffer_obj.dir/buffer.cc.o  -L/usr/local/lib
-Wl,-rpath,/usr/local/lib:/home/jenkins/workspace/ceph-master/build/lib:/usr/local/lib/nss:
../../lib/liblibrados_impl.a ../../lib/libosdc.a
../../lib/libceph-common.so.0 ../../lib/libcls_lock_client.a
/usr/local/lib/nss/libssl3.so /usr/local/lib/nss/libsmime3.so
/usr/local/lib/nss/libnss3.so /usr/local/lib/nss/libnssutil3.so
/usr/local/lib/libplds4.so /usr/local/lib/libplc4.so
/usr/local/lib/libnspr4.so /usr/local/lib/libcrypto.so -lrt
../../lib/libjson_spirit.a ../../lib/libcommon_utf8.a
../../lib/liberasure_code.a ../../lib/libcrc32.a ../../lib/libarch.a
/usr/local/lib/libboost_thread.so /usr/local/lib/libboost_chrono.so
/usr/local/lib/libboost_atomic.so /usr/local/lib/libboost_random.so
/usr/local/lib/libboost_system.so
/usr/local/lib/libboost_program_options.so
/usr/local/lib/libboost_date_time.so
/usr/local/lib/libboost_iostreams.so /usr/local/lib/libboost_regex.so
/usr/lib/libexecinfo.so /usr/local/lib/nss/libssl3.so
/usr/local/lib/nss/libsmime3.so /usr/local/lib/nss/libnss3.so
/usr/local/lib/nss/libnssutil3.so /usr/local/lib/libplds4.so
/usr/local/lib/libplc4.so /usr/local/lib/libnspr4.so -lpthread

Any suggestions on getting the hidden symbols to reapear is greatly
appriciated.

--WjW
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-toolchain
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: Linking problem with lld

Ed Maste-2
On Fri, 22 Feb 2019 at 10:09, Willem Jan Withagen <[hidden email]> wrote:
>
> My guess is that your linker doesn't support the new symbol versioning
> exports and since the symbols are hidden by default they aren't visible
> in the shared library. Previously there was a bug (since Luminous and
> the switch the cmake) where every public and private symbol was exported
> by librados.

lld is largely compatible with GNU ld / gold on the command-line and
in linker scripts and version scripts. Can you provide the error you
see or an example of one of the symbols with incorrect visibility?
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-toolchain
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: Linking problem with lld

Willem Jan Withagen-2
On 22-2-2019 21:09, Ed Maste wrote:
> On Fri, 22 Feb 2019 at 10:09, Willem Jan Withagen <[hidden email]> wrote:
>> My guess is that your linker doesn't support the new symbol versioning
>> exports and since the symbols are hidden by default they aren't visible
>> in the shared library. Previously there was a bug (since Luminous and
>> the switch the cmake) where every public and private symbol was exported
>> by librados.
> lld is largely compatible with GNU ld / gold on the command-line and
> in linker scripts and version scripts. Can you provide the error you
> see or an example of one of the symbols with incorrect visibility?

It could very be that the way versioning is introduced in the project is
not compatible with Clang, since the general compiler used is GCC.

I was afraid that that was going to be the counter question?? 8-(
This occurs while building Ceph, which is a "rather" large package
with a lot of include subpackages... and some local patches for things
that have not been send upstream.

But lets start with the error reported:

ld.lld: error: undefined symbol: rados_aio_get_return_value
referenced by cls_journal_client.cc:29
(/home/jenkins/workspace/ceph-master/src/cls/journal/cls_journal_client.cc:29)
cls_journal_client.cc.o:(cls::journal::client::(anonymous
namespace)::C_AioExec::rados_callback(void*, void*)) in archive
../../../lib/libcls_journal_client.a
c++: error: linker command failed with exit code 1 (use -v to see
invocation)
gmake[2]: ***
[src/test/cls_journal/CMakeFiles/ceph_test_cls_journal.dir/build.make:129:
bin/ceph_test_cls_journal] Error 1
gmake[2]: Leaving directory '/home/jenkins/workspace/ceph-master/build'
gmake[1]: *** [CMakeFiles/Makefile2:11020:
src/test/cls_journal/CMakeFiles/ceph_test_cls_journal.dir/all] Error 2

===========

Not sure what you can make of this.

--WjW
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-toolchain
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: Linking problem with lld

Tijl Coosemans
In reply to this post by Willem Jan Withagen-2
On Fri, 22 Feb 2019 16:09:09 +0100 Willem Jan Withagen <[hidden email]>
wrote:

> Hi Ed ea,
>
> In het ceph project, they started to use library versioning, so it seems.
>
> But compiling/linking that now with Clang and lld I run into trouble
> building the ceph-tools.
>
> This is what I get back of one of the Devs:
> --------------
> My guess is that your linker doesn't support the new symbol versioning
> exports and since the symbols are hidden by default they aren't visible
> in the shared library. Previously there was a bug (since Luminous and
> the switch the cmake) where every public and private symbol was exported
> by librados.
>
> We just need to know the magic words to use for your compiler/linker to
> change the symbol visibility to public for the API methods.
>
> --------------
>
> Now I looked thru the options on both Clang and lld, but nothing
> obviously springs into focus, as to add to change....
>
> This is how librados is build:
>   /usr/bin/c++ -fPIC  -Wall -Wtype-limits -Wignored-qualifiers
> -Winit-self -Wpointer-arith -Werror=format-security -fno-strict-aliasing
> -fsigned-char -Wno-unknown-pragmas -Wno-unused-function
> -Wno-unused-local-typedef -Wno-varargs -Wno-gnu-designator
> -Wno-missing-braces -Wno-parentheses -Wno-deprecated-register
> -ftemplate-depth-1024 -Wnon-virtual-dtor -Wno-unknown-pragmas
> -Wno-ignored-qualifiers -Wno-inconsistent-missing-override
> -Wno-mismatched-tags -Wno-unused-private-field
> -Wno-address-of-packed-member -DCEPH_DEBUG_MUTEX
> -fdiagnostics-color=auto -fno-builtin-malloc -fno-builtin-calloc
> -fno-builtin-realloc -fno-builtin-free  -O0 -g
> -Wno-unused-command-line-argument -fuse-ld=/usr/bin/ld.lld
> -Wl,--exclude-libs,ALL
> -Wl,--version-script=/home/jenkins/workspace/ceph-master/src/librados/librados.map

Can you provide this librados.map file?
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-toolchain
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: Linking problem with lld

Willem Jan Withagen-2
On 22-2-2019 22:34, Tijl Coosemans wrote:

> On Fri, 22 Feb 2019 16:09:09 +0100 Willem Jan Withagen <[hidden email]>
> wrote:
>> Hi Ed ea,
>>
>> In het ceph project, they started to use library versioning, so it seems.
>>
>> But compiling/linking that now with Clang and lld I run into trouble
>> building the ceph-tools.
>>
>> This is what I get back of one of the Devs:
>> --------------
>> My guess is that your linker doesn't support the new symbol versioning
>> exports and since the symbols are hidden by default they aren't visible
>> in the shared library. Previously there was a bug (since Luminous and
>> the switch the cmake) where every public and private symbol was exported
>> by librados.
>>
>> We just need to know the magic words to use for your compiler/linker to
>> change the symbol visibility to public for the API methods.
>>
>> --------------
>>
>> Now I looked thru the options on both Clang and lld, but nothing
>> obviously springs into focus, as to add to change....
>>
>> This is how librados is build:
>>    /usr/bin/c++ -fPIC  -Wall -Wtype-limits -Wignored-qualifiers
>> -Winit-self -Wpointer-arith -Werror=format-security -fno-strict-aliasing
>> -fsigned-char -Wno-unknown-pragmas -Wno-unused-function
>> -Wno-unused-local-typedef -Wno-varargs -Wno-gnu-designator
>> -Wno-missing-braces -Wno-parentheses -Wno-deprecated-register
>> -ftemplate-depth-1024 -Wnon-virtual-dtor -Wno-unknown-pragmas
>> -Wno-ignored-qualifiers -Wno-inconsistent-missing-override
>> -Wno-mismatched-tags -Wno-unused-private-field
>> -Wno-address-of-packed-member -DCEPH_DEBUG_MUTEX
>> -fdiagnostics-color=auto -fno-builtin-malloc -fno-builtin-calloc
>> -fno-builtin-realloc -fno-builtin-free  -O0 -g
>> -Wno-unused-command-line-argument -fuse-ld=/usr/bin/ld.lld
>> -Wl,--exclude-libs,ALL
>> -Wl,--version-script=/home/jenkins/workspace/ceph-master/src/librados/librados.map
> Can you provide this librados.map file?
https://github.com/ceph/ceph/blob/master/src/librados/librados.map:
------
LIBRADOS_PRIVATE {
         local:  *;
};

LIBRADOS_14.2.0 {
         global:
                 extern "C++" {
                         ceph::buffer::v14_2_0::*;
                         librados::v14_2_0::*;

                         "typeinfo for librados::v14_2_0::ObjectOperation";
                         "typeinfo name for
librados::v14_2_0::ObjectOperation";
                         "vtable for librados::v14_2_0::ObjectOperation";

                         "typeinfo for
librados::v14_2_0::ObjectReadOperation";
                         "typeinfo name for
librados::v14_2_0::ObjectReadOperation";
                         "vtable for
librados::v14_2_0::ObjectReadOperation";

                         "typeinfo for
librados::v14_2_0::ObjectWriteOperation";
                         "typeinfo name for
librados::v14_2_0::ObjectWriteOperation";
                         "vtable for
librados::v14_2_0::ObjectWriteOperation";

                         "typeinfo for librados::v14_2_0::WatchCtx";
                         "typeinfo name for librados::v14_2_0::WatchCtx";
                         "vtable for librados::v14_2_0::WatchCtx";

                         "typeinfo for librados::v14_2_0::WatchCtx2";
                         "typeinfo name for librados::v14_2_0::WatchCtx2";
                         "vtable for librados::v14_2_0::WatchCtx2";
                 };
} LIBRADOS_PRIVATE;
------
--WjW

_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-toolchain
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: Linking problem with lld

Willem Jan Withagen-2
On 22-2-2019 23:47, Willem Jan Withagen wrote:

> On 22-2-2019 22:34, Tijl Coosemans wrote:
>> On Fri, 22 Feb 2019 16:09:09 +0100 Willem Jan Withagen <[hidden email]>
>> wrote:
>>> Hi Ed ea,
>>>
>>> In het ceph project, they started to use library versioning, so it
>>> seems.
>>>
>>> But compiling/linking that now with Clang and lld I run into trouble
>>> building the ceph-tools.
>>>
>>> This is what I get back of one of the Devs:
>>> --------------
>>> My guess is that your linker doesn't support the new symbol versioning
>>> exports and since the symbols are hidden by default they aren't visible
>>> in the shared library. Previously there was a bug (since Luminous and
>>> the switch the cmake) where every public and private symbol was
>>> exported
>>> by librados.
>>>
>>> We just need to know the magic words to use for your compiler/linker to
>>> change the symbol visibility to public for the API methods.
>>>
>>> --------------
>>>
>>> Now I looked thru the options on both Clang and lld, but nothing
>>> obviously springs into focus, as to add to change....
>>>
>>> This is how librados is build:
>>>    /usr/bin/c++ -fPIC  -Wall -Wtype-limits -Wignored-qualifiers
>>> -Winit-self -Wpointer-arith -Werror=format-security
>>> -fno-strict-aliasing
>>> -fsigned-char -Wno-unknown-pragmas -Wno-unused-function
>>> -Wno-unused-local-typedef -Wno-varargs -Wno-gnu-designator
>>> -Wno-missing-braces -Wno-parentheses -Wno-deprecated-register
>>> -ftemplate-depth-1024 -Wnon-virtual-dtor -Wno-unknown-pragmas
>>> -Wno-ignored-qualifiers -Wno-inconsistent-missing-override
>>> -Wno-mismatched-tags -Wno-unused-private-field
>>> -Wno-address-of-packed-member -DCEPH_DEBUG_MUTEX
>>> -fdiagnostics-color=auto -fno-builtin-malloc -fno-builtin-calloc
>>> -fno-builtin-realloc -fno-builtin-free  -O0 -g
>>> -Wno-unused-command-line-argument -fuse-ld=/usr/bin/ld.lld
>>> -Wl,--exclude-libs,ALL
>>> -Wl,--version-script=/home/jenkins/workspace/ceph-master/src/librados/librados.map
>>>
>> Can you provide this librados.map file?
> https://github.com/ceph/ceph/blob/master/src/librados/librados.map:
> ------
> LIBRADOS_PRIVATE {
>         local:  *;
> };
>
> LIBRADOS_14.2.0 {
>         global:
>                 extern "C++" {
>                         ceph::buffer::v14_2_0::*;
>                         librados::v14_2_0::*;
>
>                         "typeinfo for
> librados::v14_2_0::ObjectOperation";
>                         "typeinfo name for
> librados::v14_2_0::ObjectOperation";
>                         "vtable for librados::v14_2_0::ObjectOperation";
>
>                         "typeinfo for
> librados::v14_2_0::ObjectReadOperation";
>                         "typeinfo name for
> librados::v14_2_0::ObjectReadOperation";
>                         "vtable for
> librados::v14_2_0::ObjectReadOperation";
>
>                         "typeinfo for
> librados::v14_2_0::ObjectWriteOperation";
>                         "typeinfo name for
> librados::v14_2_0::ObjectWriteOperation";
>                         "vtable for
> librados::v14_2_0::ObjectWriteOperation";
>
>                         "typeinfo for librados::v14_2_0::WatchCtx";
>                         "typeinfo name for librados::v14_2_0::WatchCtx";
>                         "vtable for librados::v14_2_0::WatchCtx";
>
>                         "typeinfo for librados::v14_2_0::WatchCtx2";
>                         "typeinfo name for librados::v14_2_0::WatchCtx2";
>                         "vtable for librados::v14_2_0::WatchCtx2";
>                 };
> } LIBRADOS_PRIVATE;
> ------
> --WjW
>

Still haven't been able to work this out, I know a bit more about
versioning but I'n not sure that the way selected in Ceph is working for
FreeBSD.
I've collected most of the essentials below I hope.

--WjW

So the test program is simple enough:
====
#include "include/rados/librados.h"

#include "gtest/gtest.h"

TEST(Librados, CreateShutdown) {
   rados_t cluster;
   int err;
   err = rados_create(&cluster, "someid");
   EXPECT_EQ(err, 0);

   rados_shutdown(cluster);
}
====


librados is big, but in summary the releavant parts are:
====
#ifdef __cplusplus
extern "C" {
#endif
.....
#define CEPH_RADOS_API
.....
CEPH_RADOS_API int rados_create(rados_t *cluster, const char * const id);
CEPH_RADOS_API void rados_shutdown(rados_t cluster);

#ifdef __cplusplus
}
#endif
====

And in the implementation of librados in `librados_c.cc` it looks like:
====
....
#define LIBRADOS_C_API_BASE(fn)               \
   asm(".symver _" #fn "_base, " #fn "@")
#define LIBRADOS_C_API_BASE_DEFAULT(fn)       \
   asm(".symver _" #fn ", " #fn "@@")
#define LIBRADOS_C_API_DEFAULT(fn, ver)       \
   asm(".symver _" #fn ", " #fn "@@LIBRADOS_" #ver)

extern "C" int _rados_create(rados_t *pcluster, const char * const id)
{
.......
}
LIBRADOS_C_API_BASE_DEFAULT(rados_create);

extern "C" void _rados_shutdown(rados_t cluster)
{
.......
}
LIBRADOS_C_API_BASE_DEFAULT(rados_shutdown);
====

Then this is the Cmake receipe to bolt it all together into
librados.so.2.0.0:
====
# C/C++ API
add_library(librados ${CEPH_SHARED}
   librados_c.cc
   librados_cxx.cc
   $<TARGET_OBJECTS:common_buffer_obj>)
if(ENABLE_SHARED)
   set_target_properties(librados PROPERTIES
     OUTPUT_NAME rados
     VERSION 2.0.0
     SOVERSION 2
     VISIBILITY_INLINES_HIDDEN ON)
   if(NOT APPLE)
     set_property(TARGET librados APPEND_STRING PROPERTY
       LINK_FLAGS " -Wl,--exclude-libs,ALL")
     set_property(TARGET librados APPEND_STRING PROPERTY
       LINK_FLAGS "
-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/librados.map")
   endif()
   if(WITH_STATIC_LIBSTDCXX)
     set_property(TARGET librados APPEND_STRING PROPERTY
       LINK_FLAGS " -static-libstdc++ -static-libgcc")
   endif()
endif()
target_link_libraries(librados PRIVATE
   librados_impl osdc ceph-common cls_lock_client
   ${BLKID_LIBRARIES} ${CRYPTO_LIBS} ${EXTRALIBS} ${GSSAPI_LIBRARIES})
install(TARGETS librados DESTINATION ${CMAKE_INSTALL_LIBDIR})
=====

Now if I look in librados.so for rados_create that gives:
====
 > objdump -t librados.so.2.0.0 | grep rados_create
000000000008a430 l     F .text  00000000000000a6
_ZL16rados_create_cctPKcP18CephInitParameters
000000000008a250 l     F .text  00000000000001df _rados_create
000000000008a4e0 l     F .text  000000000000028d _rados_create2
000000000009f490 l     F .text  00000000000000a4 _rados_create_read_op
000000000008a770 l     F .text  0000000000000085 _rados_create_with_context
000000000009dab0 l     F .text  00000000000000a4 _rados_create_write_op
000000000008a4e0 l     F .text  000000000000028d rados_create2
000000000008a250 l     F .text  00000000000001df rados_create
000000000009f490 l     F .text  00000000000000a4 rados_create_read_op
000000000008a770 l     F .text  0000000000000085 rados_create_with_context
000000000009dab0 l     F .text  00000000000000a4 rados_create_write_op
====

So now I'm sort of baffled why linking does not work:
====
/usr/bin/c++   -Wall -Wtype-limits -Wignored-qualifiers -Winit-self
-Wpointer-arith -Werror=format-security -fno-strict-aliasing
-fsigned-char -Wno-unknown-pragmas -Wno-unused-function
-Wno-unused-local-typedef -Wno-varargs -Wno-gnu-designator
-Wno-missing-braces -Wno-parentheses -Wno-deprecated-register 
-ftemplate-depth-1024 -Wnon-virtual-dtor -Wno-unknown-pragmas
-Wno-ignored-qualifiers -Wno-inconsistent-missing-override
-Wno-mismatched-tags -Wno-unused-private-field
-Wno-address-of-packed-member -DCEPH_DEBUG_MUTEX
-fdiagnostics-color=auto -fno-builtin-malloc -fno-builtin-calloc
-fno-builtin-realloc -fno-builtin-free  -O0 -g
-Wno-unused-command-line-argument  -Wl,--export-dynamic
CMakeFiles/unittest_librados.dir/librados.cc.o  -o
../../../bin/unittest_librados  -L/usr/local/lib
-Wl,-rpath,/usr/local/lib:/home/jenkins/workspace/ceph-master/build/lib
../../../lib/libgmock_main.a ../../../lib/libgmock.a
../../../lib/libgtest.a -lpthread /usr/local/lib/libldap.so
/usr/local/lib/liblber.so ../../../lib/librados.so.2.0.0
/usr/local/lib/libldap.so /usr/local/lib/liblber.so
ld: error: undefined symbol: rados_create
 >>> referenced by librados.cc:9
(/home/jenkins/workspace/ceph-master/src/test/librados/librados.cc:9)
 >>>
CMakeFiles/unittest_librados.dir/librados.cc.o:(Librados_CreateShutdown_Test::TestBody())

ld: error: undefined symbol: rados_shutdown
 >>> referenced by librados.cc:12
(/home/jenkins/workspace/ceph-master/src/test/librados/librados.cc:12)
 >>>
CMakeFiles/unittest_librados.dir/librados.cc.o:(Librados_CreateShutdown_Test::TestBody())
c++: error: linker command failed with exit code 1 (use -v to see
invocation)

====





_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-toolchain
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: Linking problem with lld

Tijl Coosemans
On Sat, 2 Mar 2019 14:21:57 +0100 Willem Jan Withagen <[hidden email]>
wrote:
> Now if I look in librados.so for rados_create that gives:
> ====
>  > objdump -t librados.so.2.0.0 | grep rados_create

You want to look at dynamic symbols so "objdump -T".
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-toolchain
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: Linking problem with lld

Willem Jan Withagen-2
On 2-3-2019 16:21, Tijl Coosemans wrote:
> On Sat, 2 Mar 2019 14:21:57 +0100 Willem Jan Withagen <[hidden email]>
> wrote:
>> Now if I look in librados.so for rados_create that gives:
>> ====
>>   > objdump -t librados.so.2.0.0 | grep rados_create
> You want to look at dynamic symbols so "objdump -T".
Right, that list is empty.

So I'm wondering what I can do to get them in that list.

--WjW

_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-toolchain
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: Linking problem with lld

Willem Jan Withagen-2
In reply to this post by Tijl Coosemans
On 2-3-2019 16:21, Tijl Coosemans wrote:
> On Sat, 2 Mar 2019 14:21:57 +0100 Willem Jan Withagen <[hidden email]>
> wrote:
>> Now if I look in librados.so for rados_create that gives:
>> ====
>>   > objdump -t librados.so.2.0.0 | grep rados_create
> You want to look at dynamic symbols so "objdump -T".
Could it be that the objectfile already has something "wrong"to start with?

[~/master] [hidden email]> objdump -t
./build/src/librados/CMakeFiles/librados.dir/librados_c.cc.o | grep
rados_create
00000000000003b0 l     F .text  00000000000000a6
_ZL16rados_create_cctPKcP18CephInitParameters
00000000000001d0 g     F .text  00000000000001df _rados_create
0000000000000460 g     F .text  000000000000028d _rados_create2
0000000000015410 g     F .text  00000000000000a4 _rados_create_read_op
00000000000006f0 g     F .text  0000000000000085 _rados_create_with_context
0000000000013a30 g     F .text  00000000000000a4 _rados_create_write_op
0000000000000460 g     F .text  000000000000028d rados_create2@@
00000000000001d0 g     F .text  00000000000001df rados_create@@
0000000000015410 g     F .text  00000000000000a4 rados_create_read_op@@
00000000000006f0 g     F .text  0000000000000085 rados_create_with_context@@
0000000000013a30 g     F .text  00000000000000a4 rados_create_write_op@@
[~/master] [hidden email]> objdump -T
./build/src/librados/CMakeFiles/librados.dir/librados_c.cc.o | grep
rados_create
objdump: ./build/src/librados/CMakeFiles/librados.dir/librados_c.cc.o:
not a dynamic object
Exit 1

--WjW

_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-toolchain
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: Linking problem with lld

Tijl Coosemans
In reply to this post by Willem Jan Withagen-2
On Sat, 2 Mar 2019 17:49:25 +0100 Willem Jan Withagen <[hidden email]>
wrote:

> On 2-3-2019 16:21, Tijl Coosemans wrote:
>> On Sat, 2 Mar 2019 14:21:57 +0100 Willem Jan Withagen <[hidden email]>
>> wrote:
>>> Now if I look in librados.so for rados_create that gives:
>>> ====
>>>   > objdump -t librados.so.2.0.0 | grep rados_create
>> You want to look at dynamic symbols so "objdump -T".
> Right, that list is empty.
>
> So I'm wondering what I can do to get them in that list.

Try the command that creates librados.so.2.0.0 without the
--version-script argument.
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-toolchain
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: Linking problem with lld

Willem Jan Withagen-2
On 2-3-2019 18:35, Tijl Coosemans wrote:

> On Sat, 2 Mar 2019 17:49:25 +0100 Willem Jan Withagen <[hidden email]>
> wrote:
>> On 2-3-2019 16:21, Tijl Coosemans wrote:
>>> On Sat, 2 Mar 2019 14:21:57 +0100 Willem Jan Withagen <[hidden email]>
>>> wrote:
>>>> Now if I look in librados.so for rados_create that gives:
>>>> ====
>>>>    > objdump -t librados.so.2.0.0 | grep rados_create
>>> You want to look at dynamic symbols so "objdump -T".
>> Right, that list is empty.
>>
>> So I'm wondering what I can do to get them in that list.
> Try the command that creates librados.so.2.0.0 without the
> --version-script argument.

Right, When I see the output, I know I tried that before. But then the
versioning goes
wrong, I think...
Might need to rewrite the map-file?

--WjW

[ 43%] Linking CXX shared library ../../lib/librados.so
cd /home/jenkins/workspace/ceph-master/build/src/librados &&
/usr/local/bin/cmake -E cmake_link_script
CMakeFiles/librados.dir/link.txt --verbose=1
ccache /usr/bin/c++ -fPIC  -Wall -Wtype-limits -Wignored-qualifiers
-Winit-self -Wpointer-arith -Werror=format-security -fno-strict-aliasing
-fsigned-char -Wno-unknown-pragmas -Wno-unused-function
-Wno-unused-local-typedef -Wno-varargs -Wno-gnu-designator
-Wno-missing-braces -Wno-parentheses -Wno-deprecated-register
-ftemplate-depth-1024 -Wnon-virtual-dtor -Wno-unknown-pragmas
-Wno-ignored-qualifiers -Wno-inconsistent-missing-override
-Wno-mismatched-tags -Wno-unused-private-field
-Wno-address-of-packed-member -DCEPH_DEBUG_MUTEX
-fdiagnostics-color=auto -fno-builtin-malloc -fno-builtin-calloc
-fno-builtin-realloc -fno-builtin-free  -O0 -g -fvisibility=default 
-Wl,--exclude-libs,ALL -shared -Wl,-soname,librados.so.2 -o
../../lib/librados.so.2.0.0 CMakeFiles/librados.dir/librados_c.cc.o
CMakeFiles/librados.dir/librados_cxx.cc.o
../common/CMakeFiles/common_buffer_obj.dir/buffer.cc.o -L/usr/local/lib
-Wl,-rpath,/usr/local/lib:/home/jenkins/workspace/ceph-master/build/lib:/usr/local/lib/nss:
../../lib/liblibrados_impl.a ../../lib/libosdc.a
../../lib/libceph-common.so.0 ../../lib/libcls_lock_client.a
/usr/local/lib/nss/libssl3.so /usr/local/lib/nss/libsmime3.so
/usr/local/lib/nss/libnss3.so /usr/local/lib/nss/libnssutil3.so
/usr/local/lib/libplds4.so /usr/local/lib/libplc4.so
/usr/local/lib/libnspr4.so /usr/local/lib/libcrypto.so -lrt
../../lib/libjson_spirit.a ../../lib/libcommon_utf8.a
../../lib/liberasure_code.a ../../lib/libcrc32.a ../../lib/libarch.a
/usr/local/lib/libboost_thread.so /usr/local/lib/libboost_chrono.so
/usr/local/lib/libboost_atomic.so /usr/local/lib/libboost_random.so
/usr/local/lib/libboost_system.so
/usr/local/lib/libboost_program_options.so
/usr/local/lib/libboost_date_time.so
/usr/local/lib/libboost_iostreams.so /usr/local/lib/libboost_regex.so
/usr/lib/libexecinfo.so /usr/local/lib/nss/libssl3.so
/usr/local/lib/nss/libsmime3.so /usr/local/lib/nss/libnss3.so
/usr/local/lib/nss/libnssutil3.so /usr/local/lib/libplds4.so
/usr/local/lib/libplc4.so /usr/local/lib/libnspr4.so -lpthread
ld: error: CMakeFiles/librados.dir/librados_c.cc.o: symbol
rados_aio_append@@ has undefined version
ld: error: CMakeFiles/librados.dir/librados_c.cc.o: symbol
rados_aio_cancel@@ has undefined version
ld: error: CMakeFiles/librados.dir/librados_c.cc.o: symbol
rados_aio_cmpext@@ has undefined version
ld: error: CMakeFiles/librados.dir/librados_c.cc.o: symbol
rados_aio_create_completion@@ has undefined version
ld: error: CMakeFiles/librados.dir/librados_c.cc.o: symbol
rados_aio_exec@@ has undefined version
ld: error: CMakeFiles/librados.dir/librados_c.cc.o: symbol
rados_aio_flush@@ has undefined version
ld: error: CMakeFiles/librados.dir/librados_c.cc.o: symbol
rados_aio_flush_async@@ has undefined version
ld: error: CMakeFiles/librados.dir/librados_c.cc.o: symbol
rados_aio_get_return_value@@ has undefined version
ld: error: CMakeFiles/librados.dir/librados_c.cc.o: symbol
rados_aio_get_version@@ has undefined version
ld: error: CMakeFiles/librados.dir/librados_c.cc.o: symbol
rados_aio_getxattr@@ has undefined version
ld: error: CMakeFiles/librados.dir/librados_c.cc.o: symbol
rados_aio_getxattrs@@ has undefined version
ld: error: CMakeFiles/librados.dir/librados_c.cc.o: symbol
rados_aio_ioctx_selfmanaged_snap_create@@ has undefined version
ld: error: CMakeFiles/librados.dir/librados_c.cc.o: symbol
rados_aio_ioctx_selfmanaged_snap_remove@@ has undefined version
ld: error: CMakeFiles/librados.dir/librados_c.cc.o: symbol
rados_aio_is_complete@@ has undefined version
ld: error: CMakeFiles/librados.dir/librados_c.cc.o: symbol
rados_aio_is_complete_and_cb@@ has undefined version
ld: error: CMakeFiles/librados.dir/librados_c.cc.o: symbol
rados_aio_is_safe@@ has undefined version
ld: error: CMakeFiles/librados.dir/librados_c.cc.o: symbol
rados_aio_is_safe_and_cb@@ has undefined version
ld: error: CMakeFiles/librados.dir/librados_c.cc.o: symbol
rados_aio_notify@@ has undefined version
ld: error: CMakeFiles/librados.dir/librados_c.cc.o: symbol
rados_aio_read@@ has undefined version
ld: error: CMakeFiles/librados.dir/librados_c.cc.o: symbol
rados_aio_read_op_operate@@ has undefined version
ld: error: too many errors emitted, stopping now (use -error-limit=0 to
see all errors)
c++: error: linker command failed with exit code 1 (use -v to see
invocation)

_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-toolchain
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: Linking problem with lld

Tijl Coosemans
On Sun, 3 Mar 2019 12:50:03 +0100 Willem Jan Withagen <[hidden email]>
wrote:

> On 2-3-2019 18:35, Tijl Coosemans wrote:
> > On Sat, 2 Mar 2019 17:49:25 +0100 Willem Jan Withagen <[hidden email]>
> > wrote:  
> >> On 2-3-2019 16:21, Tijl Coosemans wrote:  
> >>> On Sat, 2 Mar 2019 14:21:57 +0100 Willem Jan Withagen <[hidden email]>
> >>> wrote:  
> >>>> Now if I look in librados.so for rados_create that gives:
> >>>> ====  
> >>>>    > objdump -t librados.so.2.0.0 | grep rados_create  
> >>> You want to look at dynamic symbols so "objdump -T".  
> >> Right, that list is empty.
> >>
> >> So I'm wondering what I can do to get them in that list.  
> > Try the command that creates librados.so.2.0.0 without the
> > --version-script argument.  
>
> Right, When I see the output, I know I tried that before. But then the
> versioning goes
> wrong, I think...
> Might need to rewrite the map-file?
>
> --WjW
>
> [ 43%] Linking CXX shared library ../../lib/librados.so
> cd /home/jenkins/workspace/ceph-master/build/src/librados &&
> /usr/local/bin/cmake -E cmake_link_script
> CMakeFiles/librados.dir/link.txt --verbose=1
> ccache /usr/bin/c++ -fPIC  -Wall -Wtype-limits -Wignored-qualifiers
> -Winit-self -Wpointer-arith -Werror=format-security -fno-strict-aliasing
> -fsigned-char -Wno-unknown-pragmas -Wno-unused-function
> -Wno-unused-local-typedef -Wno-varargs -Wno-gnu-designator
> -Wno-missing-braces -Wno-parentheses -Wno-deprecated-register
> -ftemplate-depth-1024 -Wnon-virtual-dtor -Wno-unknown-pragmas
> -Wno-ignored-qualifiers -Wno-inconsistent-missing-override
> -Wno-mismatched-tags -Wno-unused-private-field
> -Wno-address-of-packed-member -DCEPH_DEBUG_MUTEX
> -fdiagnostics-color=auto -fno-builtin-malloc -fno-builtin-calloc
> -fno-builtin-realloc -fno-builtin-free  -O0 -g -fvisibility=default 
> -Wl,--exclude-libs,ALL -shared -Wl,-soname,librados.so.2 -o
> ../../lib/librados.so.2.0.0 CMakeFiles/librados.dir/librados_c.cc.o
> CMakeFiles/librados.dir/librados_cxx.cc.o
> ../common/CMakeFiles/common_buffer_obj.dir/buffer.cc.o -L/usr/local/lib
> -Wl,-rpath,/usr/local/lib:/home/jenkins/workspace/ceph-master/build/lib:/usr/local/lib/nss:
> ../../lib/liblibrados_impl.a ../../lib/libosdc.a
> ../../lib/libceph-common.so.0 ../../lib/libcls_lock_client.a
> /usr/local/lib/nss/libssl3.so /usr/local/lib/nss/libsmime3.so
> /usr/local/lib/nss/libnss3.so /usr/local/lib/nss/libnssutil3.so
> /usr/local/lib/libplds4.so /usr/local/lib/libplc4.so
> /usr/local/lib/libnspr4.so /usr/local/lib/libcrypto.so -lrt
> ../../lib/libjson_spirit.a ../../lib/libcommon_utf8.a
> ../../lib/liberasure_code.a ../../lib/libcrc32.a ../../lib/libarch.a
> /usr/local/lib/libboost_thread.so /usr/local/lib/libboost_chrono.so
> /usr/local/lib/libboost_atomic.so /usr/local/lib/libboost_random.so
> /usr/local/lib/libboost_system.so
> /usr/local/lib/libboost_program_options.so
> /usr/local/lib/libboost_date_time.so
> /usr/local/lib/libboost_iostreams.so /usr/local/lib/libboost_regex.so
> /usr/lib/libexecinfo.so /usr/local/lib/nss/libssl3.so
> /usr/local/lib/nss/libsmime3.so /usr/local/lib/nss/libnss3.so
> /usr/local/lib/nss/libnssutil3.so /usr/local/lib/libplds4.so
> /usr/local/lib/libplc4.so /usr/local/lib/libnspr4.so -lpthread
> ld: error: CMakeFiles/librados.dir/librados_c.cc.o: symbol
> rados_aio_append@@ has undefined version
> ld: error: CMakeFiles/librados.dir/librados_c.cc.o: symbol
> rados_aio_cancel@@ has undefined version
> ld: error: CMakeFiles/librados.dir/librados_c.cc.o: symbol
> rados_aio_cmpext@@ has undefined version
> ld: error: CMakeFiles/librados.dir/librados_c.cc.o: symbol
> rados_aio_create_completion@@ has undefined version
> ld: error: CMakeFiles/librados.dir/librados_c.cc.o: symbol
> rados_aio_exec@@ has undefined version
> ld: error: CMakeFiles/librados.dir/librados_c.cc.o: symbol
> rados_aio_flush@@ has undefined version
> ld: error: CMakeFiles/librados.dir/librados_c.cc.o: symbol
> rados_aio_flush_async@@ has undefined version
> ld: error: CMakeFiles/librados.dir/librados_c.cc.o: symbol
> rados_aio_get_return_value@@ has undefined version
> ld: error: CMakeFiles/librados.dir/librados_c.cc.o: symbol
> rados_aio_get_version@@ has undefined version
> ld: error: CMakeFiles/librados.dir/librados_c.cc.o: symbol
> rados_aio_getxattr@@ has undefined version
> ld: error: CMakeFiles/librados.dir/librados_c.cc.o: symbol
> rados_aio_getxattrs@@ has undefined version
> ld: error: CMakeFiles/librados.dir/librados_c.cc.o: symbol
> rados_aio_ioctx_selfmanaged_snap_create@@ has undefined version
> ld: error: CMakeFiles/librados.dir/librados_c.cc.o: symbol
> rados_aio_ioctx_selfmanaged_snap_remove@@ has undefined version
> ld: error: CMakeFiles/librados.dir/librados_c.cc.o: symbol
> rados_aio_is_complete@@ has undefined version
> ld: error: CMakeFiles/librados.dir/librados_c.cc.o: symbol
> rados_aio_is_complete_and_cb@@ has undefined version
> ld: error: CMakeFiles/librados.dir/librados_c.cc.o: symbol
> rados_aio_is_safe@@ has undefined version
> ld: error: CMakeFiles/librados.dir/librados_c.cc.o: symbol
> rados_aio_is_safe_and_cb@@ has undefined version
> ld: error: CMakeFiles/librados.dir/librados_c.cc.o: symbol
> rados_aio_notify@@ has undefined version
> ld: error: CMakeFiles/librados.dir/librados_c.cc.o: symbol
> rados_aio_read@@ has undefined version
> ld: error: CMakeFiles/librados.dir/librados_c.cc.o: symbol
> rados_aio_read_op_operate@@ has undefined version
> ld: error: too many errors emitted, stopping now (use -error-limit=0 to
> see all errors)
> c++: error: linker command failed with exit code 1 (use -v to see
> invocation)

You could start with a simple version map:

LIBRADOS_14.2.0 {
         global: *;
};

If symbols are visible in objdump -T output with this, you can then
expand the map bit by bit and see at what point it goes wrong.

My guess is the "local: *" in the beginning is matching everything so
nothing remains visible.

See also https://bugs.llvm.org/show_bug.cgi?id=40176
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-toolchain
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: Linking problem with lld

Willem Jan Withagen-2
On 3-3-2019 13:34, Tijl Coosemans wrote:

> On Sun, 3 Mar 2019 12:50:03 +0100 Willem Jan Withagen <[hidden email]>
> wrote:
>> On 2-3-2019 18:35, Tijl Coosemans wrote:
>>> On Sat, 2 Mar 2019 17:49:25 +0100 Willem Jan Withagen <[hidden email]>
>>> wrote:
>>>> On 2-3-2019 16:21, Tijl Coosemans wrote:
>>>>> On Sat, 2 Mar 2019 14:21:57 +0100 Willem Jan Withagen <[hidden email]>
>>>>> wrote:
>>>>>> Now if I look in librados.so for rados_create that gives:
>>>>>> ====
>>>>>>     > objdump -t librados.so.2.0.0 | grep rados_create
>>>>> You want to look at dynamic symbols so "objdump -T".
>>>> Right, that list is empty.
>>>>
>>>> So I'm wondering what I can do to get them in that list.
>>> Try the command that creates librados.so.2.0.0 without the
>>> --version-script argument.
>> Right, When I see the output, I know I tried that before. But then the
>> versioning goes
>> wrong, I think...
>> Might need to rewrite the map-file?
>>
>> --WjW
>>
>> [ 43%] Linking CXX shared library ../../lib/librados.so
>> cd /home/jenkins/workspace/ceph-master/build/src/librados &&
>> /usr/local/bin/cmake -E cmake_link_script
>> CMakeFiles/librados.dir/link.txt --verbose=1
>> ccache /usr/bin/c++ -fPIC  -Wall -Wtype-limits -Wignored-qualifiers
>> -Winit-self -Wpointer-arith -Werror=format-security -fno-strict-aliasing
>> -fsigned-char -Wno-unknown-pragmas -Wno-unused-function
>> -Wno-unused-local-typedef -Wno-varargs -Wno-gnu-designator
>> -Wno-missing-braces -Wno-parentheses -Wno-deprecated-register
>> -ftemplate-depth-1024 -Wnon-virtual-dtor -Wno-unknown-pragmas
>> -Wno-ignored-qualifiers -Wno-inconsistent-missing-override
>> -Wno-mismatched-tags -Wno-unused-private-field
>> -Wno-address-of-packed-member -DCEPH_DEBUG_MUTEX
>> -fdiagnostics-color=auto -fno-builtin-malloc -fno-builtin-calloc
>> -fno-builtin-realloc -fno-builtin-free  -O0 -g -fvisibility=default
>> -Wl,--exclude-libs,ALL -shared -Wl,-soname,librados.so.2 -o
>> ../../lib/librados.so.2.0.0 CMakeFiles/librados.dir/librados_c.cc.o
>> CMakeFiles/librados.dir/librados_cxx.cc.o
>> ../common/CMakeFiles/common_buffer_obj.dir/buffer.cc.o -L/usr/local/lib
>> -Wl,-rpath,/usr/local/lib:/home/jenkins/workspace/ceph-master/build/lib:/usr/local/lib/nss:
>> ../../lib/liblibrados_impl.a ../../lib/libosdc.a
>> ../../lib/libceph-common.so.0 ../../lib/libcls_lock_client.a
>> /usr/local/lib/nss/libssl3.so /usr/local/lib/nss/libsmime3.so
>> /usr/local/lib/nss/libnss3.so /usr/local/lib/nss/libnssutil3.so
>> /usr/local/lib/libplds4.so /usr/local/lib/libplc4.so
>> /usr/local/lib/libnspr4.so /usr/local/lib/libcrypto.so -lrt
>> ../../lib/libjson_spirit.a ../../lib/libcommon_utf8.a
>> ../../lib/liberasure_code.a ../../lib/libcrc32.a ../../lib/libarch.a
>> /usr/local/lib/libboost_thread.so /usr/local/lib/libboost_chrono.so
>> /usr/local/lib/libboost_atomic.so /usr/local/lib/libboost_random.so
>> /usr/local/lib/libboost_system.so
>> /usr/local/lib/libboost_program_options.so
>> /usr/local/lib/libboost_date_time.so
>> /usr/local/lib/libboost_iostreams.so /usr/local/lib/libboost_regex.so
>> /usr/lib/libexecinfo.so /usr/local/lib/nss/libssl3.so
>> /usr/local/lib/nss/libsmime3.so /usr/local/lib/nss/libnss3.so
>> /usr/local/lib/nss/libnssutil3.so /usr/local/lib/libplds4.so
>> /usr/local/lib/libplc4.so /usr/local/lib/libnspr4.so -lpthread
>> ld: error: CMakeFiles/librados.dir/librados_c.cc.o: symbol
>> rados_aio_append@@ has undefined version
>> ld: error: CMakeFiles/librados.dir/librados_c.cc.o: symbol
>> rados_aio_cancel@@ has undefined version
>> ld: error: CMakeFiles/librados.dir/librados_c.cc.o: symbol
>> rados_aio_cmpext@@ has undefined version
>> ld: error: CMakeFiles/librados.dir/librados_c.cc.o: symbol
>> rados_aio_create_completion@@ has undefined version
>> ld: error: CMakeFiles/librados.dir/librados_c.cc.o: symbol
>> rados_aio_exec@@ has undefined version
>> ld: error: CMakeFiles/librados.dir/librados_c.cc.o: symbol
>> rados_aio_flush@@ has undefined version
>> ld: error: CMakeFiles/librados.dir/librados_c.cc.o: symbol
>> rados_aio_flush_async@@ has undefined version
>> ld: error: CMakeFiles/librados.dir/librados_c.cc.o: symbol
>> rados_aio_get_return_value@@ has undefined version
>> ld: error: CMakeFiles/librados.dir/librados_c.cc.o: symbol
>> rados_aio_get_version@@ has undefined version
>> ld: error: CMakeFiles/librados.dir/librados_c.cc.o: symbol
>> rados_aio_getxattr@@ has undefined version
>> ld: error: CMakeFiles/librados.dir/librados_c.cc.o: symbol
>> rados_aio_getxattrs@@ has undefined version
>> ld: error: CMakeFiles/librados.dir/librados_c.cc.o: symbol
>> rados_aio_ioctx_selfmanaged_snap_create@@ has undefined version
>> ld: error: CMakeFiles/librados.dir/librados_c.cc.o: symbol
>> rados_aio_ioctx_selfmanaged_snap_remove@@ has undefined version
>> ld: error: CMakeFiles/librados.dir/librados_c.cc.o: symbol
>> rados_aio_is_complete@@ has undefined version
>> ld: error: CMakeFiles/librados.dir/librados_c.cc.o: symbol
>> rados_aio_is_complete_and_cb@@ has undefined version
>> ld: error: CMakeFiles/librados.dir/librados_c.cc.o: symbol
>> rados_aio_is_safe@@ has undefined version
>> ld: error: CMakeFiles/librados.dir/librados_c.cc.o: symbol
>> rados_aio_is_safe_and_cb@@ has undefined version
>> ld: error: CMakeFiles/librados.dir/librados_c.cc.o: symbol
>> rados_aio_notify@@ has undefined version
>> ld: error: CMakeFiles/librados.dir/librados_c.cc.o: symbol
>> rados_aio_read@@ has undefined version
>> ld: error: CMakeFiles/librados.dir/librados_c.cc.o: symbol
>> rados_aio_read_op_operate@@ has undefined version
>> ld: error: too many errors emitted, stopping now (use -error-limit=0 to
>> see all errors)
>> c++: error: linker command failed with exit code 1 (use -v to see
>> invocation)
> You could start with a simple version map:
>
> LIBRADOS_14.2.0 {
>           global: *;
> };
>
> If symbols are visible in objdump -T output with this, you can then
> expand the map bit by bit and see at what point it goes wrong.
>
> My guess is the "local: *" in the beginning is matching everything so
> nothing remains visible.
I agree with that, but up till now all attempts I made failed....
So more trial and error ;-)
> See also https://bugs.llvm.org/show_bug.cgi?id=40176
I also "used"
   https://sourceware.org/binutils/docs/ld/VERSION.html
which in itself explains some things, but the actual detailed
functioning has to be infered


Thanx,
--WjW

_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-toolchain
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: Linking problem with lld

Willem Jan Withagen-2
On 3-3-2019 14:45, Willem Jan Withagen wrote:

> On 3-3-2019 13:34, Tijl Coosemans wrote:
>> On Sun, 3 Mar 2019 12:50:03 +0100 Willem Jan Withagen <[hidden email]>
>> wrote:
>>> On 2-3-2019 18:35, Tijl Coosemans wrote:
>>>> On Sat, 2 Mar 2019 17:49:25 +0100 Willem Jan Withagen
>>>> <[hidden email]>
>>>> wrote:
>>>>> On 2-3-2019 16:21, Tijl Coosemans wrote:
>>>>>> On Sat, 2 Mar 2019 14:21:57 +0100 Willem Jan Withagen
>>>>>> <[hidden email]>
>>>>>> wrote:
>>>>>>> Now if I look in librados.so for rados_create that gives:
>>>>>>> ====
>>>>>>>     > objdump -t librados.so.2.0.0 | grep rados_create
>>>>>> You want to look at dynamic symbols so "objdump -T".
>>>>> Right, that list is empty.
>>>>>
>>>>> So I'm wondering what I can do to get them in that list.
>>>> Try the command that creates librados.so.2.0.0 without the
>>>> --version-script argument.
>>> Right, When I see the output, I know I tried that before. But then the
>>> versioning goes
>>> wrong, I think...
>>> Might need to rewrite the map-file?
>>>
>>> --WjW
>>>
>>> [ 43%] Linking CXX shared library ../../lib/librados.so
>>> cd /home/jenkins/workspace/ceph-master/build/src/librados &&
>>> /usr/local/bin/cmake -E cmake_link_script
>>> CMakeFiles/librados.dir/link.txt --verbose=1
>>> ccache /usr/bin/c++ -fPIC  -Wall -Wtype-limits -Wignored-qualifiers
>>> -Winit-self -Wpointer-arith -Werror=format-security
>>> -fno-strict-aliasing
>>> -fsigned-char -Wno-unknown-pragmas -Wno-unused-function
>>> -Wno-unused-local-typedef -Wno-varargs -Wno-gnu-designator
>>> -Wno-missing-braces -Wno-parentheses -Wno-deprecated-register
>>> -ftemplate-depth-1024 -Wnon-virtual-dtor -Wno-unknown-pragmas
>>> -Wno-ignored-qualifiers -Wno-inconsistent-missing-override
>>> -Wno-mismatched-tags -Wno-unused-private-field
>>> -Wno-address-of-packed-member -DCEPH_DEBUG_MUTEX
>>> -fdiagnostics-color=auto -fno-builtin-malloc -fno-builtin-calloc
>>> -fno-builtin-realloc -fno-builtin-free  -O0 -g -fvisibility=default
>>> -Wl,--exclude-libs,ALL -shared -Wl,-soname,librados.so.2 -o
>>> ../../lib/librados.so.2.0.0 CMakeFiles/librados.dir/librados_c.cc.o
>>> CMakeFiles/librados.dir/librados_cxx.cc.o
>>> ../common/CMakeFiles/common_buffer_obj.dir/buffer.cc.o -L/usr/local/lib
>>> -Wl,-rpath,/usr/local/lib:/home/jenkins/workspace/ceph-master/build/lib:/usr/local/lib/nss:
>>>
>>> ../../lib/liblibrados_impl.a ../../lib/libosdc.a
>>> ../../lib/libceph-common.so.0 ../../lib/libcls_lock_client.a
>>> /usr/local/lib/nss/libssl3.so /usr/local/lib/nss/libsmime3.so
>>> /usr/local/lib/nss/libnss3.so /usr/local/lib/nss/libnssutil3.so
>>> /usr/local/lib/libplds4.so /usr/local/lib/libplc4.so
>>> /usr/local/lib/libnspr4.so /usr/local/lib/libcrypto.so -lrt
>>> ../../lib/libjson_spirit.a ../../lib/libcommon_utf8.a
>>> ../../lib/liberasure_code.a ../../lib/libcrc32.a ../../lib/libarch.a
>>> /usr/local/lib/libboost_thread.so /usr/local/lib/libboost_chrono.so
>>> /usr/local/lib/libboost_atomic.so /usr/local/lib/libboost_random.so
>>> /usr/local/lib/libboost_system.so
>>> /usr/local/lib/libboost_program_options.so
>>> /usr/local/lib/libboost_date_time.so
>>> /usr/local/lib/libboost_iostreams.so /usr/local/lib/libboost_regex.so
>>> /usr/lib/libexecinfo.so /usr/local/lib/nss/libssl3.so
>>> /usr/local/lib/nss/libsmime3.so /usr/local/lib/nss/libnss3.so
>>> /usr/local/lib/nss/libnssutil3.so /usr/local/lib/libplds4.so
>>> /usr/local/lib/libplc4.so /usr/local/lib/libnspr4.so -lpthread
>>> ld: error: CMakeFiles/librados.dir/librados_c.cc.o: symbol
>>> rados_aio_append@@ has undefined version
>>> ld: error: CMakeFiles/librados.dir/librados_c.cc.o: symbol
>>> rados_aio_cancel@@ has undefined version
>>> ld: error: CMakeFiles/librados.dir/librados_c.cc.o: symbol
>>> rados_aio_cmpext@@ has undefined version
>>> ld: error: CMakeFiles/librados.dir/librados_c.cc.o: symbol
>>> rados_aio_create_completion@@ has undefined version
>>> ld: error: CMakeFiles/librados.dir/librados_c.cc.o: symbol
>>> rados_aio_exec@@ has undefined version
>>> ld: error: CMakeFiles/librados.dir/librados_c.cc.o: symbol
>>> rados_aio_flush@@ has undefined version
>>> ld: error: CMakeFiles/librados.dir/librados_c.cc.o: symbol
>>> rados_aio_flush_async@@ has undefined version
>>> ld: error: CMakeFiles/librados.dir/librados_c.cc.o: symbol
>>> rados_aio_get_return_value@@ has undefined version
>>> ld: error: CMakeFiles/librados.dir/librados_c.cc.o: symbol
>>> rados_aio_get_version@@ has undefined version
>>> ld: error: CMakeFiles/librados.dir/librados_c.cc.o: symbol
>>> rados_aio_getxattr@@ has undefined version
>>> ld: error: CMakeFiles/librados.dir/librados_c.cc.o: symbol
>>> rados_aio_getxattrs@@ has undefined version
>>> ld: error: CMakeFiles/librados.dir/librados_c.cc.o: symbol
>>> rados_aio_ioctx_selfmanaged_snap_create@@ has undefined version
>>> ld: error: CMakeFiles/librados.dir/librados_c.cc.o: symbol
>>> rados_aio_ioctx_selfmanaged_snap_remove@@ has undefined version
>>> ld: error: CMakeFiles/librados.dir/librados_c.cc.o: symbol
>>> rados_aio_is_complete@@ has undefined version
>>> ld: error: CMakeFiles/librados.dir/librados_c.cc.o: symbol
>>> rados_aio_is_complete_and_cb@@ has undefined version
>>> ld: error: CMakeFiles/librados.dir/librados_c.cc.o: symbol
>>> rados_aio_is_safe@@ has undefined version
>>> ld: error: CMakeFiles/librados.dir/librados_c.cc.o: symbol
>>> rados_aio_is_safe_and_cb@@ has undefined version
>>> ld: error: CMakeFiles/librados.dir/librados_c.cc.o: symbol
>>> rados_aio_notify@@ has undefined version
>>> ld: error: CMakeFiles/librados.dir/librados_c.cc.o: symbol
>>> rados_aio_read@@ has undefined version
>>> ld: error: CMakeFiles/librados.dir/librados_c.cc.o: symbol
>>> rados_aio_read_op_operate@@ has undefined version
>>> ld: error: too many errors emitted, stopping now (use -error-limit=0 to
>>> see all errors)
>>> c++: error: linker command failed with exit code 1 (use -v to see
>>> invocation)
>> You could start with a simple version map:
>>
>> LIBRADOS_14.2.0 {
>>           global: *;
>> };
>>
>> If symbols are visible in objdump -T output with this, you can then
>> expand the map bit by bit and see at what point it goes wrong.
>>
>> My guess is the "local: *" in the beginning is matching everything so
>> nothing remains visible.
> I agree with that, but up till now all attempts I made failed....
> So more trial and error ;-)
>> See also https://bugs.llvm.org/show_bug.cgi?id=40176
> I also "used"
>   https://sourceware.org/binutils/docs/ld/VERSION.html
> which in itself explains some things, but the actual detailed
> functioning has to be infered

First success.
I used this map, but also needed to fix a .symver:
====
  #define LIBRADOS_C_API_BASE_DEFAULT(fn)       \
-  asm(".symver _" #fn ", " #fn "@@")
+  asm(".symver _" #fn ", " #fn "@")
====
That last was more or less guessed from the binutils/docs/ld page.

--WjW

_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-toolchain
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: Linking problem with lld

Tijl Coosemans
On Sun, 3 Mar 2019 15:21:56 +0100 Willem Jan Withagen <[hidden email]>
wrote:
> First success.
> I used this map, but also needed to fix a .symver:
> ====
>   #define LIBRADOS_C_API_BASE_DEFAULT(fn)       \
> -  asm(".symver _" #fn ", " #fn "@@")
> +  asm(".symver _" #fn ", " #fn "@")
> ====
> That last was more or less guessed from the binutils/docs/ld page.

It's really a bug in lld.  You can add LLD_UNSAFE=yes to the port
Makefile for now.

Here's a simple test case:

% cat test.c
void _test1() {
}
asm(".symver _test1, test1@@");

void test2() {
}
% cat test.map
{
  local: *;
};
% clang70 -shared -o libtest.so test.c -fPIC -Wl,--version-script=test.map
% readelf -s libtest.so | grep test
     8: 0000000000000000     0 FILE    LOCAL  DEFAULT  ABS test.c
     9: 0000000000001090     5 FUNC    LOCAL  DEFAULT    9 _test1
    10: 0000000000001090     5 FUNC    LOCAL  DEFAULT    9 test1
    11: 00000000000010a0     5 FUNC    LOCAL  DEFAULT    9 test2
% clang70 -shared -o libtest.so test.c -fPIC -Wl,--version-script=test.map -fuse-ld=bfd
% readelf -s libtest.so | grep test
     3: 0000000000000280     5 FUNC    GLOBAL DEFAULT   11 test1
    34: 0000000000000000     0 FILE    LOCAL  DEFAULT  ABS test.c
    38: 0000000000000280     5 FUNC    LOCAL  DEFAULT   11 _test1
    42: 0000000000000290     5 FUNC    LOCAL  DEFAULT   11 test2
    46: 0000000000000280     5 FUNC    GLOBAL DEFAULT   11 test1@@

With lld test1 is local.  With GNU ld it's global.  The .symver
directive should override the version script.
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-toolchain
To unsubscribe, send any mail to "[hidden email]"