Skip to content

Instantly share code, notes, and snippets.

@MrVan
Created April 27, 2013 10:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MrVan/5472689 to your computer and use it in GitHub Desktop.
Save MrVan/5472689 to your computer and use it in GitHub Desktop.
From 2540825a297e9263a4b701bebcb78d81b4771360 Mon Sep 17 00:00:00 2001
From: Peng Fan <van.freenix@gmail.com>
Date: Mon, 22 Apr 2013 10:45:48 +0800
Subject: [PATCH] add arm sections support
---
.gitignore | 1 +
elftoolchain/libelf/elf_data.c | 12 ++++++++++++
2 files changed, 13 insertions(+)
diff --git a/.gitignore b/.gitignore
index c80a859..99e0316 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,3 +2,4 @@
build-*
*.rap
*.pyc
+test.c
diff --git a/elftoolchain/libelf/elf_data.c b/elftoolchain/libelf/elf_data.c
index 5ac6453..a6e17ae 100644
--- a/elftoolchain/libelf/elf_data.c
+++ b/elftoolchain/libelf/elf_data.c
@@ -87,9 +87,20 @@ elf_getdata(Elf_Scn *s, Elf_Data *d)
return (NULL);
}
+ if (sh_type == 0x70000003 || sh_type == 0x70000001) {
+ // freenix
+ if ((d = _libelf_allocate_data(s)) == NULL)
+ return (NULL);
+ d->d_buf = 0;
+ d->d_size = 0;
+ return (d);
+ }
+ //printf("freenix %x %x\n", (sh_type), ELF_T_FIRST);
+
if ((elftype = _libelf_xlate_shtype(sh_type)) < ELF_T_FIRST ||
elftype > ELF_T_LAST || (sh_type != SHT_NOBITS &&
sh_offset + sh_size > (uint64_t) e->e_rawsize)) {
+ printf("11111\n");
LIBELF_SET_ERROR(SECTION, 0);
return (NULL);
}
@@ -101,6 +112,7 @@ elf_getdata(Elf_Scn *s, Elf_Data *d)
}
if (sh_size % fsz) {
+ printf("2222\n");
LIBELF_SET_ERROR(SECTION, 0);
return (NULL);
}
--
1.7.10.4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment