Page MenuHomeFreeBSD

D15734.id46905.diff
No OneTemporary

D15734.id46905.diff

Index: contrib/elftoolchain/elfcopy/main.c
===================================================================
--- contrib/elftoolchain/elfcopy/main.c
+++ contrib/elftoolchain/elfcopy/main.c
@@ -372,6 +372,14 @@
create_symtab(ecp);
/*
+ * Write the underlying ehdr. Note that it should be called
+ * before elf_setshstrndx() since it will overwrite e->e_shstrndx.
+ */
+ if (gelf_update_ehdr(ecp->eout, &oeh) == 0)
+ errx(EXIT_FAILURE, "gelf_update_ehdr() failed: %s",
+ elf_errmsg(-1));
+
+ /*
* First processing of output sections: at this stage we copy the
* content of each section from input to output object. Section
* content will be modified and printed (mcs) if need. Also content of
@@ -380,14 +388,6 @@
*/
copy_content(ecp);
- /*
- * Write the underlying ehdr. Note that it should be called
- * before elf_setshstrndx() since it will overwrite e->e_shstrndx.
- */
- if (gelf_update_ehdr(ecp->eout, &oeh) == 0)
- errx(EXIT_FAILURE, "gelf_update_ehdr() failed: %s",
- elf_errmsg(-1));
-
/* Generate section name string table (.shstrtab). */
set_shstrtab(ecp);
Index: contrib/elftoolchain/libelf/Makefile
===================================================================
--- contrib/elftoolchain/libelf/Makefile
+++ contrib/elftoolchain/libelf/Makefile
@@ -35,6 +35,7 @@
gelf_ehdr.c \
gelf_getclass.c \
gelf_fsize.c \
+ gelf_mips64el.c \
gelf_move.c \
gelf_phdr.c \
gelf_rel.c \
Index: contrib/elftoolchain/libelf/_libelf.h
===================================================================
--- contrib/elftoolchain/libelf/_libelf.h
+++ contrib/elftoolchain/libelf/_libelf.h
@@ -216,12 +216,15 @@
void *_libelf_getphdr(Elf *_e, int _elfclass);
void *_libelf_getshdr(Elf_Scn *_scn, int _elfclass);
void _libelf_init_elf(Elf *_e, Elf_Kind _kind);
+int _libelf_is_mips64el(Elf *e);
int _libelf_load_section_headers(Elf *e, void *ehdr);
unsigned int _libelf_malign(Elf_Type _t, int _elfclass);
Elf *_libelf_memory(unsigned char *_image, size_t _sz, int _reporterror);
size_t _libelf_msize(Elf_Type _t, int _elfclass, unsigned int _version);
void *_libelf_newphdr(Elf *_e, int _elfclass, size_t _count);
Elf *_libelf_open_object(int _fd, Elf_Cmd _c, int _reporterror);
+Elf64_Xword _libelf_mips64el_r_info_tof(Elf64_Xword r_info);
+Elf64_Xword _libelf_mips64el_r_info_tom(Elf64_Xword r_info);
struct _Libelf_Data *_libelf_release_data(struct _Libelf_Data *_d);
Elf *_libelf_release_elf(Elf *_e);
Elf_Scn *_libelf_release_scn(Elf_Scn *_s);
Index: contrib/elftoolchain/libelf/gelf_rel.c
===================================================================
--- contrib/elftoolchain/libelf/gelf_rel.c
+++ contrib/elftoolchain/libelf/gelf_rel.c
@@ -90,6 +90,9 @@
rel64 = (Elf64_Rel *) d->d_data.d_buf + ndx;
*dst = *rel64;
+
+ if (_libelf_is_mips64el(e))
+ dst->r_info = _libelf_mips64el_r_info_tom(rel64->r_info);
}
return (dst);
@@ -156,6 +159,9 @@
rel64 = (Elf64_Rel *) d->d_data.d_buf + ndx;
*rel64 = *dr;
+
+ if (_libelf_is_mips64el(e))
+ rel64->r_info = _libelf_mips64el_r_info_tof(dr->r_info);
}
return (1);
Index: contrib/elftoolchain/libelf/gelf_rela.c
===================================================================
--- contrib/elftoolchain/libelf/gelf_rela.c
+++ contrib/elftoolchain/libelf/gelf_rela.c
@@ -91,6 +91,10 @@
rela64 = (Elf64_Rela *) d->d_data.d_buf + ndx;
*dst = *rela64;
+
+ if (_libelf_is_mips64el(e))
+ dst->r_info =
+ _libelf_mips64el_r_info_tom(rela64->r_info);
}
return (dst);
@@ -159,6 +163,9 @@
rela64 = (Elf64_Rela *) d->d_data.d_buf + ndx;
*rela64 = *dr;
+
+ if (_libelf_is_mips64el(e))
+ rela64->r_info = _libelf_mips64el_r_info_tof(dr->r_info);
}
return (1);

File Metadata

Mime Type
text/plain
Expires
Thu, Aug 27, 3:28 PM (13 h, 2 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
37351550
Default Alt Text
D15734.id46905.diff (3 KB)

Event Timeline