diff options
author | Chih-Hung Hsieh <chh@google.com> | 2015-10-08 10:09:37 -0700 |
---|---|---|
committer | Chih-Hung Hsieh <chh@google.com> | 2015-10-08 10:27:14 -0700 |
commit | 322dc30a675af1bf85103c43d48368af0be38927 (patch) | |
tree | 40ae3959ffe2abac7ce87f49186787648dee3101 /libelf | |
parent | 5e22dcc417102da5c05f8c5b98b9b617cdbf7b20 (diff) | |
parent | 86ed7f7f53179d7a893329e6b9851dbb75aba405 (diff) | |
download | android_external_elfutils-322dc30a675af1bf85103c43d48368af0be38927.tar.gz android_external_elfutils-322dc30a675af1bf85103c43d48368af0be38927.tar.bz2 android_external_elfutils-322dc30a675af1bf85103c43d48368af0be38927.zip |
Merge upstream commit '86ed7f7'.
git merge 86ed7f7
Include upstream changes up to Thu Oct 8 00:16:03 2015.
Previous clang compilation errors about union of VLA
should be fixed with this merge.
* Allocate exact amount of bytes for phdrs and shdrs.
* Do without union of variable length arrays.
* Other changes from upstream, not all used for Android:
AM_SILENT_RULES coverage, sparc check_object_attribute ebl hook,
Use -fPIC in PIC code.
* No change of generated files such as:
./config.h, libdw/known-dwarf.h, ./version.h
Change-Id: Iac63519112c4a92b57344f4a43bf0e9a6c4baa13
Diffstat (limited to 'libelf')
-rw-r--r-- | libelf/ChangeLog | 14 | ||||
-rw-r--r-- | libelf/Makefile.am | 6 | ||||
-rw-r--r-- | libelf/elf_getarsym.c | 14 |
3 files changed, 23 insertions, 11 deletions
diff --git a/libelf/ChangeLog b/libelf/ChangeLog index 0609b37d..0b9ddf2b 100644 --- a/libelf/ChangeLog +++ b/libelf/ChangeLog @@ -1,3 +1,17 @@ +2015-10-05 Chih-Hung Hsieh <chh@google.com> + + * elf_getarsym.c (elf_getarsym): Do not use + union of variable length arrays. + +2015-10-05 Josh Stone <jistone@redhat.com> + + * Makefile.am (libelf.so): Add AM_V_CCLD and AM_V_at silencers. + +2015-09-24 Jose E. Marchesi <jose.marchesi@oracle.com> + + * Makefile.am (AM_CFLAGS): Use -fPIC instead of -fpic to avoid + relocation overflows in some platforms. + 2015-09-29 Mark Wielaard <mjw@redhat.com> * elf32_updatenull.c (default_ehdr): Set e_version when EV_NONE. diff --git a/libelf/Makefile.am b/libelf/Makefile.am index afcb2aa5..91a7d073 100644 --- a/libelf/Makefile.am +++ b/libelf/Makefile.am @@ -29,7 +29,7 @@ ## include $(top_srcdir)/config/eu.am if BUILD_STATIC -AM_CFLAGS += -fpic +AM_CFLAGS += -fPIC endif GCC_INCLUDE = -I$(shell $(CC) -print-file-name=include) VERSION = 1 @@ -100,11 +100,11 @@ endif libelf_so_SOURCES = libelf.so$(EXEEXT): libelf_pic.a libelf.map - $(LINK) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \ + $(AM_V_CCLD)$(LINK) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \ -Wl,--version-script,$(srcdir)/libelf.map,--no-undefined \ -Wl,--soname,$@.$(VERSION),-z,defs,-z,relro $(libelf_so_LDLIBS) @$(textrel_check) - ln -fs $@ $@.$(VERSION) + $(AM_V_at)ln -fs $@ $@.$(VERSION) install: install-am libelf.so $(mkinstalldirs) $(DESTDIR)$(libdir) diff --git a/libelf/elf_getarsym.c b/libelf/elf_getarsym.c index 1ab94ca8..65c67cc8 100644 --- a/libelf/elf_getarsym.c +++ b/libelf/elf_getarsym.c @@ -201,11 +201,7 @@ elf_getarsym (Elf *elf, size_t *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; + void *file_data; /* unit32_t[n] or uint64_t[n] */ char *str_data; size_t sz = n * w; @@ -267,12 +263,14 @@ elf_getarsym (Elf *elf, size_t *ptr) /* Now we can build the data structure. */ Elf_Arsym *arsym = elf->state.ar.ar_sym; + uint64_t (*u64)[n] = file_data; + uint32_t (*u32)[n] = file_data; for (size_t cnt = 0; cnt < n; ++cnt) { arsym[cnt].as_name = str_data; if (index64_p) { - uint64_t tmp = file_data->u64[cnt]; + uint64_t tmp = (*u64)[cnt]; if (__BYTE_ORDER == __LITTLE_ENDIAN) tmp = bswap_64 (tmp); @@ -294,9 +292,9 @@ elf_getarsym (Elf *elf, size_t *ptr) } } else if (__BYTE_ORDER == __LITTLE_ENDIAN) - arsym[cnt].as_off = bswap_32 (file_data->u32[cnt]); + arsym[cnt].as_off = bswap_32 ((*u32)[cnt]); else - arsym[cnt].as_off = file_data->u32[cnt]; + arsym[cnt].as_off = (*u32)[cnt]; arsym[cnt].as_hash = _dl_elf_hash (str_data); str_data = rawmemchr (str_data, '\0') + 1; |