Skip to content

Commit

Permalink
[DWARVES] Fixes a FIXME relating to a missing elf (libdw) symbol check.
Browse files Browse the repository at this point in the history
Signed-off-by: Felipe Kellermann <felipek@socksarmor.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
  • Loading branch information
Felipe Kellermann authored and acmel committed Feb 12, 2008
1 parent 030f187 commit 4145956
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
5 changes: 5 additions & 0 deletions cmake/modules/FindDWARF.cmake
Expand Up @@ -5,6 +5,7 @@
# DWARF_LIBRARIES - List of libraries when using elf utils.
# DWARF_FOUND - True if fdo found.

INCLUDE(CheckLibraryExists)

if (DWARF_INCLUDE_DIR AND LIBDW_INCLUDE_DIR AND DWARF_LIBRARY AND ELF_LIBRARY)
# Already in cache, be silent
Expand Down Expand Up @@ -42,6 +43,9 @@ find_library(EBL_LIBRARY
if (DWARF_INCLUDE_DIR AND LIBDW_INCLUDE_DIR AND DWARF_LIBRARY AND ELF_LIBRARY AND EBL_LIBRARY)
set(DWARF_FOUND TRUE)
set(DWARF_LIBRARIES ${DWARF_LIBRARY} ${ELF_LIBRARY} ${EBL_LIBRARY})

set(CMAKE_REQUIRED_LIBRARIES ${DWARF_LIBRARIES})
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)
set(DWARF_FOUND FALSE)
set(DWARF_LIBRARIES)
Expand Down Expand Up @@ -77,3 +81,4 @@ endif (DWARF_FOUND)

mark_as_advanced(DWARF_INCLUDE_DIR LIBDW_INCLUDE_DIR DWARF_LIBRARY ELF_LIBRARY EBL_LIBRARY)
include_directories(${DWARF_INCLUDE_DIR} ${LIBDW_INCLUDE_DIR})
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_SOURCE_DIR}/config.h)
9 changes: 9 additions & 0 deletions config.h.cmake
@@ -0,0 +1,9 @@
/*
Copyright (C) 2007 Arnaldo Carvalho de Melo <acme@redhat.com>

This program is free software; you can redistribute it and/or modify it
under the terms of version 2 of the GNU General Public License as
published by the Free Software Foundation.
*/

#cmakedefine HAVE_DWFL_MODULE_BUILD_ID
8 changes: 3 additions & 5 deletions dwarves.c
Expand Up @@ -24,6 +24,7 @@
#include <string.h>
#include <unistd.h>

#include "config.h"
#include "list.h"
#include "dwarves.h"
#include "dutil.h"
Expand Down Expand Up @@ -3482,11 +3483,8 @@ static int cus__load_module(Dwfl_Module *mod, void **userdata __unused,
size_t cuhl;
GElf_Addr vaddr;
const unsigned char *build_id = NULL;
/*
* FIXME: check how to do this properly using cmake to test for
* the existence of dwfl_module_build_id in the elfutils libraries.
*/
#if 1

#ifdef HAVE_DWFL_MODULE_BUILD_ID
int build_id_len = dwfl_module_build_id(mod, &build_id, &vaddr);
#else
int build_id_len = 0;
Expand Down

0 comments on commit 4145956

Please sign in to comment.