Commit 061bff2d authored by Ross McIlroy's avatar Ross McIlroy Committed by Commit Bot

Remove libelf from src/third_party.

No longer used by relocation packing tool, now that Android supports
packed relocations within NDK.

BUG=chromium:899208

Change-Id: Ife3d46e98846430b65c4f5cb79f8e2bbb20e6b2a
Reviewed-on: https://chromium-review.googlesource.com/c/1307498Reviewed-by: default avatarDavid Turner <digit@chromium.org>
Commit-Queue: Ross McIlroy <rmcilroy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#604890}
parent 4c549627
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
config("libelf_config") {
include_dirs = [ "src/libelf" ]
}
source_set("libelf") {
sources = [
"config.h",
"src/libelf/abstract.h",
"src/libelf/common.h",
"src/libelf/dl-hash.h",
"src/libelf/elf-knowledge.h",
"src/libelf/elf.h",
"src/libelf/elf32_checksum.c",
"src/libelf/elf32_fsize.c",
"src/libelf/elf32_getehdr.c",
"src/libelf/elf32_getphdr.c",
"src/libelf/elf32_getshdr.c",
"src/libelf/elf32_newehdr.c",
"src/libelf/elf32_newphdr.c",
"src/libelf/elf32_offscn.c",
"src/libelf/elf32_updatefile.c",
"src/libelf/elf32_updatenull.c",
"src/libelf/elf32_xlatetof.c",
"src/libelf/elf32_xlatetom.c",
"src/libelf/elf64_checksum.c",
"src/libelf/elf64_fsize.c",
"src/libelf/elf64_getehdr.c",
"src/libelf/elf64_getphdr.c",
"src/libelf/elf64_getshdr.c",
"src/libelf/elf64_newehdr.c",
"src/libelf/elf64_newphdr.c",
"src/libelf/elf64_offscn.c",
"src/libelf/elf64_updatefile.c",
"src/libelf/elf64_updatenull.c",
"src/libelf/elf64_xlatetof.c",
"src/libelf/elf64_xlatetom.c",
"src/libelf/elf_begin.c",
"src/libelf/elf_clone.c",
"src/libelf/elf_cntl.c",
"src/libelf/elf_end.c",
"src/libelf/elf_error.c",
"src/libelf/elf_fill.c",
"src/libelf/elf_flagdata.c",
"src/libelf/elf_flagehdr.c",
"src/libelf/elf_flagelf.c",
"src/libelf/elf_flagphdr.c",
"src/libelf/elf_flagscn.c",
"src/libelf/elf_flagshdr.c",
"src/libelf/elf_getarhdr.c",
"src/libelf/elf_getaroff.c",
"src/libelf/elf_getarsym.c",
"src/libelf/elf_getbase.c",
"src/libelf/elf_getdata.c",
"src/libelf/elf_getdata_rawchunk.c",
"src/libelf/elf_getident.c",
"src/libelf/elf_getphdrnum.c",
"src/libelf/elf_getscn.c",
"src/libelf/elf_getshdrnum.c",
"src/libelf/elf_getshdrstrndx.c",
"src/libelf/elf_gnu_hash.c",
"src/libelf/elf_hash.c",
"src/libelf/elf_kind.c",
"src/libelf/elf_memory.c",
"src/libelf/elf_ndxscn.c",
"src/libelf/elf_newdata.c",
"src/libelf/elf_newscn.c",
"src/libelf/elf_next.c",
"src/libelf/elf_nextscn.c",
"src/libelf/elf_rand.c",
"src/libelf/elf_rawdata.c",
"src/libelf/elf_rawfile.c",
"src/libelf/elf_readall.c",
"src/libelf/elf_scnshndx.c",
"src/libelf/elf_strptr.c",
"src/libelf/elf_update.c",
"src/libelf/elf_version.c",
"src/libelf/exttypes.h",
"src/libelf/gelf.h",
"src/libelf/gelf_checksum.c",
"src/libelf/gelf_fsize.c",
"src/libelf/gelf_getauxv.c",
"src/libelf/gelf_getclass.c",
"src/libelf/gelf_getdyn.c",
"src/libelf/gelf_getehdr.c",
"src/libelf/gelf_getlib.c",
"src/libelf/gelf_getmove.c",
"src/libelf/gelf_getnote.c",
"src/libelf/gelf_getphdr.c",
"src/libelf/gelf_getrel.c",
"src/libelf/gelf_getrela.c",
"src/libelf/gelf_getshdr.c",
"src/libelf/gelf_getsym.c",
"src/libelf/gelf_getsyminfo.c",
"src/libelf/gelf_getsymshndx.c",
"src/libelf/gelf_getverdaux.c",
"src/libelf/gelf_getverdef.c",
"src/libelf/gelf_getvernaux.c",
"src/libelf/gelf_getverneed.c",
"src/libelf/gelf_getversym.c",
"src/libelf/gelf_newehdr.c",
"src/libelf/gelf_newphdr.c",
"src/libelf/gelf_offscn.c",
"src/libelf/gelf_update_auxv.c",
"src/libelf/gelf_update_dyn.c",
"src/libelf/gelf_update_ehdr.c",
"src/libelf/gelf_update_lib.c",
"src/libelf/gelf_update_move.c",
"src/libelf/gelf_update_phdr.c",
"src/libelf/gelf_update_rel.c",
"src/libelf/gelf_update_rela.c",
"src/libelf/gelf_update_shdr.c",
"src/libelf/gelf_update_sym.c",
"src/libelf/gelf_update_syminfo.c",
"src/libelf/gelf_update_symshndx.c",
"src/libelf/gelf_update_verdaux.c",
"src/libelf/gelf_update_verdef.c",
"src/libelf/gelf_update_vernaux.c",
"src/libelf/gelf_update_verneed.c",
"src/libelf/gelf_update_versym.c",
"src/libelf/gelf_xlate.c",
"src/libelf/gelf_xlate.h",
"src/libelf/gelf_xlatetof.c",
"src/libelf/gelf_xlatetom.c",
"src/libelf/gnuhash_xlate.h",
"src/libelf/libelf.h",
"src/libelf/libelfP.h",
"src/libelf/libelf_crc32.c",
"src/libelf/libelf_next_prime.c",
"src/libelf/nlist.c",
"src/libelf/nlist.h",
"src/libelf/note_xlate.h",
"src/libelf/version_xlate.h",
]
include_dirs = [
".",
"src/lib",
]
defines = [
"_GNU_SOURCE",
"HAVE_CONFIG_H",
]
cflags = [
"-std=gnu99",
"-Wall",
"-Wshadow",
"-Werror",
"-Wunused",
"-Wextra",
"-Wformat=2",
]
public_configs = [ ":libelf_config" ]
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [ "//build/config/compiler:no_chromium_code" ]
}
rmcilroy@chromium.org
simonb@chromium.org
Name: elfutils
URL: https://fedorahosted.org/releases/e/l/elfutils/0.158/elfutils-0.158.tar.bz2
Version: 0.158
Security Critical: no
License: LGPL 3
License File: NOT_SHIPPED
Description:
Library to inspect and manipulate ELF files.
This code is not considered security critical because it is built only for
the host, to support host build tools. It is not linked into chrome.
Local Modifications:
config.h created by running configure and then anonymizing MODVERSION.
The following local patches have also been applied:
- clang.patch (for http://crbug.com/385553)
This code is not considered security critical because it is built only for
the host, to support host build tools. It is not linked into chrome.
diff --git a/libelf/elf32_updatefile.c b/libelf/elf32_updatefile.c
index b39e284..31c4850 100644
--- a/libelf/elf32_updatefile.c
+++ b/libelf/elf32_updatefile.c
@@ -101,6 +101,33 @@ sort_sections (Elf_Scn **scns, Elf_ScnList *list)
}
+static void
+fill_mmap (char *last_position,
+ char *shdr_start,
+ char *shdr_end,
+ char *scn_start,
+ size_t offset)
+{
+ size_t written = 0;
+
+ if (last_position < shdr_start)
+ {
+ written = MIN (scn_start + offset - last_position,
+ shdr_start - last_position);
+
+ memset (last_position, __libelf_fill_byte, written);
+ }
+
+ if (last_position + written != scn_start + offset
+ && shdr_end < scn_start + offset)
+ {
+ char *fill_start = MAX (shdr_end, scn_start);
+ memset (fill_start, __libelf_fill_byte,
+ scn_start + offset - fill_start);
+ }
+}
+
+
int
internal_function
__elfw2(LIBELFBITS,updatemmap) (Elf *elf, int change_bo, size_t shnum)
@@ -290,27 +317,6 @@ __elfw2(LIBELFBITS,updatemmap) (Elf *elf, int change_bo, size_t shnum)
Elf_Data_List *dl = &scn->data_list;
bool scn_changed = false;
- void fill_mmap (size_t offset)
- {
- size_t written = 0;
-
- if (last_position < shdr_start)
- {
- written = MIN (scn_start + offset - last_position,
- shdr_start - last_position);
-
- memset (last_position, __libelf_fill_byte, written);
- }
-
- if (last_position + written != scn_start + offset
- && shdr_end < scn_start + offset)
- {
- char *fill_start = MAX (shdr_end, scn_start);
- memset (fill_start, __libelf_fill_byte,
- scn_start + offset - fill_start);
- }
- }
-
if (scn->data_list_rear != NULL)
do
{
@@ -325,7 +331,8 @@ __elfw2(LIBELFBITS,updatemmap) (Elf *elf, int change_bo, size_t shnum)
|| ((scn->flags | dl->flags | elf->flags)
& ELF_F_DIRTY) != 0))
{
- fill_mmap (dl->data.d.d_off);
+ fill_mmap (last_position, shdr_start, shdr_end,
+ scn_start, dl->data.d.d_off);
last_position = scn_start + dl->data.d.d_off;
}
@@ -377,7 +384,7 @@ __elfw2(LIBELFBITS,updatemmap) (Elf *elf, int change_bo, size_t shnum)
/* If the previous section (or the ELF/program
header) changed we might have to fill the gap. */
if (scn_start > last_position && previous_scn_changed)
- fill_mmap (0);
+ fill_mmap (last_position, shdr_start, shdr_end, scn_start, 0);
/* We have to trust the existing section header information. */
last_position = scn_start + shdr->sh_size;
diff --git a/libelf/elf_begin.c b/libelf/elf_begin.c
index b9d5cea..62aa54a 100644
--- a/libelf/elf_begin.c
+++ b/libelf/elf_begin.c
@@ -985,6 +985,22 @@ write_file (int fd, Elf_Cmd cmd)
}
+/* Duplicate the descriptor, with write lock if an archive. */
+static Elf *
+lock_dup_elf (int fildes, Elf_Cmd cmd, Elf *ref)
+{
+ /* We need wrlock to dup an archive. */
+ if (ref->kind == ELF_K_AR)
+ {
+ rwlock_unlock (ref->lock);
+ rwlock_wrlock (ref->lock);
+ }
+
+ /* Duplicate the descriptor. */
+ return dup_elf (fildes, cmd, ref);
+}
+
+
/* Return a descriptor for the file belonging to FILDES. */
Elf *
elf_begin (fildes, cmd, ref)
@@ -1011,19 +1027,6 @@ elf_begin (fildes, cmd, ref)
return NULL;
}
- Elf *lock_dup_elf ()
- {
- /* We need wrlock to dup an archive. */
- if (ref->kind == ELF_K_AR)
- {
- rwlock_unlock (ref->lock);
- rwlock_wrlock (ref->lock);
- }
-
- /* Duplicate the descriptor. */
- return dup_elf (fildes, cmd, ref);
- }
-
switch (cmd)
{
case ELF_C_NULL:
@@ -1044,7 +1047,7 @@ elf_begin (fildes, cmd, ref)
case ELF_C_READ:
case ELF_C_READ_MMAP:
if (ref != NULL)
- retval = lock_dup_elf ();
+ retval = lock_dup_elf (fildes, cmd, ref);
else
/* Create descriptor for existing file. */
retval = read_file (fildes, 0, ~((size_t) 0), cmd, NULL);
@@ -1065,7 +1068,7 @@ elf_begin (fildes, cmd, ref)
retval = NULL;
}
else
- retval = lock_dup_elf ();
+ retval = lock_dup_elf (fildes, cmd, ref);
}
else
/* Create descriptor for existing file. */
diff --git a/libelf/elf_getarsym.c b/libelf/elf_getarsym.c
index d0bb28a..a9bbb9d 100644
--- a/libelf/elf_getarsym.c
+++ b/libelf/elf_getarsym.c
@@ -196,18 +196,15 @@ elf_getarsym (elf, ptr)
elf->state.ar.ar_sym = (Elf_Arsym *) malloc (ar_sym_len);
if (elf->state.ar.ar_sym != NULL)
{
- union
- {
- uint32_t u32[n];
- uint64_t u64[n];
- } *file_data;
+ uint8_t file_data_buffer[n * sizeof(uint64_t)];
+ void *file_data = (void *) file_data_buffer;
+ uint64_t *file_data_u64 = (uint64_t *) file_data;
+ uint32_t *file_data_u32 = (uint32_t *) file_data;
char *str_data;
size_t sz = n * w;
if (elf->map_address == NULL)
{
- file_data = alloca (sz);
-
ar_sym_len += index_size - n * w;
Elf_Arsym *newp = (Elf_Arsym *) realloc (elf->state.ar.ar_sym,
ar_sym_len);
@@ -241,8 +238,12 @@ elf_getarsym (elf, ptr)
{
file_data = (void *) (elf->map_address + off);
if (!ALLOW_UNALIGNED
- && ((uintptr_t) file_data & -(uintptr_t) n) != 0)
- file_data = memcpy (alloca (sz), elf->map_address + off, sz);
+ && ((uintptr_t) file_data & -(uintptr_t) n) != 0) {
+ file_data = (void *) file_data_buffer;
+ memcpy(file_data, elf->map_address + off, sz);
+ }
+ file_data_u64 = (uint64_t *) file_data;
+ file_data_u32 = (uint32_t *) file_data;
str_data = (char *) (elf->map_address + off + sz);
}
@@ -253,7 +254,7 @@ elf_getarsym (elf, ptr)
arsym[cnt].as_name = str_data;
if (index64_p)
{
- uint64_t tmp = file_data->u64[cnt];
+ uint64_t tmp = file_data_u64[cnt];
if (__BYTE_ORDER == __LITTLE_ENDIAN)
tmp = bswap_64 (tmp);
@@ -275,9 +276,9 @@ elf_getarsym (elf, ptr)
}
}
else if (__BYTE_ORDER == __LITTLE_ENDIAN)
- arsym[cnt].as_off = bswap_32 (file_data->u32[cnt]);
+ arsym[cnt].as_off = bswap_32 (file_data_u32[cnt]);
else
- arsym[cnt].as_off = file_data->u32[cnt];
+ arsym[cnt].as_off = file_data_u32[cnt];
arsym[cnt].as_hash = _dl_elf_hash (str_data);
str_data = rawmemchr (str_data, '\0') + 1;
/* config.h. Generated from config.h.in by configure. */
/* config.h.in. Generated from configure.ac by autoheader. */
/* Should ar and ranlib use -D behavior by default? */
#define DEFAULT_AR_DETERMINISTIC false
/* Defined if libdw should support GNU ref_alt FORM, dwz multi files. */
/* #undef ENABLE_DWZ */
/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1
/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1
/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
/* Define to 1 if you have the <strings.h> header file. */
#define HAVE_STRINGS_H 1
/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1
/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1
/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
/* $libdir subdirectory containing libebl modules. */
#define LIBEBL_SUBDIR "elfutils"
/* Identifier for modules in the build. */
#define MODVERSION "Unused"
/* Define to 32 or 64 if a specific implementation is wanted. */
/* #undef NATIVE_ELF */
/* Name of package */
#define PACKAGE "elfutils"
/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT "https://bugzilla.redhat.com/"
/* Define to the full name of this package. */
#define PACKAGE_NAME "elfutils"
/* Define to the full name and version of this package. */
#define PACKAGE_STRING "elfutils 0.158"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "elfutils"
/* Define to the home page for this package. */
#define PACKAGE_URL ""
/* Define to the version of this package. */
#define PACKAGE_VERSION "0.158"
/* The size of `long', as computed by sizeof. */
#define SIZEOF_LONG 8
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Support bzip2 decompression via -lbz2. */
#define USE_BZLIB 1
/* Defined if demangling is enabled */
#define USE_DEMANGLE 1
/* Defined if libraries should be thread-safe. */
/* #undef USE_LOCKS */
/* Support LZMA (xz) decompression via -llzma. */
/* #undef USE_LZMA */
/* Support gzip decompression via -lz. */
#define USE_ZLIB 1
/* Version number of package */
#define VERSION "0.158"
/* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a
`char[]'. */
#define YYTEXT_POINTER 1
/* Enable large inode numbers on Mac OS X 10.5. */
#ifndef _DARWIN_USE_64_BIT_INODE
# define _DARWIN_USE_64_BIT_INODE 1
#endif
/* Number of bits in a file offset, on hosts where this is settable. */
/* #undef _FILE_OFFSET_BITS */
/* Define for large files, on AIX-style hosts. */
/* #undef _LARGE_FILES */
#include <eu-config.h>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment