summaryrefslogtreecommitdiffstats
path: root/meta-openembedded/meta-oe/recipes-devtools/ltrace
diff options
context:
space:
mode:
authorDave Cobbley <david.j.cobbley@linux.intel.com>2018-08-14 10:05:37 -0700
committerBrad Bishop <bradleyb@fuzziesquirrel.com>2018-08-22 21:26:31 -0400
commiteb8dc40360f0cfef56fb6947cc817a547d6d9bc6 (patch)
treede291a73dc37168da6370e2cf16c347d1eba9df8 /meta-openembedded/meta-oe/recipes-devtools/ltrace
parent9c3cf826d853102535ead04cebc2d6023eff3032 (diff)
downloadtalos-openbmc-eb8dc40360f0cfef56fb6947cc817a547d6d9bc6.tar.gz
talos-openbmc-eb8dc40360f0cfef56fb6947cc817a547d6d9bc6.zip
[Subtree] Removing import-layers directory
As part of the move to subtrees, need to bring all the import layers content to the top level. Change-Id: I4a163d10898cbc6e11c27f776f60e1a470049d8f Signed-off-by: Dave Cobbley <david.j.cobbley@linux.intel.com> Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
Diffstat (limited to 'meta-openembedded/meta-oe/recipes-devtools/ltrace')
-rw-r--r--meta-openembedded/meta-oe/recipes-devtools/ltrace/ltrace/0001-ARM-code-has-unreachable-code-after-switch-statement.patch40
-rw-r--r--meta-openembedded/meta-oe/recipes-devtools/ltrace/ltrace/0001-Add-support-for-mips64-n32-n64.patch1148
-rw-r--r--meta-openembedded/meta-oe/recipes-devtools/ltrace/ltrace/0001-Fix-tautological-compare-warning.patch261
-rw-r--r--meta-openembedded/meta-oe/recipes-devtools/ltrace/ltrace/0001-Use-correct-enum-type.patch28
-rw-r--r--meta-openembedded/meta-oe/recipes-devtools/ltrace/ltrace/0001-configure-Recognise-linux-musl-as-a-host-OS.patch25
-rw-r--r--meta-openembedded/meta-oe/recipes-devtools/ltrace/ltrace/0001-mips-plt.c-Delete-include-error.h.patch27
-rw-r--r--meta-openembedded/meta-oe/recipes-devtools/ltrace/ltrace/0001-replace-readdir_r-with-readdir.patch36
-rw-r--r--meta-openembedded/meta-oe/recipes-devtools/ltrace/ltrace/0002-Fix-const-qualifier-error.patch76
-rw-r--r--meta-openembedded/meta-oe/recipes-devtools/ltrace/ltrace/configure-allow-to-disable-selinux-support.patch36
-rw-r--r--meta-openembedded/meta-oe/recipes-devtools/ltrace/ltrace_git.bb39
10 files changed, 1716 insertions, 0 deletions
diff --git a/meta-openembedded/meta-oe/recipes-devtools/ltrace/ltrace/0001-ARM-code-has-unreachable-code-after-switch-statement.patch b/meta-openembedded/meta-oe/recipes-devtools/ltrace/ltrace/0001-ARM-code-has-unreachable-code-after-switch-statement.patch
new file mode 100644
index 000000000..4d0e0392f
--- /dev/null
+++ b/meta-openembedded/meta-oe/recipes-devtools/ltrace/ltrace/0001-ARM-code-has-unreachable-code-after-switch-statement.patch
@@ -0,0 +1,40 @@
+From 95ff340a74af16cca89fd5c5ca99890821053209 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Sat, 22 Apr 2017 00:47:16 -0700
+Subject: [PATCH] ARM code has unreachable code after switch statement move
+ initialization
+
+Fixed
+sysdeps/linux-gnu/arm/trace.c:173:33: error: statement will never be executed [-Werror=switch-unreachable]
+ uint32_t operand1, operand2, result = 0;
+ ^~~~~~
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ sysdeps/linux-gnu/arm/trace.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/sysdeps/linux-gnu/arm/trace.c b/sysdeps/linux-gnu/arm/trace.c
+index 5e51e91..f974d1f 100644
+--- a/sysdeps/linux-gnu/arm/trace.c
++++ b/sysdeps/linux-gnu/arm/trace.c
+@@ -155,6 +155,8 @@ arm_get_next_pcs(struct process *proc,
+ const unsigned cond = BITS(this_instr, 28, 31);
+ const unsigned opcode = BITS(this_instr, 24, 27);
+
++ uint32_t operand1, operand2, result = 0;
++
+ if (cond == COND_NV)
+ switch (opcode) {
+ arch_addr_t addr;
+@@ -170,7 +172,6 @@ arm_get_next_pcs(struct process *proc,
+ }
+ else
+ switch (opcode) {
+- uint32_t operand1, operand2, result = 0;
+ case 0x0:
+ case 0x1: /* data processing */
+ case 0x2:
+--
+2.12.2
+
diff --git a/meta-openembedded/meta-oe/recipes-devtools/ltrace/ltrace/0001-Add-support-for-mips64-n32-n64.patch b/meta-openembedded/meta-oe/recipes-devtools/ltrace/ltrace/0001-Add-support-for-mips64-n32-n64.patch
new file mode 100644
index 000000000..d0daf1466
--- /dev/null
+++ b/meta-openembedded/meta-oe/recipes-devtools/ltrace/ltrace/0001-Add-support-for-mips64-n32-n64.patch
@@ -0,0 +1,1148 @@
+From 5f6dfafb80bdc2566fe91d5fde96769175fabf35 Mon Sep 17 00:00:00 2001
+From: Faraz Shahbazker <faraz.shahbazker@imgtec.com>
+Date: Sat, 1 Jul 2017 10:56:59 -0700
+Subject: [PATCH] Add support for mips64 n32/n64
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: Pending
+Source: http://lists.alioth.debian.org/pipermail/ltrace-devel/2015-May/001327.html
+
+ backend.h | 8 +
+ ltrace-elf.c | 12 ++
+ proc.h | 1 +
+ sysdeps/linux-gnu/mips/Makefile.am | 1 +
+ sysdeps/linux-gnu/mips/abi.c | 64 +++++++
+ sysdeps/linux-gnu/mips/arch.h | 24 ++-
+ sysdeps/linux-gnu/mips/plt.c | 68 ++++++--
+ sysdeps/linux-gnu/mips/signalent1.h | 52 ++++++
+ sysdeps/linux-gnu/mips/syscallent1.h | 328 +++++++++++++++++++++++++++++++++++
+ sysdeps/linux-gnu/mips/trace.c | 241 ++++++++++++++++++-------
+ sysdeps/linux-gnu/mksyscallent_mips | 9 +-
+ 11 files changed, 728 insertions(+), 80 deletions(-)
+ create mode 100644 sysdeps/linux-gnu/mips/abi.c
+ create mode 100644 sysdeps/linux-gnu/mips/signalent1.h
+ create mode 100644 sysdeps/linux-gnu/mips/syscallent1.h
+
+diff --git a/backend.h b/backend.h
+index e25daa0..0d6926a 100644
+--- a/backend.h
++++ b/backend.h
+@@ -314,6 +314,14 @@ int arch_process_exec(struct process *proc);
+ int arch_get_sym_info(struct ltelf *lte, const char *filename, size_t sym_index,
+ GElf_Rela *rela, GElf_Sym *sym);
+
++/* The following callback has to be implemented in backend if arch.h
++ * defines ARCH_HAVE_GET_ABI
++ *
++ * This is called from read_module just once, when reading the main module.
++ * The value returned is an architecture specific ID for the current ABI
++ * to be used later for ABI-specific operations. */
++char arch_get_abi(GElf_Ehdr ehdr);
++
+ enum plt_status {
+ PLT_FAIL,
+ PLT_OK,
+diff --git a/ltrace-elf.c b/ltrace-elf.c
+index f439cb0..a85edca 100644
+--- a/ltrace-elf.c
++++ b/ltrace-elf.c
+@@ -1131,6 +1131,14 @@ populate_symtab(struct process *proc, const char *filename,
+ only_exported_names);
+ }
+
++#ifndef ARCH_HAVE_GET_ABI
++char
++arch_get_abi(GElf_Ehdr ehdr)
++{
++ return 0;
++}
++#endif
++
+ static int
+ read_module(struct library *lib, struct process *proc,
+ const char *filename, GElf_Addr bias, int main)
+@@ -1151,6 +1159,10 @@ read_module(struct library *lib, struct process *proc,
+ * with 32-bit ltrace. It is desirable to preserve this. */
+ proc->e_machine = lte.ehdr.e_machine;
+ proc->e_class = lte.ehdr.e_ident[EI_CLASS];
++ /* Another candidate for the ABI module. We probably
++ * want to do all of the e_* stuff only once, for main */
++ if (main)
++ proc->e_abi = arch_get_abi(lte.ehdr);
+ get_arch_dep(proc);
+
+ /* Find out the base address. For PIE main binaries we look
+diff --git a/proc.h b/proc.h
+index a611456..00094e1 100644
+--- a/proc.h
++++ b/proc.h
+@@ -117,6 +117,7 @@ struct process {
+ * nauseam. */
+ short e_machine;
+ char e_class;
++ char e_abi;
+
+ #if defined(HAVE_LIBDW)
+ /* Unwind info for leader, NULL for non-leader procs. */
+diff --git a/sysdeps/linux-gnu/mips/Makefile.am b/sysdeps/linux-gnu/mips/Makefile.am
+index 1fd8c2a..571ee0d 100644
+--- a/sysdeps/linux-gnu/mips/Makefile.am
++++ b/sysdeps/linux-gnu/mips/Makefile.am
+@@ -20,6 +20,7 @@ noinst_LTLIBRARIES = \
+ ../libcpu.la
+
+ ___libcpu_la_SOURCES = \
++ abi.c \
+ plt.c \
+ regs.c \
+ trace.c
+diff --git a/sysdeps/linux-gnu/mips/abi.c b/sysdeps/linux-gnu/mips/abi.c
+new file mode 100644
+index 0000000..64e3c10
+--- /dev/null
++++ b/sysdeps/linux-gnu/mips/abi.c
+@@ -0,0 +1,64 @@
++/*
++ * This file is part of ltrace.
++ * Copyright (C) 2015 Imagination Technologies Limited
++ *
++ * This program is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU General Public License as
++ * published by the Free Software Foundation; either version 2 of the
++ * License, or (at your option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful, but
++ * WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ * General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program; if not, write to the Free Software
++ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
++ * 02110-1301 USA
++ */
++
++#include <stdio.h>
++#include <gelf.h>
++#include "arch.h"
++
++/*
++ * There is no bit in the header-flags to mark N64 ABI, it must be
++ * determined by exclusion of other ABIs. The following values are
++ * from elfcpp/mips.h in binutils sources
++ */
++enum
++{
++ E_MIPS_ABI_MASK = 0x0000F000,
++ E_MIPS_ABI_N32 = 0x00000020,
++ E_MIPS_ABI_O32 = 0x00001000,
++ E_MIPS_ABI_O64 = 0x00002000,
++ E_MIPS_ABI_EABI32 = 0x00003000,
++ E_MIPS_ABI_EABI64 = 0x00004000,
++};
++
++char
++arch_get_abi(GElf_Ehdr ehdr)
++{
++ enum mips_abi_type abi;
++ switch (ehdr.e_flags & E_MIPS_ABI_MASK) {
++ case E_MIPS_ABI_O32:
++ abi = ABI_O32; break;
++ case E_MIPS_ABI_O64:
++ abi = ABI_O64; break;
++ case E_MIPS_ABI_EABI32:
++ case E_MIPS_ABI_EABI64:
++ fprintf(stderr, "%s: MIPS EABI is not supported\n", __func__);
++ abi = -1;
++ break;
++ default:
++ if (ehdr.e_flags & E_MIPS_ABI_N32)
++ abi = ABI_N32;
++ else
++ abi = ABI_N64;
++ }
++
++ return abi;
++}
++
++/**@}*/
+diff --git a/sysdeps/linux-gnu/mips/arch.h b/sysdeps/linux-gnu/mips/arch.h
+index 16273d2..8b75df2 100644
+--- a/sysdeps/linux-gnu/mips/arch.h
++++ b/sysdeps/linux-gnu/mips/arch.h
+@@ -1,5 +1,6 @@
+ /*
+ * This file is part of ltrace.
++ * Copyright (C) 2015 Imagination Technologies Limited
+ * Copyright (C) 2013,2014 Petr Machata, Red Hat Inc.
+ * Copyright (C) 2006 Eric Vaitl
+ *
+@@ -38,8 +39,12 @@
+ #define BREAKPOINT_LENGTH 4
+ #define DECR_PC_AFTER_BREAK 0
+
+-#define LT_ELFCLASS ELFCLASS32
++#ifdef __LP64__
++#define LT_ELFCLASS ELFCLASS64
+ #define LT_ELF_MACHINE EM_MIPS
++#endif /* __LP64__ */
++#define LT_ELFCLASS2 ELFCLASS32
++#define LT_ELF_MACHINE2 EM_MIPS
+
+ #define ARCH_HAVE_LTELF_DATA
+ struct arch_ltelf_data {
+@@ -53,8 +58,14 @@ struct arch_ltelf_data {
+ #define ARCH_HAVE_ADD_PLT_ENTRY
+ #define ARCH_HAVE_SW_SINGLESTEP
+ #define ARCH_HAVE_SYMBOL_RET
+-
++#define ARCH_HAVE_GET_ABI
+ #define ARCH_HAVE_LIBRARY_SYMBOL_DATA
++
++#ifdef __LP64__
++#define ARCH_HAVE_SIZEOF
++#define ARCH_HAVE_ALIGNOF
++#endif /* __LP64__ */
++
+ enum mips_plt_type
+ {
+ /* A symbol has associated PLT entry. */
+@@ -73,7 +84,14 @@ enum mips_plt_type
+ MIPS_PLT_NEED_UNRESOLVE,
+ };
+
+-struct mips_unresolve_data;
++enum mips_abi_type
++{
++ ABI_O32,
++ ABI_N32,
++ ABI_N64,
++ ABI_O64,
++};
++
+ struct arch_library_symbol_data {
+ enum mips_plt_type type;
+ union {
+diff --git a/sysdeps/linux-gnu/mips/plt.c b/sysdeps/linux-gnu/mips/plt.c
+index f3c12da..2d85ad9 100644
+--- a/sysdeps/linux-gnu/mips/plt.c
++++ b/sysdeps/linux-gnu/mips/plt.c
+@@ -1,5 +1,6 @@
+ /*
+ * This file is part of ltrace.
++ * Copyright (C) 2015 Imagination Technologies Limited
+ * Copyright (C) 2012,2013,2014 Petr Machata, Red Hat Inc.
+ * Copyright (C) 2012 Edgar E. Iglesias, Axis Communications
+ * Copyright (C) 2008,2009 Juan Cespedes
+@@ -182,6 +183,11 @@ arch_find_dl_debug(struct process *proc, arch_addr_t dyn_addr,
+ {
+ arch_addr_t rld_addr;
+ int r;
++#ifdef __LP64__
++ size_t addrsize = proc->mask_32bit ? 4 : (sizeof *ret);
++#else /* !__LP64__ */
++ size_t addrsize = sizeof *ret;
++#endif /* !__LP64__ */
+
+ /* MIPS puts the address of the r_debug structure into the
+ * DT_MIPS_RLD_MAP entry instead of into the DT_DEBUG entry. */
+@@ -189,7 +195,7 @@ arch_find_dl_debug(struct process *proc, arch_addr_t dyn_addr,
+ DT_MIPS_RLD_MAP, &rld_addr);
+ if (r == 0) {
+ if (umovebytes(proc, rld_addr,
+- ret, sizeof *ret) != sizeof *ret) {
++ ret, addrsize) != addrsize) {
+ r = -1;
+ }
+ }
+@@ -295,14 +301,25 @@ arch_elf_init(struct ltelf *lte, struct library *lib)
+
+ for (j = 0; j < data->d_size / 16; ++j) {
+ uint32_t insn;
++ int got_size = 4;
++ uint32_t load_inst = 0x24180000U; /* addui t8,0,xx */
++
++#ifdef __LP64__
++ if (arch_get_abi(lte->ehdr) == ABI_N64
++ || arch_get_abi(lte->ehdr) == ABI_O64) {
++ got_size = 8;
++ load_inst = 0x64180000U; /* daddui t8,0,xx */
++ }
++#endif /* __LP64__ */
++
+ if (elf_read_u32(data, j * 16 + 12, &insn) < 0)
+ goto fail_stubs;
+
+ if (insn == 0)
+ continue;
+
+- /* 0x2418XXXX encodes lbu 0,t8,XXXX or li t8,XXXX. */
+- if ((insn & 0xffff0000U) != 0x24180000U)
++ /* 0x[62]418XXXX encodes [d]addiu t8, 0, XXXX. */
++ if ((insn & 0xffff0000U) != load_inst)
+ goto fail_stubs;
+
+ unsigned idx = insn & 0xffff;
+@@ -323,8 +340,8 @@ arch_elf_init(struct ltelf *lte, struct library *lib)
+ + lte->arch.mips_local_gotno;
+ /* XXX Double cast. */
+ arch_addr_t got_entry_addr
+- = (arch_addr_t) (uintptr_t) lte->arch.pltgot_addr
+- + got_idx * 4;
++ = (arch_addr_t) (uintptr_t) (lte->arch.pltgot_addr
++ + got_idx * got_size);
+
+ GElf_Rela rela = {
+ /* XXX double cast. */
+@@ -336,7 +353,7 @@ arch_elf_init(struct ltelf *lte, struct library *lib)
+ if (VECT_PUSHBACK(&lte->plt_relocs, &rela) < 0)
+ goto fail_stubs;
+
+- fprintf(stderr,
++ debug(2,
+ "added stub entry for symbol %u at %#lx, GOT @%p\n",
+ idx, (unsigned long) rela.r_addend, got_entry_addr);
+ }
+@@ -362,8 +379,17 @@ read_got_entry(struct process *proc, GElf_Addr addr, GElf_Addr *valp)
+ {
+ /* XXX double cast. */
+ arch_addr_t a = (arch_addr_t) (uintptr_t) addr;
+- uint32_t l;
+- if (proc_read_32(proc, a, &l) < 0) {
++ uint64_t l = 0;
++ int result;
++
++#ifdef __LP64__
++ if (!proc->mask_32bit)
++ result = proc_read_64(proc, a, &l);
++ else
++#endif /* __LP64__ */
++ result = proc_read_32(proc, a, (uint32_t *) &l);
++
++ if (result < 0) {
+ fprintf(stderr, "ptrace read got entry @%#" PRIx64 ": %s\n",
+ addr, strerror(errno));
+ return -1;
+@@ -426,13 +452,13 @@ arch_elf_add_plt_entry(struct process *proc, struct ltelf *lte,
+ GElf_Addr stub_addr = rela->r_addend + lte->bias;
+
+ debug(2, "PLT-less arch_elf_add_plt_entry %s = %#llx\n",
+- a_name, stub_addr);
++ a_name, (unsigned long long) stub_addr);
+
+ struct library_symbol *libsym = NULL;
+ if (default_elf_add_plt_entry(proc, lte, a_name, rela, ndx,
+ &libsym) < 0) {
+- fprintf(stderr, "%s: failed %s(%#llx): %s\n", __func__,
+- a_name, stub_addr, strerror(errno));
++ fprintf(stderr, "%s: failed %s(%#lx): %s\n", __func__,
++ a_name, (unsigned long) stub_addr, strerror(errno));
+ goto fail;
+ }
+
+@@ -503,13 +529,27 @@ jump_to_entry_point(struct process *proc, struct breakpoint *bp)
+ static int
+ unresolve_got_entry(struct process *proc, GElf_Addr addr, GElf_Addr value)
+ {
+- uint32_t v32 = (uint32_t) value;
+- uint32_t a32 = (uint32_t) addr;
+- if (ptrace(PTRACE_POKETEXT, proc->pid, a32, v32) < 0) {
++ arch_addr_t a = (arch_addr_t) (uintptr_t) addr;
++#ifdef __LP64__
++ /* To write 32-bit value in 64-bit mode, we must read-modify-write
++ the 64-bit value with only the lower 32 bits modified. */
++ if (proc->mask_32bit) {
++ GElf_Addr orig = ptrace(PTRACE_PEEKTEXT, proc->pid, a, 0);
++ char *obytes = (char *) &orig;
++ char *nbytes = (char *) &value;
++ unsigned i;
++
++ for (i = 0; i < 4; i++)
++ obytes[i] = nbytes[i];
++ value = orig;
++ }
++#endif /* __LP64__ */
++ if (ptrace(PTRACE_POKETEXT, proc->pid, a, (unsigned long) value) < 0) {
+ fprintf(stderr, "failed to unresolve GOT entry: %s\n",
+ strerror(errno));
+ return -1;
+ }
++
+ return 0;
+ }
+
+diff --git a/sysdeps/linux-gnu/mips/signalent1.h b/sysdeps/linux-gnu/mips/signalent1.h
+new file mode 100644
+index 0000000..9e9d1f7
+--- /dev/null
++++ b/sysdeps/linux-gnu/mips/signalent1.h
+@@ -0,0 +1,52 @@
++/*
++ * This file is part of ltrace.
++ * Copyright (C) 2015 Imagination Technologies Limited
++ *
++ * This program is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU General Public License as
++ * published by the Free Software Foundation; either version 2 of the
++ * License, or (at your option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful, but
++ * WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ * General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program; if not, write to the Free Software
++ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
++ * 02110-1301 USA
++ */
++
++ "SIG_0", /* 0 */
++ "SIGHUP", /* 1 */
++ "SIGINT", /* 2 */
++ "SIGQUIT", /* 3 */
++ "SIGILL", /* 4 */
++ "SIGTRAP", /* 5 */
++ "SIGIOT", /* 6 */
++ "SIGEMT", /* 7 */
++ "SIGFPE", /* 8 */
++ "SIGKILL", /* 9 */
++ "SIGBUS", /* 10 */
++ "SIGSEGV", /* 11 */
++ "SIGSYS", /* 12 */
++ "SIGPIPE", /* 13 */
++ "SIGALRM", /* 14 */
++ "SIGTERM", /* 15 */
++ "SIGUSR1", /* 16 */
++ "SIGUSR2", /* 17 */
++ "SIGCHLD", /* 18 */
++ "SIGPWR", /* 19 */
++ "SIGWINCH", /* 20 */
++ "SIGURG", /* 21 */
++ "SIGIO", /* 22 */
++ "SIGSTOP", /* 23 */
++ "SIGTSTP", /* 24 */
++ "SIGCONT", /* 25 */
++ "SIGTTIN", /* 26 */
++ "SIGTTOU", /* 27 */
++ "SIGVTALRM", /* 28 */
++ "SIGPROF", /* 29 */
++ "SIGXCPU", /* 30 */
++ "SIGXFSZ", /* 31 */
+diff --git a/sysdeps/linux-gnu/mips/syscallent1.h b/sysdeps/linux-gnu/mips/syscallent1.h
+new file mode 100644
+index 0000000..dfa4954
+--- /dev/null
++++ b/sysdeps/linux-gnu/mips/syscallent1.h
+@@ -0,0 +1,328 @@
++/*
++ * This file is part of ltrace.
++ * Copyright (C) 2015 Imagination Technologies Limited
++ *
++ * This program is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU General Public License as
++ * published by the Free Software Foundation; either version 2 of the
++ * License, or (at your option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful, but
++ * WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ * General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program; if not, write to the Free Software
++ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
++ * 02110-1301 USA
++ */
++
++/* MIPS64 */
++
++ "read", /* 0 */
++ "write", /* 1 */
++ "open", /* 2 */
++ "close", /* 3 */
++ "stat", /* 4 */
++ "fstat", /* 5 */
++ "lstat", /* 6 */
++ "poll", /* 7 */
++ "lseek", /* 8 */
++ "mmap", /* 9 */
++ "mprotect", /* 10 */
++ "munmap", /* 11 */
++ "brk", /* 12 */
++ "rt_sigaction", /* 13 */
++ "rt_sigprocmask", /* 14 */
++ "ioctl", /* 15 */
++ "pread64", /* 16 */
++ "pwrite64", /* 17 */
++ "readv", /* 18 */
++ "writev", /* 19 */
++ "access", /* 20 */
++ "pipe", /* 21 */
++ "_newselect", /* 22 */
++ "sched_yield", /* 23 */
++ "mremap", /* 24 */
++ "msync", /* 25 */
++ "mincore", /* 26 */
++ "madvise", /* 27 */
++ "shmget", /* 28 */
++ "shmat", /* 29 */
++ "shmctl", /* 30 */
++ "dup", /* 31 */
++ "dup2", /* 32 */
++ "pause", /* 33 */
++ "nanosleep", /* 34 */
++ "getitimer", /* 35 */
++ "setitimer", /* 36 */
++ "alarm", /* 37 */
++ "getpid", /* 38 */
++ "sendfile", /* 39 */
++ "socket", /* 40 */
++ "connect", /* 41 */
++ "accept", /* 42 */
++ "sendto", /* 43 */
++ "recvfrom", /* 44 */
++ "sendmsg", /* 45 */
++ "recvmsg", /* 46 */
++ "shutdown", /* 47 */
++ "bind", /* 48 */
++ "listen", /* 49 */
++ "getsockname", /* 50 */
++ "getpeername", /* 51 */
++ "socketpair", /* 52 */
++ "setsockopt", /* 53 */
++ "getsockopt", /* 54 */
++ "clone", /* 55 */
++ "fork", /* 56 */
++ "execve", /* 57 */
++ "exit", /* 58 */
++ "wait4", /* 59 */
++ "kill", /* 60 */
++ "uname", /* 61 */
++ "semget", /* 62 */
++ "semop", /* 63 */
++ "semctl", /* 64 */
++ "shmdt", /* 65 */
++ "msgget", /* 66 */
++ "msgsnd", /* 67 */
++ "msgrcv", /* 68 */
++ "msgctl", /* 69 */
++ "fcntl", /* 70 */
++ "flock", /* 71 */
++ "fsync", /* 72 */
++ "fdatasync", /* 73 */
++ "truncate", /* 74 */
++ "ftruncate", /* 75 */
++ "getdents", /* 76 */
++ "getcwd", /* 77 */
++ "chdir", /* 78 */
++ "fchdir", /* 79 */
++ "rename", /* 80 */
++ "mkdir", /* 81 */
++ "rmdir", /* 82 */
++ "creat", /* 83 */
++ "link", /* 84 */
++ "unlink", /* 85 */
++ "symlink", /* 86 */
++ "readlink", /* 87 */
++ "chmod", /* 88 */
++ "fchmod", /* 89 */
++ "chown", /* 90 */
++ "fchown", /* 91 */
++ "lchown", /* 92 */
++ "umask", /* 93 */
++ "gettimeofday", /* 94 */
++ "getrlimit", /* 95 */
++ "getrusage", /* 96 */
++ "sysinfo", /* 97 */
++ "times", /* 98 */
++ "ptrace", /* 99 */
++ "getuid", /* 100 */
++ "syslog", /* 101 */
++ "getgid", /* 102 */
++ "setuid", /* 103 */
++ "setgid", /* 104 */
++ "geteuid", /* 105 */
++ "getegid", /* 106 */
++ "setpgid", /* 107 */
++ "getppid", /* 108 */
++ "getpgrp", /* 109 */
++ "setsid", /* 110 */
++ "setreuid", /* 111 */
++ "setregid", /* 112 */
++ "getgroups", /* 113 */
++ "setgroups", /* 114 */
++ "setresuid", /* 115 */
++ "getresuid", /* 116 */
++ "setresgid", /* 117 */
++ "getresgid", /* 118 */
++ "getpgid", /* 119 */
++ "setfsuid", /* 120 */
++ "setfsgid", /* 121 */
++ "getsid", /* 122 */
++ "capget", /* 123 */
++ "capset", /* 124 */
++ "rt_sigpending", /* 125 */
++ "rt_sigtimedwait", /* 126 */
++ "rt_sigqueueinfo", /* 127 */
++ "rt_sigsuspend", /* 128 */
++ "sigaltstack", /* 129 */
++ "utime", /* 130 */
++ "mknod", /* 131 */
++ "personality", /* 132 */
++ "ustat", /* 133 */
++ "statfs", /* 134 */
++ "fstatfs", /* 135 */
++ "sysfs", /* 136 */
++ "getpriority", /* 137 */
++ "setpriority", /* 138 */
++ "sched_setparam", /* 139 */
++ "sched_getparam", /* 140 */
++ "sched_setscheduler", /* 141 */
++ "sched_getscheduler", /* 142 */
++ "sched_get_priority_max", /* 143 */
++ "sched_get_priority_min", /* 144 */
++ "sched_rr_get_interval", /* 145 */
++ "mlock", /* 146 */
++ "munlock", /* 147 */
++ "mlockall", /* 148 */
++ "munlockall", /* 149 */
++ "vhangup", /* 150 */
++ "pivot_root", /* 151 */
++ "_sysctl", /* 152 */
++ "prctl", /* 153 */
++ "adjtimex", /* 154 */
++ "setrlimit", /* 155 */
++ "chroot", /* 156 */
++ "sync", /* 157 */
++ "acct", /* 158 */
++ "settimeofday", /* 159 */
++ "mount", /* 160 */
++ "umount2", /* 161 */
++ "swapon", /* 162 */
++ "swapoff", /* 163 */
++ "reboot", /* 164 */
++ "sethostname", /* 165 */
++ "setdomainname", /* 166 */
++ "create_module", /* 167 */
++ "init_module", /* 168 */
++ "delete_module", /* 169 */
++ "get_kernel_syms", /* 170 */
++ "query_module", /* 171 */
++ "quotactl", /* 172 */
++ "nfsservctl", /* 173 */
++ "getpmsg", /* 174 */
++ "putpmsg", /* 175 */
++ "afs_syscall", /* 176 */
++ "reserved177", /* 177 */
++ "gettid", /* 178 */
++ "readahead", /* 179 */
++ "setxattr", /* 180 */
++ "lsetxattr", /* 181 */
++ "fsetxattr", /* 182 */
++ "getxattr", /* 183 */
++ "lgetxattr", /* 184 */
++ "fgetxattr", /* 185 */
++ "listxattr", /* 186 */
++ "llistxattr", /* 187 */
++ "flistxattr", /* 188 */
++ "removexattr", /* 189 */
++ "lremovexattr", /* 190 */
++ "fremovexattr", /* 191 */
++ "tkill", /* 192 */
++ "reserved193", /* 193 */
++ "futex", /* 194 */
++ "sched_setaffinity", /* 195 */
++ "sched_getaffinity", /* 196 */
++ "cacheflush", /* 197 */
++ "cachectl", /* 198 */
++ "sysmips", /* 199 */
++ "io_setup", /* 200 */
++ "io_destroy", /* 201 */
++ "io_getevents", /* 202 */
++ "io_submit", /* 203 */
++ "io_cancel", /* 204 */
++ "exit_group", /* 205 */
++ "lookup_dcookie", /* 206 */
++ "epoll_create", /* 207 */
++ "epoll_ctl", /* 208 */
++ "epoll_wait", /* 209 */
++ "remap_file_pages", /* 210 */
++ "rt_sigreturn", /* 211 */
++ "set_tid_address", /* 212 */
++ "restart_syscall", /* 213 */
++ "semtimedop", /* 214 */
++ "fadvise64", /* 215 */
++ "timer_create", /* 216 */
++ "timer_settime", /* 217 */
++ "timer_gettime", /* 218 */
++ "timer_getoverrun", /* 219 */
++ "timer_delete", /* 220 */
++ "clock_settime", /* 221 */
++ "clock_gettime", /* 222 */
++ "clock_getres", /* 223 */
++ "clock_nanosleep", /* 224 */
++ "tgkill", /* 225 */
++ "utimes", /* 226 */
++ "mbind", /* 227 */
++ "get_mempolicy", /* 228 */
++ "set_mempolicy", /* 229 */
++ "mq_open", /* 230 */
++ "mq_unlink", /* 231 */
++ "mq_timedsend", /* 232 */
++ "mq_timedreceive", /* 233 */
++ "mq_notify", /* 234 */
++ "mq_getsetattr", /* 235 */
++ "vserver", /* 236 */
++ "waitid", /* 237 */
++ "238", /* 238 */
++ "add_key", /* 239 */
++ "request_key", /* 240 */
++ "keyctl", /* 241 */
++ "set_thread_area", /* 242 */
++ "inotify_init", /* 243 */
++ "inotify_add_watch", /* 244 */
++ "inotify_rm_watch", /* 245 */
++ "migrate_pages", /* 246 */
++ "openat", /* 247 */
++ "mkdirat", /* 248 */
++ "mknodat", /* 249 */
++ "fchownat", /* 250 */
++ "futimesat", /* 251 */
++ "newfstatat", /* 252 */
++ "unlinkat", /* 253 */
++ "renameat", /* 254 */
++ "linkat", /* 255 */
++ "symlinkat", /* 256 */
++ "readlinkat", /* 257 */
++ "fchmodat", /* 258 */
++ "faccessat", /* 259 */
++ "pselect6", /* 260 */
++ "ppoll", /* 261 */
++ "unshare", /* 262 */
++ "splice", /* 263 */
++ "sync_file_range", /* 264 */
++ "tee", /* 265 */
++ "vmsplice", /* 266 */
++ "move_pages", /* 267 */
++ "set_robust_list", /* 268 */
++ "get_robust_list", /* 269 */
++ "kexec_load", /* 270 */
++ "getcpu", /* 271 */
++ "epoll_pwait", /* 272 */
++ "ioprio_set", /* 273 */
++ "ioprio_get", /* 274 */
++ "utimensat", /* 275 */
++ "signalfd", /* 276 */
++ "timerfd", /* 277 */
++ "eventfd", /* 278 */
++ "fallocate", /* 279 */
++ "timerfd_create", /* 280 */
++ "timerfd_gettime", /* 281 */
++ "timerfd_settime", /* 282 */
++ "signalfd4", /* 283 */
++ "eventfd2", /* 284 */
++ "epoll_create1", /* 285 */
++ "dup3", /* 286 */
++ "pipe2", /* 287 */
++ "inotify_init1", /* 288 */
++ "preadv", /* 289 */
++ "pwritev", /* 290 */
++ "rt_tgsigqueueinfo", /* 291 */
++ "perf_event_open", /* 292 */
++ "accept4", /* 293 */
++ "recvmmsg", /* 294 */
++ "fanotify_init", /* 295 */
++ "fanotify_mark", /* 296 */
++ "prlimit64", /* 297 */
++ "name_to_handle_at", /* 298 */
++ "open_by_handle_at", /* 299 */
++ "clock_adjtime", /* 300 */
++ "syncfs", /* 301 */
++ "sendmmsg", /* 302 */
++ "setns", /* 303 */
++ "process_vm_readv", /* 304 */
++ "process_vm_writev", /* 305 */
+diff --git a/sysdeps/linux-gnu/mips/trace.c b/sysdeps/linux-gnu/mips/trace.c
+index e81b374..d54818e 100644
+--- a/sysdeps/linux-gnu/mips/trace.c
++++ b/sysdeps/linux-gnu/mips/trace.c
+@@ -1,5 +1,6 @@
+ /*
+ * This file is part of ltrace.
++ * Copyright (C) 2015 Imagination Technologies Limited
+ * Copyright (C) 2013 Petr Machata, Red Hat Inc.
+ * Copyright (C) 2012 Edgar E. Iglesias, Axis Communications
+ * Copyright (C) 2010 Arnaud Patard, Mandriva SA
+@@ -29,6 +30,7 @@
+ #include <signal.h>
+ #include <sys/ptrace.h>
+ #include <asm/ptrace.h>
++#include <asm/unistd.h>
+ #include <assert.h>
+ #include <asm/unistd.h>
+
+@@ -68,6 +70,44 @@
+ void
+ get_arch_dep(struct process *proc)
+ {
++#ifdef __LP64__
++ proc->mask_32bit = (proc->e_class == ELFCLASS32);
++#endif /* __LP64__ */
++ /* n32 personality is best approximated by n64,
++ at least for syscall numbers */
++ proc->personality = (proc->e_class == ELFCLASS64
++ || proc->e_abi == ABI_N32);
++}
++
++/**
++ \param abi ABI of current process, from mips_abi_type enum
++ \param list An array of 4 elements, each corresponding to an ABI, in
++ the order: o32, n32, n64, o64
++
++ return value from array corresponding to requested ABI
++ */
++static int
++abi_select(const int abi, const int list[])
++{
++ int retval;
++ switch (abi)
++ {
++ case ABI_N32:
++ retval = list[1];
++ break;
++ case ABI_N64:
++ retval = list[2];
++ break;
++ case ABI_O64:
++ retval = list[3];
++ break;
++ case ABI_O32:
++ default:
++ retval = list[0];
++ break;
++ }
++
++ return retval;
+ }
+
+ /**
+@@ -90,53 +130,94 @@ get_arch_dep(struct process *proc)
+ int
+ syscall_p(struct process *proc, int status, int *sysnum)
+ {
+- if (WIFSTOPPED(status)
+- && WSTOPSIG(status) == (SIGTRAP | proc->tracesysgood)) {
+- /* get the user's pc (plus 8) */
+- long pc = (long)get_instruction_pointer(proc);
+- /* fetch the SWI instruction */
+- int insn = ptrace(PTRACE_PEEKTEXT, proc->pid, pc - 4, 0);
+- int num = ptrace(PTRACE_PEEKTEXT, proc->pid, pc - 8, 0);
+-
+- /*
+- On a mips, syscall looks like:
+- 24040fa1 li v0, 0x0fa1 # 4001 --> _exit syscall
+- 0000000c syscall
+- */
+- if(insn!=0x0000000c){
+- /* sigreturn returns control to the point
+- where the signal was received; skip check
+- for preceeding syscall instruction */
+- int depth = proc->callstack_depth;
+- struct callstack_element *top = NULL;
+- if (depth > 0)
+- top = &proc->callstack[depth - 1];
+-
+- if (top != NULL && top->is_syscall &&
+- (top->c_un.syscall == (__NR_rt_sigreturn -
+- __NR_Linux) ||
+- top->c_un.syscall == (__NR_sigreturn -
+- __NR_Linux))) {
+- *sysnum = top->c_un.syscall;
+- return 2;
+- }
+- else
+- return 0;
+- }
+-
+- *sysnum = (num & 0xFFFF) - 4000;
+- /* if it is a syscall, return 1 or 2 */
+- if (proc->callstack_depth > 0 &&
+- proc->callstack[proc->callstack_depth - 1].is_syscall &&
+- proc->callstack[proc->callstack_depth - 1].c_un.syscall == *sysnum) {
++ unsigned long pc;
++ int insn, prev;
++ int min_syscall, max_syscall, sigreturn, rt_sigreturn;
++ struct callstack_element *top = NULL;
++ int depth = proc->callstack_depth;
++ const int syscallbase[] = {__NR_O32_Linux, __NR_N32_Linux,
++ __NR_64_Linux, __NR_O32_Linux};
++ const int syscallnum[] = {__NR_O32_Linux_syscalls,
++ __NR_N32_Linux_syscalls,
++ __NR_64_Linux_syscalls,
++ __NR_O32_Linux_syscalls};
++ const int rt_sigreturn_list[] = {193, 211, 211, 193};
++ const int sigreturn_list[] = {119, -1, -1, 119};
++
++ if (!WIFSTOPPED(status)
++ || WSTOPSIG(status) != (SIGTRAP | proc->tracesysgood))
++ return 0;
++
++ /* get the user's pc (plus 8) */
++ pc = (unsigned long)get_instruction_pointer(proc);
++ /* fetch the SWI instruction */
++ insn = ptrace(PTRACE_PEEKTEXT, proc->pid, pc - 4, 0);
++ prev = ptrace(PTRACE_PEEKTEXT, proc->pid, pc - 8, 0);
++
++ if (depth > 0)
++ top = &proc->callstack[depth - 1];
++
++ /* Range of syscall numbers varies with ABI; ref:asm/unistd.h */
++ min_syscall = abi_select(proc->e_abi, syscallbase);
++ max_syscall = min_syscall + abi_select(proc->e_abi, syscallnum);
++ sigreturn = min_syscall + abi_select(proc->e_abi, sigreturn_list);
++ rt_sigreturn = min_syscall + abi_select(proc->e_abi, rt_sigreturn_list);
++
++ /* not a syscall instruction */
++ if(insn!=0x0000000c){
++ /* sigreturn returns control to the point where the signal was
++ received; skip check for preceeding syscall instruction */
++ if (top != NULL && top->is_syscall
++ && (top->c_un.syscall == (rt_sigreturn - min_syscall)
++ || top->c_un.syscall == (sigreturn - min_syscall))) {
++ *sysnum = top->c_un.syscall;
+ return 2;
+ }
++ else
++ return 0;
++ }
+
+- if (*sysnum >= 0) {
+- return 1;
+- }
++ /*
++ On a mips, syscall looks like:
++ 24020fa1 li v0, 0x0fa1 # 4001 --> _exit syscall
++ 0000000c syscall
++ */
++ if ((prev & 0xFFFF0000) == 0x24020000) {
++ *sysnum = (prev & 0xFFFF) - min_syscall;
+ }
+- return 0;
++ /*
++ The above is not necessary in Linux kernel > v2.6.35. Recent
++ kernels have a fancy-pants method of restarting syscalls.
++ We must read v0 instead, to get the syscall number.
++
++ Unfortunately, v0 is not preserved till the point of return.
++ If already in syscall and v0 is invalid, assume this event
++ to be a return without attempting to match previous syscall.
++
++ Caveat: logic fails if v0 incidentally contains a valid
++ syscall number, distinct from the current syscall number,
++ at the point of return from a nested syscall.
++ */
++ else {
++ int v0 = ptrace(PTRACE_PEEKUSER, proc->pid, off_v0, 0);
++
++ if ((v0 >= min_syscall) && (v0 <= max_syscall))
++ *sysnum = v0 - min_syscall;
++ else if (depth > 0 && top->is_syscall)
++ *sysnum = top->c_un.syscall;
++ else /* syscall instruction without valid number - ignored */
++ return 0;
++ }
++
++ /* if it is a syscall, return 1 or 2 */
++ if (depth > 0 && top->is_syscall && top->c_un.syscall == *sysnum) {
++ return 2;
++ }
++
++ if (*sysnum >= 0)
++ return 1;
++ else
++ return 0;
+ }
+
+ /* Based on GDB code. */
+@@ -162,9 +243,11 @@ mips32_relative_offset (uint32_t inst)
+ return ((itype_immediate(inst) ^ 0x8000) - 0x8000) << 2;
+ }
+
+-int mips_next_pcs(struct process *proc, uint32_t pc, uint32_t *newpc)
++int mips_next_pcs(struct process *proc, unsigned long pc,
++ unsigned long *newpc)
+ {
+- uint32_t inst, rx;
++ uint32_t inst;
++ unsigned long rx;
+ int op;
+ int rn;
+ int nr = 0;
+@@ -277,8 +360,8 @@ int mips_next_pcs(struct process *proc, uint32_t pc, uint32_t *newpc)
+ return nr;
+
+ fail:
+- printf("nr=%d pc=%x\n", nr, pc);
+- printf("pc=%x %x\n", newpc[0], newpc[1]);
++ printf("nr=%d pc=%lx\n", nr, pc);
++ printf("pc=%lx %lx\n", newpc[0], newpc[1]);
+ return 0;
+ }
+
+@@ -304,17 +387,27 @@ fail:
+ * branches within the LL-SC sequence.
+ */
+ #define inrange(x,lo,hi) ((x)<=(hi) && (x)>=(lo))
++/* Instruction encodings for atomic operations */
++#ifdef __mips64
++#define op_SC_p(op) (op == 0x38 || op == 0x3c)
++#define op_LL_p(op) (op == 0x30 || op == 0x34)
++#else /* !__mips64 */
++#define op_SC_p(op) (op == 0x38)
++#define op_LL_p(op) (op == 0x30)
++#endif /* !__mips64 */
++
+ static int
+-mips_atomic_next_pcs(struct process *proc, uint32_t lladdr, uint32_t *newpcs)
++mips_atomic_next_pcs(struct process *proc, unsigned long lladdr,
++ unsigned long *newpcs)
+ {
+ int nr = 0;
+
+- uint32_t scaddr;
++ unsigned long scaddr;
+ for (scaddr = lladdr + 4; scaddr - lladdr <= 2048; scaddr += 4) {
+ /* Found SC, now stepover trailing branch */
+ uint32_t inst;
+ if (proc_read_32(proc, (arch_addr_t)scaddr, &inst) >= 0 &&
+- itype_op(inst) == 0x38) {
++ op_SC_p (itype_op(inst))) {
+ newpcs[nr++] = scaddr + 4;
+ break;
+ }
+@@ -327,16 +420,16 @@ mips_atomic_next_pcs(struct process *proc, uint32_t lladdr, uint32_t *newpcs)
+ }
+
+ /* Scan LL<->SC range for branches going outside that range */
+- uint32_t spc;
++ unsigned long spc;
+ for (spc = lladdr + 4; spc < scaddr; spc += 4) {
+- uint32_t scanpcs[2];
++ unsigned long scanpcs[2];
+ int snr = mips_next_pcs(proc, spc, scanpcs);
+
+ int i;
+ for (i = 0; i < snr; ++i) {
+ if (!inrange(scanpcs[i], lladdr, scaddr)) {
+- uint32_t *tmp = realloc(newpcs, (nr + 1) *
+- sizeof *newpcs);
++ unsigned long *tmp = realloc(newpcs, (nr + 1)
++ * sizeof *newpcs);
+ if (tmp == NULL) {
+ perror("malloc atomic next pcs");
+ return -1;
+@@ -357,8 +450,8 @@ arch_sw_singlestep(struct process *proc, struct breakpoint *bp,
+ int (*add_cb)(arch_addr_t, struct sw_singlestep_data *),
+ struct sw_singlestep_data *add_cb_data)
+ {
+- uint32_t pc = (uint32_t) get_instruction_pointer(proc);
+- uint32_t *newpcs;
++ unsigned long pc = (unsigned long) get_instruction_pointer(proc);
++ unsigned long *newpcs;
+ int nr;
+ uint32_t inst;
+
+@@ -369,7 +462,7 @@ arch_sw_singlestep(struct process *proc, struct breakpoint *bp,
+ return SWS_FAIL;
+
+ /* Starting an atomic read-modify-write sequence */
+- if (itype_op(inst) == 0x30)
++ if (op_LL_p(itype_op(inst)))
+ nr = mips_atomic_next_pcs(proc, pc, newpcs);
+ else
+ nr = mips_next_pcs(proc, pc, newpcs);
+@@ -462,7 +555,7 @@ gimme_arg(enum tof type, struct process *proc, int arg_num,
+ debug(2,"ret = %#lx",addr);
+ return addr;
+ }
+- ret = addr + 4*arg_num;
++ ret = addr + sizeof(long) * arg_num;
+ ret=ptrace(PTRACE_PEEKTEXT,proc->pid,addr,0);
+ debug(2,"ret = %#lx",ret);
+ return ret;
+@@ -474,7 +567,7 @@ gimme_arg(enum tof type, struct process *proc, int arg_num,
+ debug(2,"ret = %#lx",addr);
+ return addr;
+ }
+- ret = addr + 4*arg_num;
++ ret = addr + sizeof(long) * arg_num;
+ ret=ptrace(PTRACE_PEEKTEXT,proc->pid,addr,0);
+ debug(2,"ret = %#lx",ret);
+ return ret;
+@@ -483,4 +576,34 @@ gimme_arg(enum tof type, struct process *proc, int arg_num,
+ return 0;
+ }
+
++#ifdef __LP64__
++size_t
++arch_type_sizeof(struct process *proc, struct arg_type_info *info)
++{
++ if (proc == NULL)
++ return (size_t)-2;
++
++ switch (info->type) {
++ case ARGTYPE_LONG:
++ case ARGTYPE_ULONG:
++ return proc->mask_32bit ? 4 : sizeof (long);
++
++ case ARGTYPE_POINTER:
++ return proc->mask_32bit ? 4 : sizeof (void *);
++
++ default:
++ /* Use default value. */
++ return (size_t)-2;
++ }
++}
++
++size_t
++arch_type_alignof(struct process *proc, struct arg_type_info *info)
++{
++ if (proc == NULL)
++ return (size_t)-2;
++
++ return arch_type_sizeof(proc, info);
++}
++#endif /* __LP64__ */
+ /**@}*/
+diff --git a/sysdeps/linux-gnu/mksyscallent_mips b/sysdeps/linux-gnu/mksyscallent_mips
+index f3961b4..f8dcfe1 100755
+--- a/sysdeps/linux-gnu/mksyscallent_mips
++++ b/sysdeps/linux-gnu/mksyscallent_mips
+@@ -19,9 +19,7 @@
+
+ # hack expression to generate arch/syscallent.h from <asm/unistd.h>
+ # It reads from stdin and writes to stdout
+-# It should work OK on i386,m68k,arm,ia64
+-# It does NOT work in mips, s390
+-# It is untested in other architectures
++# Default is o32; arch=mips64 generates n64 syscalls
+
+ BEGIN {
+ max=0;
+@@ -31,7 +29,10 @@ BEGIN {
+ {
+ #debug
+ #printf("/%s/%s/%s/%s/\n", $1, $2, $3, $4);
+- if ($2 ~ /__NR_Linux/ && $3 ~ /4000/) {
++ min=4000
++ if (arch ~ "mips64") min=5000
++
++ if ($2 ~ /__NR_Linux/ && $3 ~ min) {
+ syscall=1;
+ }
+ if ($2 ~ /__NR_Linux_syscalls/) {
+--
+2.13.2
+
diff --git a/meta-openembedded/meta-oe/recipes-devtools/ltrace/ltrace/0001-Fix-tautological-compare-warning.patch b/meta-openembedded/meta-oe/recipes-devtools/ltrace/ltrace/0001-Fix-tautological-compare-warning.patch
new file mode 100644
index 000000000..a599d0e19
--- /dev/null
+++ b/meta-openembedded/meta-oe/recipes-devtools/ltrace/ltrace/0001-Fix-tautological-compare-warning.patch
@@ -0,0 +1,261 @@
+From 0af8ced6376f2256b9daac301c851e1c99c3b035 Mon Sep 17 00:00:00 2001
+From: Adam Trhon <adam.trhon@tbs-biometrics.com>
+Date: Fri, 12 May 2017 13:39:11 +0200
+Subject: [PATCH] Fix tautological compare warning
+
+By default, gcc ignores warning from code generated by macros
+(https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80369). When
+ltrace is compiled under icecream the warning *is generated*
+(https://github.com/icecc/icecream/issues/202)
+and the compilation fails (because of -Werror).
+
+Upstream-Status: Submitted [ltrace-devel@lists.alioth.debian.org]
+
+Signed-off-by: Adam Trhon <adam.trhon@tbs-biometrics.com>
+---
+ filter.c | 4 ++--
+ sysdeps/linux-gnu/arm/fetch.c | 2 +-
+ sysdeps/linux-gnu/arm/trace.c | 2 +-
+ sysdeps/linux-gnu/ia64/fetch.c | 2 +-
+ sysdeps/linux-gnu/metag/trace.c | 2 +-
+ sysdeps/linux-gnu/mips/plt.c | 2 +-
+ sysdeps/linux-gnu/ppc/fetch.c | 2 +-
+ sysdeps/linux-gnu/ppc/plt.c | 2 +-
+ sysdeps/linux-gnu/ppc/trace.c | 4 ++--
+ sysdeps/linux-gnu/s390/fetch.c | 2 +-
+ sysdeps/linux-gnu/s390/trace.c | 4 ++--
+ sysdeps/linux-gnu/x86/fetch.c | 2 +-
+ sysdeps/linux-gnu/x86/trace.c | 4 ++--
+ value.c | 4 ++--
+ 14 files changed, 19 insertions(+), 19 deletions(-)
+
+diff --git a/filter.c b/filter.c
+index ba50c40..a65856d 100644
+--- a/filter.c
++++ b/filter.c
+@@ -79,7 +79,7 @@ filter_lib_matcher_name_init(struct filter_lib_matcher *matcher,
+ {
+ switch (type) {
+ case FLM_MAIN:
+- assert(type != type);
++ assert(!"Unexpected value of type");
+ abort();
+
+ case FLM_SONAME:
+@@ -137,7 +137,7 @@ matcher_matches_library(struct filter_lib_matcher *matcher, struct library *lib)
+ case FLM_MAIN:
+ return lib->type == LT_LIBTYPE_MAIN;
+ }
+- assert(matcher->type != matcher->type);
++ assert(!"Unexpected value of matcher->type");
+ abort();
+ }
+
+diff --git a/sysdeps/linux-gnu/arm/fetch.c b/sysdeps/linux-gnu/arm/fetch.c
+index b500448..8f75fcf 100644
+--- a/sysdeps/linux-gnu/arm/fetch.c
++++ b/sysdeps/linux-gnu/arm/fetch.c
+@@ -317,7 +317,7 @@ arch_fetch_retval(struct fetch_context *ctx, enum tof type,
+ memmove(data, ctx->regs.uregs, sz);
+ return 0;
+ }
+- assert(info->type != info->type);
++ assert(!"Unexpected value of info->type");
+ abort();
+ }
+
+diff --git a/sysdeps/linux-gnu/arm/trace.c b/sysdeps/linux-gnu/arm/trace.c
+index 5e51e91..e76bf63 100644
+--- a/sysdeps/linux-gnu/arm/trace.c
++++ b/sysdeps/linux-gnu/arm/trace.c
+@@ -701,7 +701,7 @@ arch_type_sizeof(struct process *proc, struct arg_type_info *info)
+ return (size_t)-2;
+
+ default:
+- assert(info->type != info->type);
++ assert(!"Unexpected value of info->type");
+ abort();
+ }
+ }
+diff --git a/sysdeps/linux-gnu/ia64/fetch.c b/sysdeps/linux-gnu/ia64/fetch.c
+index 171c7a2..ee2fbc7 100644
+--- a/sysdeps/linux-gnu/ia64/fetch.c
++++ b/sysdeps/linux-gnu/ia64/fetch.c
+@@ -409,7 +409,7 @@ arch_fetch_arg_next(struct fetch_context *ctx, enum tof type,
+ case ARGTYPE_ARRAY:
+ /* Arrays decay into pointers. XXX Fortran? */
+ default:
+- assert(info->type != info->type);
++ assert(!"Unexpected value of info->type");
+ abort();
+ }
+ }
+diff --git a/sysdeps/linux-gnu/metag/trace.c b/sysdeps/linux-gnu/metag/trace.c
+index ad5fffe..7a843d6 100644
+--- a/sysdeps/linux-gnu/metag/trace.c
++++ b/sysdeps/linux-gnu/metag/trace.c
+@@ -142,7 +142,7 @@ get_regval_from_unit(enum metag_unitnum unit, unsigned int reg,
+ return regs->ax[reg][0];
+ /* We really shouldn't be here. */
+ default:
+- assert(unit != unit);
++ assert(!"Unexpected value of unit");
+ abort();
+ }
+ return 0;
+diff --git a/sysdeps/linux-gnu/mips/plt.c b/sysdeps/linux-gnu/mips/plt.c
+index c7c10ac..ca2307d 100644
+--- a/sysdeps/linux-gnu/mips/plt.c
++++ b/sysdeps/linux-gnu/mips/plt.c
+@@ -651,7 +651,7 @@ mips_stub_bp_continue(struct breakpoint *bp, struct process *proc)
+ break;
+ }
+
+- assert(bp->libsym->arch.type != bp->libsym->arch.type);
++ assert(!"Unexpected value of bp->libsym->arch.type");
+ abort();
+ }
+
+diff --git a/sysdeps/linux-gnu/ppc/fetch.c b/sysdeps/linux-gnu/ppc/fetch.c
+index c6cbd71..5db5675 100644
+--- a/sysdeps/linux-gnu/ppc/fetch.c
++++ b/sysdeps/linux-gnu/ppc/fetch.c
+@@ -502,7 +502,7 @@ allocate_argument(struct fetch_context *ctx, struct process *proc,
+ case ARGTYPE_ARRAY:
+ /* Arrays decay into pointers. XXX Fortran? */
+ default:
+- assert(info->type != info->type);
++ assert(!"Unexpected value of info->type");
+ abort();
+ }
+
+diff --git a/sysdeps/linux-gnu/ppc/plt.c b/sysdeps/linux-gnu/ppc/plt.c
+index 5f81889..781da03 100644
+--- a/sysdeps/linux-gnu/ppc/plt.c
++++ b/sysdeps/linux-gnu/ppc/plt.c
+@@ -1085,7 +1085,7 @@ ppc_plt_bp_continue(struct breakpoint *bp, struct process *proc)
+ break;
+ }
+
+- assert(bp->libsym->arch.type != bp->libsym->arch.type);
++ assert(!"Unexpected value of bp->libsym->arch.type");
+ abort();
+ }
+
+diff --git a/sysdeps/linux-gnu/ppc/trace.c b/sysdeps/linux-gnu/ppc/trace.c
+index 5aab538..caa6035 100644
+--- a/sysdeps/linux-gnu/ppc/trace.c
++++ b/sysdeps/linux-gnu/ppc/trace.c
+@@ -217,7 +217,7 @@ arch_type_sizeof(struct process *proc, struct arg_type_info *info)
+ return (size_t)-2;
+
+ default:
+- assert(info->type != info->type);
++ assert(!"Unexpected value of info->type");
+ abort();
+ break;
+ }
+@@ -231,7 +231,7 @@ arch_type_alignof(struct process *proc, struct arg_type_info *info)
+
+ switch (info->type) {
+ default:
+- assert(info->type != info->type);
++ assert(!"Unexpected value of info->type");
+ abort();
+ break;
+
+diff --git a/sysdeps/linux-gnu/s390/fetch.c b/sysdeps/linux-gnu/s390/fetch.c
+index 4ad5951..4721c30 100644
+--- a/sysdeps/linux-gnu/s390/fetch.c
++++ b/sysdeps/linux-gnu/s390/fetch.c
+@@ -266,7 +266,7 @@ arch_fetch_arg_next(struct fetch_context *ctx, enum tof type,
+ return allocate_gpr(ctx, proc, info, valuep, sz);
+
+ default:
+- assert(info->type != info->type);
++ assert(!"Unexpected value of info->type");
+ abort();
+ }
+ return -1;
+diff --git a/sysdeps/linux-gnu/s390/trace.c b/sysdeps/linux-gnu/s390/trace.c
+index 78b04c3..24f7801 100644
+--- a/sysdeps/linux-gnu/s390/trace.c
++++ b/sysdeps/linux-gnu/s390/trace.c
+@@ -213,7 +213,7 @@ arch_type_sizeof(struct process *proc, struct arg_type_info *info)
+ return (size_t)-2;
+
+ default:
+- assert(info->type != info->type);
++ assert(!"Unexpected value of info->type");
+ abort();
+ }
+ }
+@@ -226,7 +226,7 @@ arch_type_alignof(struct process *proc, struct arg_type_info *info)
+
+ switch (info->type) {
+ default:
+- assert(info->type != info->type);
++ assert(!"Unexpected value of info->type");
+ break;
+
+ case ARGTYPE_CHAR:
+diff --git a/sysdeps/linux-gnu/x86/fetch.c b/sysdeps/linux-gnu/x86/fetch.c
+index 6868101..ae2ed79 100644
+--- a/sysdeps/linux-gnu/x86/fetch.c
++++ b/sysdeps/linux-gnu/x86/fetch.c
+@@ -523,7 +523,7 @@ classify(struct process *proc, struct fetch_context *context,
+
+ default:
+ /* Unsupported type. */
+- assert(info->type != info->type);
++ assert(!"Unexpected value of info->type");
+ abort();
+ }
+ abort();
+diff --git a/sysdeps/linux-gnu/x86/trace.c b/sysdeps/linux-gnu/x86/trace.c
+index 6a1a6a5..d8d2115 100644
+--- a/sysdeps/linux-gnu/x86/trace.c
++++ b/sysdeps/linux-gnu/x86/trace.c
+@@ -145,7 +145,7 @@ arch_type_sizeof(struct process *proc, struct arg_type_info *info)
+ return (size_t)-2;
+
+ default:
+- assert(info->type != info->type);
++ assert(!"Unexpected value of info->type");
+ abort();
+ }
+ }
+@@ -158,7 +158,7 @@ arch_type_alignof(struct process *proc, struct arg_type_info *info)
+
+ switch (info->type) {
+ default:
+- assert(info->type != info->type);
++ assert(!"Unexpected value of info->type");
+ abort();
+ break;
+
+diff --git a/value.c b/value.c
+index 2125ba9..30edb4e 100644
+--- a/value.c
++++ b/value.c
+@@ -363,7 +363,7 @@ value_set_word(struct value *value, long word)
+ u.u64 = word;
+ break;
+ default:
+- assert(sz != sz);
++ assert(!"Unexpected value of sz");
+ abort();
+ }
+
+@@ -414,7 +414,7 @@ value_extract_word(struct value *value, long *retp,
+ *retp = (long)u.u64;
+ return 0;
+ default:
+- assert(sz != sz);
++ assert(!"Unexpected value of sz");
+ abort();
+ }
+ }
+--
+2.12.0
+
diff --git a/meta-openembedded/meta-oe/recipes-devtools/ltrace/ltrace/0001-Use-correct-enum-type.patch b/meta-openembedded/meta-oe/recipes-devtools/ltrace/ltrace/0001-Use-correct-enum-type.patch
new file mode 100644
index 000000000..01a35842c
--- /dev/null
+++ b/meta-openembedded/meta-oe/recipes-devtools/ltrace/ltrace/0001-Use-correct-enum-type.patch
@@ -0,0 +1,28 @@
+From df490528d1e81a98ba2991c700c92a8e6c969083 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Mon, 6 Mar 2017 21:32:22 -0800
+Subject: [PATCH 1/2] Use correct enum type
+
+Clang warns about wrong enum initializtion
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ sysdeps/linux-gnu/aarch64/fetch.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/sysdeps/linux-gnu/aarch64/fetch.c b/sysdeps/linux-gnu/aarch64/fetch.c
+index 2744df0..1dcf7cc 100644
+--- a/sysdeps/linux-gnu/aarch64/fetch.c
++++ b/sysdeps/linux-gnu/aarch64/fetch.c
+@@ -173,7 +173,7 @@ static struct fetch_script
+ pass_arg(struct fetch_context const *context,
+ struct process *proc, struct arg_type_info *info)
+ {
+- enum fetch_method cvt = CVT_NOP;
++ enum convert_method cvt = CVT_NOP;
+
+ size_t sz = type_sizeof(proc, info);
+ if (sz == (size_t) -1)
+--
+2.12.0
+
diff --git a/meta-openembedded/meta-oe/recipes-devtools/ltrace/ltrace/0001-configure-Recognise-linux-musl-as-a-host-OS.patch b/meta-openembedded/meta-oe/recipes-devtools/ltrace/ltrace/0001-configure-Recognise-linux-musl-as-a-host-OS.patch
new file mode 100644
index 000000000..52264a17e
--- /dev/null
+++ b/meta-openembedded/meta-oe/recipes-devtools/ltrace/ltrace/0001-configure-Recognise-linux-musl-as-a-host-OS.patch
@@ -0,0 +1,25 @@
+From c1d3aaf5ec810c2594938438c7b4ccd20943f255 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Fri, 7 Jul 2017 10:20:52 -0700
+Subject: [PATCH] configure: Recognise linux-musl as a host OS
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ configure.ac | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/configure.ac b/configure.ac
+index 3e8667f..95d6642 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -35,6 +35,7 @@ AC_CANONICAL_HOST
+ case "${host_os}" in
+ linux-gnu*) HOST_OS="linux-gnu" ;;
+ linux-uclibc*) HOST_OS="linux-gnu" ;;
++ linux-musl*) HOST_OS="linux-gnu" ;;
+ *) AC_MSG_ERROR([unkown host-os ${host_os}]) ;;
+ esac
+ AC_SUBST(HOST_OS)
+--
+2.13.2
+
diff --git a/meta-openembedded/meta-oe/recipes-devtools/ltrace/ltrace/0001-mips-plt.c-Delete-include-error.h.patch b/meta-openembedded/meta-oe/recipes-devtools/ltrace/ltrace/0001-mips-plt.c-Delete-include-error.h.patch
new file mode 100644
index 000000000..76ba7de78
--- /dev/null
+++ b/meta-openembedded/meta-oe/recipes-devtools/ltrace/ltrace/0001-mips-plt.c-Delete-include-error.h.patch
@@ -0,0 +1,27 @@
+From 19a3e590c97420bd3952301bf376067c75d0ee32 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Mon, 18 Sep 2017 23:45:54 -0700
+Subject: [PATCH] mips/plt.c: Delete include error.h
+
+Its not needed
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ sysdeps/linux-gnu/mips/plt.c | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/sysdeps/linux-gnu/mips/plt.c b/sysdeps/linux-gnu/mips/plt.c
+index 2d85ad9..9c3ae2f 100644
+--- a/sysdeps/linux-gnu/mips/plt.c
++++ b/sysdeps/linux-gnu/mips/plt.c
+@@ -24,7 +24,6 @@
+
+ #include <sys/ptrace.h>
+ #include <errno.h>
+-#include <error.h>
+ #include <gelf.h>
+ #include <inttypes.h>
+ #include <string.h>
+--
+2.14.1
+
diff --git a/meta-openembedded/meta-oe/recipes-devtools/ltrace/ltrace/0001-replace-readdir_r-with-readdir.patch b/meta-openembedded/meta-oe/recipes-devtools/ltrace/ltrace/0001-replace-readdir_r-with-readdir.patch
new file mode 100644
index 000000000..65c7d535e
--- /dev/null
+++ b/meta-openembedded/meta-oe/recipes-devtools/ltrace/ltrace/0001-replace-readdir_r-with-readdir.patch
@@ -0,0 +1,36 @@
+From 64f98f84fd88797e219f9dde1ca387fee4b509f0 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Sun, 24 Apr 2016 16:58:17 -0700
+Subject: [PATCH] replace readdir_r with readdir
+
+glibc 2.24 has deprecated readdir_r
+
+https://sourceware.org/ml/libc-alpha/2016-02/msg00093.html
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: Submitted
+
+ sysdeps/linux-gnu/proc.c | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/sysdeps/linux-gnu/proc.c b/sysdeps/linux-gnu/proc.c
+index 953fd86..edb716d 100644
+--- a/sysdeps/linux-gnu/proc.c
++++ b/sysdeps/linux-gnu/proc.c
+@@ -242,9 +242,10 @@ process_tasks(pid_t pid, pid_t **ret_tasks, size_t *ret_n)
+ size_t alloc = 0;
+
+ while (1) {
+- struct dirent entry;
+ struct dirent *result;
+- if (readdir_r(d, &entry, &result) != 0) {
++ errno = 0;
++ result = readdir(d);
++ if (errno != 0) {
+ fail:
+ free(tasks);
+ closedir(d);
+--
+2.8.0
+
diff --git a/meta-openembedded/meta-oe/recipes-devtools/ltrace/ltrace/0002-Fix-const-qualifier-error.patch b/meta-openembedded/meta-oe/recipes-devtools/ltrace/ltrace/0002-Fix-const-qualifier-error.patch
new file mode 100644
index 000000000..c15277192
--- /dev/null
+++ b/meta-openembedded/meta-oe/recipes-devtools/ltrace/ltrace/0002-Fix-const-qualifier-error.patch
@@ -0,0 +1,76 @@
+From 4d3ec1a514f9b1df8ce3a1b04c8a2823d977377f Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Mon, 6 Mar 2017 21:34:01 -0800
+Subject: [PATCH 2/2] Fix const qualifier error
+
+Fixes clang warning
+error: duplicate 'const' declaration specifier [-Werror,-Wduplicate-decl-specifier]
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ dict.h | 2 +-
+ library.c | 2 +-
+ vect.h | 2 +-
+ 3 files changed, 3 insertions(+), 3 deletions(-)
+
+Index: git/dict.h
+===================================================================
+--- git.orig/dict.h
++++ git/dict.h
+@@ -90,7 +90,7 @@ int dict_clone(struct dict *target, cons
+ assert(_source_d->values.elt_size == sizeof(VALUE_TYPE)); \
+ /* Check that callbacks are typed properly. */ \
+ void (*_key_dtor_cb)(KEY_TYPE *, void *) = DTOR_KEY; \
+- int (*_key_clone_cb)(KEY_TYPE *, const KEY_TYPE *, \
++ int (*_key_clone_cb)(KEY_TYPE *, KEY_TYPE *, \
+ void *) = CLONE_KEY; \
+ void (*_value_dtor_cb)(VALUE_TYPE *, void *) = DTOR_VALUE; \
+ int (*_value_clone_cb)(VALUE_TYPE *, const VALUE_TYPE *, \
+Index: git/library.c
+===================================================================
+--- git.orig/library.c
++++ git/library.c
+@@ -353,7 +353,7 @@ static void
+ library_exported_names_init(struct library_exported_names *names)
+ {
+ DICT_INIT(&names->names,
+- const char*, uint64_t,
++ char*, uint64_t,
+ dict_hash_string, dict_eq_string, NULL);
+ DICT_INIT(&names->addrs,
+ uint64_t, struct vect*,
+Index: git/vect.h
+===================================================================
+--- git.orig/vect.h
++++ git/vect.h
+@@ -66,7 +66,7 @@ int vect_clone(struct vect *target, cons
+ assert(_source_vec->elt_size == sizeof(ELT_TYPE)); \
+ /* Check that callbacks are typed properly. */ \
+ void (*_dtor_callback)(ELT_TYPE *, void *) = DTOR; \
+- int (*_clone_callback)(ELT_TYPE *, const ELT_TYPE *, \
++ int (*_clone_callback)(ELT_TYPE *, ELT_TYPE *, \
+ void *) = CLONE; \
+ vect_clone((TGT_VEC), _source_vec, \
+ (int (*)(void *, const void *, \
+Index: git/value_dict.c
+===================================================================
+--- git.orig/value_dict.c
++++ git/value_dict.c
+@@ -40,7 +40,7 @@ val_dict_init(struct value_dict *dict)
+ }
+
+ static int
+-value_clone_cb(struct value *tgt, const struct value *src, void *data)
++value_clone_cb(struct value *tgt, struct value *src, void *data)
+ {
+ return value_clone(tgt, src);
+ }
+@@ -53,7 +53,7 @@ value_dtor(struct value *val, void *data
+
+ static int
+ named_value_clone(struct named_value *tgt,
+- const struct named_value *src, void *data)
++ struct named_value *src, void *data)
+ {
+ tgt->name = strdup(src->name);
+ if (tgt->name == NULL)
diff --git a/meta-openembedded/meta-oe/recipes-devtools/ltrace/ltrace/configure-allow-to-disable-selinux-support.patch b/meta-openembedded/meta-oe/recipes-devtools/ltrace/ltrace/configure-allow-to-disable-selinux-support.patch
new file mode 100644
index 000000000..4f89d8f2e
--- /dev/null
+++ b/meta-openembedded/meta-oe/recipes-devtools/ltrace/ltrace/configure-allow-to-disable-selinux-support.patch
@@ -0,0 +1,36 @@
+From 887a403e38f590ebf1d04ce600d94cb7a351744c Mon Sep 17 00:00:00 2001
+From: Wenzong Fan <wenzong.fan@windriver.com>
+Date: Mon, 1 Dec 2014 00:57:42 -0500
+Subject: [PATCH] ltrace: allow to enable/disable selinux support
+
+Upstream-Status: Pending
+
+Signed-off-by: Wenzong Fan <wenzong.fan@windriver.com>
+---
+ configure.ac | 10 ++++++++--
+ 1 file changed, 8 insertions(+), 2 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 6fe5e3b..189885a 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -125,8 +125,14 @@ AC_SUBST(libstdcxx_LIBS)
+
+
+ dnl Check security_get_boolean_active availability.
+-AC_CHECK_HEADERS(selinux/selinux.h)
+-AC_CHECK_LIB(selinux, security_get_boolean_active)
++AC_ARG_ENABLE([selinux],
++ AS_HELP_STRING([--enable-selinux],[enable SELinux support [default=auto]]),
++ [], [enable_selinux=auto])
++
++if test x$enable_selinux != xno; then
++ AC_CHECK_HEADERS(selinux/selinux.h)
++ AC_CHECK_LIB(selinux, security_get_boolean_active)
++fi
+
+ dnl Whether (and which) elfutils libdw.so to use for unwinding.
+ AC_ARG_WITH(elfutils,
+--
+1.7.9.5
+
diff --git a/meta-openembedded/meta-oe/recipes-devtools/ltrace/ltrace_git.bb b/meta-openembedded/meta-oe/recipes-devtools/ltrace/ltrace_git.bb
new file mode 100644
index 000000000..abe015de2
--- /dev/null
+++ b/meta-openembedded/meta-oe/recipes-devtools/ltrace/ltrace_git.bb
@@ -0,0 +1,39 @@
+SUMMARY = "ltrace intercepts and records dynamic library calls"
+
+DESCRIPTION = "ltrace intercepts and records dynamic library calls \
+which are called by an executed process and the signals received by that process. \
+It can also intercept and print the system calls executed by the program.\
+"
+HOMEPAGE = "http://ltrace.org/"
+
+LICENSE = "GPLv2"
+LIC_FILES_CHKSUM = "file://COPYING;md5=eb723b61539feef013de476e68b5c50a"
+
+PE = "1"
+PV = "7.91+git${SRCPV}"
+SRCREV = "c22d359433b333937ee3d803450dc41998115685"
+
+DEPENDS = "elfutils"
+RDEPENDS_${PN} = "elfutils"
+SRC_URI = "git://anonscm.debian.org/collab-maint/ltrace.git;branch=master \
+ file://configure-allow-to-disable-selinux-support.patch \
+ file://0001-replace-readdir_r-with-readdir.patch \
+ file://0001-Use-correct-enum-type.patch \
+ file://0002-Fix-const-qualifier-error.patch \
+ file://0001-ARM-code-has-unreachable-code-after-switch-statement.patch \
+ file://0001-Fix-tautological-compare-warning.patch \
+ file://0001-Add-support-for-mips64-n32-n64.patch \
+ file://0001-configure-Recognise-linux-musl-as-a-host-OS.patch \
+ file://0001-mips-plt.c-Delete-include-error.h.patch \
+ "
+S = "${WORKDIR}/git"
+
+inherit autotools
+
+PACKAGECONFIG ?= "${@bb.utils.filter('DISTRO_FEATURES', 'selinux', d)}"
+PACKAGECONFIG[unwind] = "--with-libunwind,--without-libunwind,libunwind"
+PACKAGECONFIG[selinux] = "--enable-selinux,--disable-selinux,libselinux,libselinux"
+
+do_configure_prepend () {
+ ( cd ${S}; ./autogen.sh )
+}
OpenPOWER on IntegriCloud