From d3c4cbd30f2e5e43a9b09add43c51e9b38f617f9 Mon Sep 17 00:00:00 2001 From: "thestig@chromium.org" Date: Wed, 10 Apr 2013 03:33:09 +0000 Subject: Fix build on Android - put the missing NT_GNU_BUILD_ID #define in elf_gnu_compat.h and use it where needed. Review URL: https://breakpad.appspot.com/554004 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1146 4c0a9323-5329-0410-9bdc-e9ce6186880e --- src/common/linux/elf_gnu_compat.h | 46 ++++++++++++++++++++++++++++++++++++ src/common/linux/file_id.cc | 5 +--- src/common/linux/file_id_unittest.cc | 1 + src/common/linux/synth_elf.cc | 5 +--- 4 files changed, 49 insertions(+), 8 deletions(-) create mode 100644 src/common/linux/elf_gnu_compat.h diff --git a/src/common/linux/elf_gnu_compat.h b/src/common/linux/elf_gnu_compat.h new file mode 100644 index 00000000..f870cbc7 --- /dev/null +++ b/src/common/linux/elf_gnu_compat.h @@ -0,0 +1,46 @@ +// -*- mode: C++ -*- + +// Copyright (c) 2013, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Original author: Lei Zhang + +// elf_gnu_compat.h: #defines unique to glibc's elf.h. + +#ifndef COMMON_LINUX_ELF_GNU_COMPAT_H_ +#define COMMON_LINUX_ELF_GNU_COMPAT_H_ + +#include + +// A note type on GNU systems corresponding to the .note.gnu.build-id section. +#ifndef NT_GNU_BUILD_ID +#define NT_GNU_BUILD_ID 3 +#endif + +#endif // COMMON_LINUX_ELF_GNU_COMPAT_H_ diff --git a/src/common/linux/file_id.cc b/src/common/linux/file_id.cc index ca5a3e1f..e3631785 100644 --- a/src/common/linux/file_id.cc +++ b/src/common/linux/file_id.cc @@ -40,6 +40,7 @@ #include +#include "common/linux/elf_gnu_compat.h" #include "common/linux/elfutils.h" #include "common/linux/linux_libc_support.h" #include "common/linux/memory_mapped_file.h" @@ -47,10 +48,6 @@ namespace google_breakpad { -#ifndef NT_GNU_BUILD_ID -#define NT_GNU_BUILD_ID 3 -#endif - FileID::FileID(const char* path) { strncpy(path_, path, sizeof(path_)); } diff --git a/src/common/linux/file_id_unittest.cc b/src/common/linux/file_id_unittest.cc index bcd030dc..4bf4f8df 100644 --- a/src/common/linux/file_id_unittest.cc +++ b/src/common/linux/file_id_unittest.cc @@ -34,6 +34,7 @@ #include +#include "common/linux/elf_gnu_compat.h" #include "common/linux/elfutils.h" #include "common/linux/file_id.h" #include "common/linux/safe_readlink.h" diff --git a/src/common/linux/synth_elf.cc b/src/common/linux/synth_elf.cc index 9cd03ef8..b978550f 100644 --- a/src/common/linux/synth_elf.cc +++ b/src/common/linux/synth_elf.cc @@ -5,15 +5,12 @@ #include #include +#include "common/linux/elf_gnu_compat.h" #include "common/using_std_string.h" namespace google_breakpad { namespace synth_elf { -#ifndef NT_GNU_BUILD_ID -#define NT_GNU_BUILD_ID 3 -#endif - ELF::ELF(uint16_t machine, uint8_t file_class, Endianness endianness) -- cgit v1.2.1