[PATCH,RFC] Make libbacktrace more standalone
Ian Lance Taylor
iant@google.com
Wed May 8 18:52:00 GMT 2013
On Wed, May 8, 2013 at 8:56 AM, Alexander Monakov <amonakov@ispras.ru> wrote:
>
> I'd like to make libbacktrace easier to import for use in other software.
> Comments?
> +#ifdef IN_GCC
Where is IN_GCC defined?
> +# Test if DWARF2 extensions enumeration values are declared
> +if test -n "${with_target_subdir}"; then
> + have_dwarf2_fission=yes
> + have_dwarf2_dwz_multifile=yes
> +else
> + AC_CHECK_HEADER([dwarf.h],
> + [
> + AC_MSG_CHECKING([for DW_FORM_GNU_addr_index])
> + AC_COMPILE_IFELSE(
> + [AC_LANG_PROGRAM(
> + [#include <dwarf.h>],
> + [int i = DW_FORM_GNU_addr_index;])],
> + [have_dwarf2_fission=yes],
> + [have_dwarf2_fission=no])
> + AC_MSG_RESULT([$have_dwarf2_fission])
> + AC_MSG_CHECKING([for DW_FORM_GNU_ref_alt])
> + AC_COMPILE_IFELSE(
> + [AC_LANG_PROGRAM(
> + [#include <dwarf.h>],
> + [int i = DW_FORM_GNU_ref_alt;])],
> + [have_dwarf2_dwz_multifile=yes],
> + [have_dwarf2_dwz_multifile=no])
> + AC_MSG_RESULT([$have_dwarf2_dwz_multifile])],
> + [AC_MSG_ERROR([dwarf.h required for standalone build])])
> +fi
This isn't right. Using test -n "${with_target_subdir}" tests whether
libbacktrace is being built as a target library, using the newly built
compiler. It does not test whether it is being used in a standalone
build. with_target_subdir will be empty when building libbacktrace as
part of the host compiler. In that case we still want to use
include/dwarf2.def, and we do not want to give an error if the system
does not have dwarf.h.
> +#include "backtrace.h"
> +#include "internal.h"
Please keep these after the #include of the other header files.
> +#ifdef IN_GCC
> #include "dwarf2.h"
> #include "filenames.h"
> +#else
> +#include <dwarf.h>
> +typedef int dwarf_attribute;
> +typedef int dwarf_form;
> +typedef int dwarf_tag;
>
> -#include "backtrace.h"
> -#include "internal.h"
> +#define IS_ABSOLUTE_PATH(f) ((f)[0] == '/')
> +#endif
In the case where IN_GCC is defined, where are the types
dwarf_attribute, dwarf_form, and dwarf_tag defined?
When IN_GCC is defined, something needs to ensure that
HAVE_DWARF2_FISSION and HAVE_DWARF2_DWZ_MULTIFILE are defined.
Ian
More information about the Gcc-patches
mailing list