Skip to content

Commit

Permalink
2nd iteration - hopefully last
Browse files Browse the repository at this point in the history
  • Loading branch information
teras committed Sep 4, 2017
1 parent 5a9ebc9 commit c7fe818
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 14 deletions.
9 changes: 2 additions & 7 deletions elf.c
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
#ifdef __APPLE__
#include "osx_elf.h"
#include "light_byteswap.h"
#else
#include <elf.h>
#include <byteswap.h>
#endif
#include <stdio.h>
#include <stdint.h>
#include <errno.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <fcntl.h>
#include "light_elf.h"
#include "light_byteswap.h"


typedef Elf32_Nhdr Elf_Nhdr;
Expand Down
7 changes: 1 addition & 6 deletions getsection.c
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
#ifdef __APPLE__
#include "osx_elf.h"
#else
#include <elf.h>
#endif

#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/mman.h>
#include <string.h>
#include <unistd.h>
#include "light_elf.h"

/* Return the offset, and the length of an ELF section with a given name in a given ELF file */
int get_elf_section_offset_and_lenghth(char* fname, char* section_name, unsigned long *offset, unsigned long *length)
Expand Down
24 changes: 23 additions & 1 deletion osx_elf.h → light_elf.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,26 @@
/* This is a derivative work of https://github.com/torvalds/linux/blob/master/include/uapi/linux/elf.h */
/*
*
* Linux kernel
* Copyright (C) 2017 Linus Torvalds
*
* 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.
*
* 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
*
* This is a derivative work of https://github.com/torvalds/linux/blob/master/include/uapi/linux/elf.h
*
* For more legal info, please look at http://elinux.org/Legal_Issues#Use_of_kernel_header_files_in_user-space
*
*/

#ifndef _ELF_H
#define _ELF_H 1
Expand Down

0 comments on commit c7fe818

Please sign in to comment.