Skip to content

Commit

Permalink
cmake: libebl was merged into libdw
Browse files Browse the repository at this point in the history
Since elfutils 178, libebl is now part of libdw, so searching for libebl
always fails. Simply remove it from the search.

Reviewer notes:

I even built dwarves with the patch against and old elfutils-0.176 and a
new elfutils-0.178 to double check. Builds fine with both.

With elfutils-0.178 pahole even automagically works with the new
debuginfo-client support.  See

https://sourceware.org/elfutils/Debuginfod.html

Signed-off-by: Jason A. Donenfeld <[email protected]>
Reviewed-by: Mark Wielaard <[email protected]>
Cc: [email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
  • Loading branch information
zx2c4 authored and acmel committed Feb 3, 2020
1 parent 290b8fd commit de84ae3
Showing 1 changed file with 7 additions and 16 deletions.
23 changes: 7 additions & 16 deletions cmake/modules/FindDWARF.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -37,33 +37,27 @@ find_library(ELF_LIBRARY
PATHS /usr/lib /usr/local/lib /usr/lib64 /usr/local/lib64 ~/usr/local/lib ~/usr/local/lib64
)

find_library(EBL_LIBRARY
NAMES ebl
PATHS /usr/lib /usr/local/lib /usr/lib64 /usr/local/lib64 ~/usr/local/lib ~/usr/local/lib64
)

if (DWARF_INCLUDE_DIR AND LIBDW_INCLUDE_DIR AND DWARF_LIBRARY AND ELF_LIBRARY AND EBL_LIBRARY)
if (DWARF_INCLUDE_DIR AND LIBDW_INCLUDE_DIR AND DWARF_LIBRARY AND ELF_LIBRARY)
set(DWARF_FOUND TRUE)
set(DWARF_LIBRARIES ${DWARF_LIBRARY} ${ELF_LIBRARY} ${EBL_LIBRARY})
set(DWARF_LIBRARIES ${DWARF_LIBRARY} ${ELF_LIBRARY})

set(CMAKE_REQUIRED_LIBRARIES ${DWARF_LIBRARIES})
# check if libdw have the dwfl_module_build_id routine, i.e. if it supports the buildid
# mechanism to match binaries to detached debug info sections (the -debuginfo packages
# in distributions such as fedora). We do it against libelf because, IIRC, some distros
# include libdw linked statically into libelf.
check_library_exists(elf dwfl_module_build_id "" HAVE_DWFL_MODULE_BUILD_ID)
else (DWARF_INCLUDE_DIR AND LIBDW_INCLUDE_DIR AND DWARF_LIBRARY AND ELF_LIBRARY AND EBL_LIBRARY)
else (DWARF_INCLUDE_DIR AND LIBDW_INCLUDE_DIR AND DWARF_LIBRARY AND ELF_LIBRARY)
set(DWARF_FOUND FALSE)
set(DWARF_LIBRARIES)
endif (DWARF_INCLUDE_DIR AND LIBDW_INCLUDE_DIR AND DWARF_LIBRARY AND ELF_LIBRARY AND EBL_LIBRARY)
endif (DWARF_INCLUDE_DIR AND LIBDW_INCLUDE_DIR AND DWARF_LIBRARY AND ELF_LIBRARY)

if (DWARF_FOUND)
if (NOT DWARF_FIND_QUIETLY)
message(STATUS "Found dwarf.h header: ${DWARF_INCLUDE_DIR}")
message(STATUS "Found elfutils/libdw.h header: ${LIBDW_INCLUDE_DIR}")
message(STATUS "Found libdw library: ${DWARF_LIBRARY}")
message(STATUS "Found libelf library: ${ELF_LIBRARY}")
message(STATUS "Found libebl library: ${EBL_LIBRARY}")
endif (NOT DWARF_FIND_QUIETLY)
else (DWARF_FOUND)
if (DWARF_FIND_REQUIRED)
Expand All @@ -73,9 +67,9 @@ else (DWARF_FOUND)
find_path(FEDORA fedora-release /etc)
find_path(REDHAT redhat-release /etc)
if (FEDORA OR REDHAT)
if (NOT DWARF_INCLUDE_DIR OR NOT LIBDW_INCLUDE_DIR OR NOT EBL_LIBRARY)
if (NOT DWARF_INCLUDE_DIR OR NOT LIBDW_INCLUDE_DIR)
message(STATUS "Please install the elfutils-devel package")
endif (NOT DWARF_INCLUDE_DIR OR NOT LIBDW_INCLUDE_DIR OR NOT EBL_LIBRARY)
endif (NOT DWARF_INCLUDE_DIR OR NOT LIBDW_INCLUDE_DIR)
if (NOT DWARF_LIBRARY)
message(STATUS "Please install the elfutils-libs package")
endif (NOT DWARF_LIBRARY)
Expand All @@ -89,9 +83,6 @@ else (DWARF_FOUND)
if (NOT LIBDW_INCLUDE_DIR)
message(STATUS "Could NOT find libdw include dir")
endif (NOT LIBDW_INCLUDE_DIR)
if (NOT EBL_LIBRARY)
message(STATUS "Could NOT find libebl library")
endif (NOT EBL_LIBRARY)
if (NOT DWARF_LIBRARY)
message(STATUS "Could NOT find libdw library")
endif (NOT DWARF_LIBRARY)
Expand All @@ -103,7 +94,7 @@ else (DWARF_FOUND)
endif (DWARF_FIND_REQUIRED)
endif (DWARF_FOUND)

mark_as_advanced(DWARF_INCLUDE_DIR LIBDW_INCLUDE_DIR DWARF_LIBRARY ELF_LIBRARY EBL_LIBRARY)
mark_as_advanced(DWARF_INCLUDE_DIR LIBDW_INCLUDE_DIR DWARF_LIBRARY ELF_LIBRARY)
include_directories(${DWARF_INCLUDE_DIR} ${LIBDW_INCLUDE_DIR})
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_SOURCE_DIR}/config.h)

Expand Down

0 comments on commit de84ae3

Please sign in to comment.