Link warnings about lldb::endian::InlHostByteOrder()

Greg et al:

When linking (cmake on OS X), I get a lot of warnings like this:

ld: warning: cannot export hidden symbol lldb::endian::InlHostByteOrder()
from lib/liblldbPluginProcessUtility.a(RegisterContextDarwin_arm64.cpp.o)

Should this function be in the public namespace?

It is an inline function which is why I think it gets flagged as hidden.

Can we move it out of the lldb namespace? Or has that ship sailed? Is there some other way that we can suppress this warning or fix the underlying issue? (Can we exclude a symbol from being exported somehow?)

This isn’t the only symbol that is a problem, but it is the one that generates the most output.

  • Bruce

Greg et al:

When linking (cmake on OS X), I get a lot of warnings like this:

  ld: warning: cannot export hidden symbol lldb::endian::InlHostByteOrder()
      from lib/liblldbPluginProcessUtility.a(RegisterContextDarwin_arm64.cpp.o)

Should this function be in the public namespace?

No I don't believe it should.

It is an inline function which is why I think it gets flagged as hidden.

Can we move it out of the lldb namespace? Or has that ship sailed? Is there some other way that we can suppress this warning or fix the underlying issue? (Can we exclude a symbol from being exported somehow?)

Please feel free to move it to the lldb_private namespace. Nothing in our lldb/API/SB* header files should use it, so it is fine to move it. Let me know if you run into any troubles doing so.

This isn't the only symbol that is a problem, but it is the one that generates the most output.

We should have no inlined functions in our public API if we can avoid it. That is a sure way to have people crash if we ever change anything and they linked against the inline code from the header file.

Greg Clayton

>
> Greg et al:
>
> When linking (cmake on OS X), I get a lot of warnings like this:
>
> ld: warning: cannot export hidden symbol
lldb::endian::InlHostByteOrder()
> from
lib/liblldbPluginProcessUtility.a(RegisterContextDarwin_arm64.cpp.o)
>
> Should this function be in the public namespace?

No I don't believe it should.

> It is an inline function which is why I think it gets flagged as hidden.
>
> Can we move it out of the lldb namespace? Or has that ship sailed? Is
there some other way that we can suppress this warning or fix the
underlying issue? (Can we exclude a symbol from being exported somehow?)

Please feel free to move it to the lldb_private namespace. Nothing in our
lldb/API/SB* header files should use it, so it is fine to move it. Let me
know if you run into any troubles doing so.

Review: http://reviews.llvm.org/D14417

> This isn't the only symbol that is a problem, but it is the one that
generates the most output.

We should have no inlined functions in our public API if we can avoid it.
That is a sure way to have people crash if we ever change anything and they
linked against the inline code from the header file.

After fixing this one, the remaining cases are:

ld: warning: cannot export hidden symbol lldb::SBListener::GetSP() from
tools/lldb/source/API/CMakeFiles/liblldb.dir/SBAttachInfo.cpp.o
ld: warning: cannot export hidden symbol lldb::SBListener::GetSP() from
tools/lldb/source/API/CMakeFiles/liblldb.dir/SBLaunchInfo.cpp.o
ld: warning: cannot export hidden symbol
lldb::SBPlatform::SBPlatform(lldb::SBPlatform const&) from
tools/lldb/source/API/CMakeFiles/liblldb.dir/SBTarget.cpp.o
ld: warning: cannot export hidden symbol lldb::SBListener::GetSP() from
tools/lldb/source/API/CMakeFiles/liblldb.dir/SBTarget.cpp.o
ld: warning: cannot export hidden symbol
lldb::SBPlatform::SBPlatform(lldb::SBPlatform const&) from
tools/lldb/source/API/CMakeFiles/liblldb.dir/SBTarget.cpp.o
ld: warning: cannot export hidden symbol
lldb::SBPlatform::operator=(lldb::SBPlatform const&) from
tools/lldb/source/API/CMakeFiles/liblldb.dir/__/__/scripts/LLDBWrapPython.cpp.o
ld: warning: cannot export hidden symbol
lldb::SBPlatform::SBPlatform(lldb::SBPlatform const&) from
tools/lldb/source/API/CMakeFiles/liblldb.dir/__/__/scripts/LLDBWrapPython.cpp.o
ld: warning: cannot export hidden symbol
lldb::SBPlatform::SBPlatform(lldb::SBPlatform const&) from
tools/lldb/source/API/CMakeFiles/liblldb.dir/__/__/scripts/LLDBWrapPython.cpp.o
ld: warning: cannot export hidden symbol
lldb::SBQueueItem::operator=(lldb::SBQueueItem const&) from
tools/lldb/source/API/CMakeFiles/liblldb.dir/__/__/scripts/LLDBWrapPython.cpp.o
ld: warning: cannot export hidden symbol
lldb::SBQueueItem::SBQueueItem(lldb::SBQueueItem const&) from
tools/lldb/source/API/CMakeFiles/liblldb.dir/__/__/scripts/LLDBWrapPython.cpp.o
ld: warning: cannot export hidden symbol
lldb::SBQueueItem::SBQueueItem(lldb::SBQueueItem const&) from
tools/lldb/source/API/CMakeFiles/liblldb.dir/__/__/scripts/LLDBWrapPython.cpp.o
ld: warning: cannot export hidden symbol
lldb::SBLaunchInfo::SBLaunchInfo(lldb::SBLaunchInfo const&) from
tools/lldb/source/API/CMakeFiles/liblldb.dir/__/__/scripts/LLDBWrapPython.cpp.o
ld: warning: cannot export hidden symbol
lldb::SBLaunchInfo::SBLaunchInfo(lldb::SBLaunchInfo const&) from
tools/lldb/source/API/CMakeFiles/liblldb.dir/__/__/scripts/LLDBWrapPython.cpp.o

- Bruce