summaryrefslogtreecommitdiffstats
path: root/libelf/chdr_xlate.h
blob: 70782b43d63c6ba016881ac90c1f7c09faac200c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include "common.h"

/* These functions convert a while section, one Chdr plus compression data.  */

static void
Elf32_cvt_chdr (void *dest, const void *src, size_t len, int encode)
{
  if (len == 0)
    return;

  /* Move everything over, if necessary, we only need to xlate the
     header, not the compressed data following it.  */
  if (dest != src)
    memmove (dest, src, len);

  if (len >= sizeof (Elf32_Chdr))
    Elf32_cvt_Chdr (dest, src, sizeof (Elf32_Chdr), encode);
}

static void
Elf64_cvt_chdr (void *dest, const void *src, size_t len, int encode)
{
  if (len == 0)
    return;

  /* Move everything over, if necessary, we only need to xlate the
     header, not the compressed data following it.  */
  if (dest != src)
    memmove (dest, src, len);

  if (len >= sizeof (Elf64_Chdr))
    Elf64_cvt_Chdr (dest, src, sizeof (Elf64_Chdr), encode);
}