Fix OPROFILE linux build with -Wl,--as-needed

The opagent library was (incorrectly) marked as a dependency for "Core"
instead of "Common".

When linked with --as-needed, any symbols the linker can tell are not
used are discarded. As the link is done in command-line order, and the
Core library (and dependencies) are processed before Common, it would
link in Core, then opagent, but as at that point no opagent symbols are
used the whole opagent library would be discarded.

Moving the opagent library to be a dependency of Common fixes this, as
after the Common library is linked, there *are* opagent symbols used.
This commit is contained in:
Jonathan Hamilton 2017-08-14 14:09:32 -07:00
parent 8fedd4fa06
commit 2a66b88d01
2 changed files with 4 additions and 4 deletions

View File

@ -119,6 +119,10 @@ endif()
add_dolphin_library(common "${SRCS}" "${LIBS}") add_dolphin_library(common "${SRCS}" "${LIBS}")
if(OPROFILE_FOUND)
target_link_libraries(common PRIVATE ${OPROFILE_LIBRARIES})
endif()
if(UNIX) if(UNIX)
# Posix networking code needs to be fixed for Windows # Posix networking code needs to be fixed for Windows
add_executable(traversal_server TraversalServer.cpp) add_executable(traversal_server TraversalServer.cpp)

View File

@ -345,10 +345,6 @@ if(TARGET Hidapi::Hidapi)
add_definitions(-DHAVE_HIDAPI=1) add_definitions(-DHAVE_HIDAPI=1)
endif() endif()
if(OPROFILE_FOUND)
set(LIBS ${LIBS} ${OPROFILE_LIBRARIES})
endif()
if(GDBSTUB) if(GDBSTUB)
set(SRCS ${SRCS} PowerPC/GDBStub.cpp) set(SRCS ${SRCS} PowerPC/GDBStub.cpp)
endif() endif()