summaryrefslogtreecommitdiffstats
path: root/rtemstoolkit/elftoolchain/libelf/libelf_extended.c
diff options
context:
space:
mode:
Diffstat (limited to 'rtemstoolkit/elftoolchain/libelf/libelf_extended.c')
-rw-r--r--rtemstoolkit/elftoolchain/libelf/libelf_extended.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/rtemstoolkit/elftoolchain/libelf/libelf_extended.c b/rtemstoolkit/elftoolchain/libelf/libelf_extended.c
index 10590bb..96765a8 100644
--- a/rtemstoolkit/elftoolchain/libelf/libelf_extended.c
+++ b/rtemstoolkit/elftoolchain/libelf/libelf_extended.c
@@ -24,14 +24,12 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-
#include <assert.h>
#include <libelf.h>
#include "_libelf.h"
-LIBELF_VCSID("$Id: libelf_extended.c 1360 2011-01-08 08:27:41Z jkoshy $");
+ELFTC_VCSID("$Id: libelf_extended.c 3174 2015-03-27 17:13:41Z emaste $");
/*
* Retrieve section #0, allocating a new section if needed.
@@ -69,9 +67,9 @@ _libelf_setshnum(Elf *e, void *eh, int ec, size_t shnum)
}
if (ec == ELFCLASS32)
- ((Elf32_Ehdr *) eh)->e_shnum = shnum;
+ ((Elf32_Ehdr *) eh)->e_shnum = shnum & 0xFFFFU;
else
- ((Elf64_Ehdr *) eh)->e_shnum = shnum;
+ ((Elf64_Ehdr *) eh)->e_shnum = shnum & 0xFFFFU;
return (1);
@@ -99,9 +97,9 @@ _libelf_setshstrndx(Elf *e, void *eh, int ec, size_t shstrndx)
}
if (ec == ELFCLASS32)
- ((Elf32_Ehdr *) eh)->e_shstrndx = shstrndx;
+ ((Elf32_Ehdr *) eh)->e_shstrndx = shstrndx & 0xFFFFU;
else
- ((Elf64_Ehdr *) eh)->e_shstrndx = shstrndx;
+ ((Elf64_Ehdr *) eh)->e_shstrndx = shstrndx & 0xFFFFU;
return (1);
}
@@ -128,9 +126,9 @@ _libelf_setphnum(Elf *e, void *eh, int ec, size_t phnum)
}
if (ec == ELFCLASS32)
- ((Elf32_Ehdr *) eh)->e_phnum = phnum;
+ ((Elf32_Ehdr *) eh)->e_phnum = phnum & 0xFFFFU;
else
- ((Elf64_Ehdr *) eh)->e_phnum = phnum;
+ ((Elf64_Ehdr *) eh)->e_phnum = phnum & 0xFFFFU;
return (1);
}