* Restructured (and partly rewritten) by:
* Björn Ekwall <bj0rn@blox.se> February 1999
*
- * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
+ * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*/
#include <stdlib.h>
#include <elf.h>
#include <endian.h>
-#if BB_LITTLE_ENDIAN
-# define ELFDATAM ELFDATA2LSB
-#else
-# define ELFDATAM ELFDATA2MSB
-#endif
-
#ifndef ElfW
# if ELFCLASSM == ELFCLASS32
# define ElfW(x) Elf32_ ## x
ElfW(RelM) *rel, ElfW(Addr) value);
static void arch_create_got (struct obj_file *f);
-
+#if ENABLE_FEATURE_CHECK_TAINTED_MODULE
static int obj_gpl_license(struct obj_file *f, const char **license);
-
+#endif /* ENABLE_FEATURE_CHECK_TAINTED_MODULE */
#endif /* obj.h */
//----------------------------------------------------------------------------
//--------end of modutils obj.h
return NULL;
}
if (f->header.e_ident[EI_CLASS] != ELFCLASSM
- || f->header.e_ident[EI_DATA] != ELFDATAM
+ || f->header.e_ident[EI_DATA] != (BB_BIG_ENDIAN
+ ? ELFDATA2MSB : ELFDATA2LSB)
|| f->header.e_ident[EI_VERSION] != EV_CURRENT
|| !MATCH_MACHINE(f->header.e_machine)) {
bb_error_msg("ELF file not for this architecture");
strcat(options, " ");
}
- if ((fd = open(filename, O_RDONLY, 0)) < 0) {
- bb_perror_msg_and_die("cannot open module `%s'", filename);
- }
+ fd = bb_xopen3(filename, O_RDONLY, 0);
fstat(fd, &st);
len = st.st_size;