Skip to content

Commit

Permalink
i6909: Handle libelftc separately in cmake files (#6917)
Browse files Browse the repository at this point in the history
After switching to the elfutils submodule, libraries libelf and libdwarf
became optional. Static library libelftc is still required to be linked,
so in cmake files there must be a separate check for it.

The issue appears when building an external DynamoRIO client.

Issue: #6909
  • Loading branch information
apach301 authored Aug 15, 2024
1 parent 0481c48 commit 3ae837e
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions make/DynamoRIOConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -431,16 +431,21 @@ if (NOT DynamoRIO_INTERNAL)
endif ()

# if we were built w/ static drsyms, clients need dependent static libs too
if (UNIX AND EXISTS "${DynamoRIO_cwd}/../ext/lib${_DR_bits}/${_DR_type}/libdwarf.a")
add_library(elf STATIC IMPORTED)
set_property(TARGET elf PROPERTY
IMPORTED_LOCATION "${DynamoRIO_cwd}/../ext/lib${_DR_bits}/${_DR_type}/libelf.a")
add_library(dwarf STATIC IMPORTED)
set_property(TARGET dwarf PROPERTY
IMPORTED_LOCATION "${DynamoRIO_cwd}/../ext/lib${_DR_bits}/${_DR_type}/libdwarf.a")
add_library(elftc STATIC IMPORTED)
set_property(TARGET elftc PROPERTY
IMPORTED_LOCATION "${DynamoRIO_cwd}/../ext/lib${_DR_bits}/${_DR_type}/libelftc.a")
if (UNIX)
# i#6909: Handle libelftc separately because libdwarf and libelf are optional.
if (EXISTS "${DynamoRIO_cwd}/../ext/lib${_DR_bits}/${_DR_type}/libelftc.a")
add_library(elftc STATIC IMPORTED)
set_property(TARGET elftc PROPERTY
IMPORTED_LOCATION "${DynamoRIO_cwd}/../ext/lib${_DR_bits}/${_DR_type}/libelftc.a")
endif()
if (EXISTS "${DynamoRIO_cwd}/../ext/lib${_DR_bits}/${_DR_type}/libdwarf.a")
add_library(elf STATIC IMPORTED)
set_property(TARGET elf PROPERTY
IMPORTED_LOCATION "${DynamoRIO_cwd}/../ext/lib${_DR_bits}/${_DR_type}/libelf.a")
add_library(dwarf STATIC IMPORTED)
set_property(TARGET dwarf PROPERTY
IMPORTED_LOCATION "${DynamoRIO_cwd}/../ext/lib${_DR_bits}/${_DR_type}/libdwarf.a")
endif ()
endif ()
if (WIN32 AND EXISTS "${DynamoRIO_cwd}/../ext/lib${_DR_bits}/${_DR_type}/dwarf.lib")
add_library(dwarf STATIC IMPORTED)
Expand Down

0 comments on commit 3ae837e

Please sign in to comment.