Lines Matching +full:build +full:- +full:static +full:- +full:rel
2 Copyright (C) 2005-2012, 2014, 2015 Red Hat, Inc.
35 #include "../libelf/elf-knowledge.h"
40 static Elf *open_file (const char *fname, int *fdp, Ebl **eblp);
41 static bool search_for_copy_reloc (Ebl *ebl, size_t scnndx, int symndx);
42 static int regioncompare (const void *p1, const void *p2);
57 static const struct argp_option options[] =
63 { "hash-inexact", OPT_HASH_INEXACT, NULL, 0,
65 { "ignore-build-id", OPT_IGNORE_BUILD_ID, NULL, 0,
66 N_("Ignore differences in build ID"), 0 },
74 static const char doc[] = N_("\
78 static const char args_doc[] = N_("FILE1 FILE2");
81 static error_t parse_opt (int key, char *arg, struct argp_state *state);
84 static struct argp argp =
91 static enum
107 static bool quiet;
110 static bool verbose;
113 static bool hash_inexact;
115 /* True iff build ID notes should be ignored. */
116 static bool ignore_build_id;
118 static bool hash_content_equivalent (size_t entsize, Elf_Data *, Elf_Data *);
137 /* We expect exactly two non-option parameters. */ in main()
153 section is compared according to the rules of the --gaps option. in main()
172 fname1, elf_errmsg (-1)); in main()
177 fname2, elf_errmsg (-1)); in main()
189 if (unlikely (memcmp (ehdr1->e_ident, ehdr2->e_ident, EI_NIDENT) != 0 in main()
190 || ehdr1->e_type != ehdr2->e_type in main()
191 || ehdr1->e_machine != ehdr2->e_machine in main()
192 || ehdr1->e_version != ehdr2->e_version in main()
193 || ehdr1->e_entry != ehdr2->e_entry in main()
194 || ehdr1->e_phoff != ehdr2->e_phoff in main()
195 || ehdr1->e_flags != ehdr2->e_flags in main()
196 || ehdr1->e_ehsize != ehdr2->e_ehsize in main()
197 || ehdr1->e_phentsize != ehdr2->e_phentsize in main()
198 || ehdr1->e_phnum != ehdr2->e_phnum in main()
199 || ehdr1->e_shentsize != ehdr2->e_shentsize)) in main()
210 fname1, elf_errmsg (-1)); in main()
213 fname2, elf_errmsg (-1)); in main()
225 fname1, elf_errmsg (-1)); in main()
228 fname2, elf_errmsg (-1)); in main()
241 fname1, elf_errmsg (-1)); in main()
244 fname2, elf_errmsg (-1)); in main()
269 sname1 = elf_strptr (elf1, shstrndx1, shdr1->sh_name); in main()
282 sname2 = elf_strptr (elf2, shstrndx2, shdr2->sh_name); in main()
290 if (gaps != gaps_ignore && (shdr1->sh_flags & SHF_ALLOC) != 0) in main()
293 newp->from = shdr1->sh_offset; in main()
294 newp->to = shdr1->sh_offset + shdr1->sh_size; in main()
295 newp->next = regions; in main()
316 if (shdr1->sh_type != shdr2->sh_type in main()
318 || shdr1->sh_flags != shdr2->sh_flags in main()
319 || shdr1->sh_addr != shdr2->sh_addr in main()
320 || (shdr1->sh_offset != shdr2->sh_offset in main()
321 && (shdr1->sh_flags & SHF_ALLOC) in main()
322 && ehdr1->e_type != ET_REL) in main()
323 || shdr1->sh_size != shdr2->sh_size in main()
324 || shdr1->sh_link != shdr2->sh_link in main()
325 || shdr1->sh_info != shdr2->sh_info in main()
326 || shdr1->sh_addralign != shdr2->sh_addralign in main()
327 || shdr1->sh_entsize != shdr2->sh_entsize) in main()
338 elf_ndxscn (scn1), fname1, elf_errmsg (-1)); in main()
344 elf_ndxscn (scn2), fname2, elf_errmsg (-1)); in main()
346 switch (shdr1->sh_type) in main()
350 if (shdr1->sh_entsize == 0) in main()
357 for (int ndx = 0; ndx < (int) (shdr1->sh_size / shdr1->sh_entsize); in main()
365 fname1, elf_errmsg (-1)); in main()
371 fname2, elf_errmsg (-1)); in main()
373 const char *name1 = elf_strptr (elf1, shdr1->sh_link, in main()
374 sym1->st_name); in main()
375 const char *name2 = elf_strptr (elf2, shdr2->sh_link, in main()
376 sym2->st_name); in main()
379 || sym1->st_value != sym2->st_value in main()
380 || (sym1->st_size != sym2->st_size in main()
381 && sym1->st_shndx != SHN_UNDEF) in main()
382 || sym1->st_info != sym2->st_info in main()
383 || sym1->st_other != sym2->st_other in main()
384 || sym1->st_shndx != sym2->st_shndx)) in main()
404 if (sym1->st_shndx == SHN_UNDEF in main()
405 && sym1->st_size != sym2->st_size) in main()
432 while (off1 < data1->d_size in main()
437 ? "" : data1->d_buf + name_offset); in main()
438 const void *desc1 = data1->d_buf + desc_offset; in main()
439 if (off2 >= data2->d_size) in main()
452 elf_ndxscn (scn2), sname2, fname2, elf_errmsg (-1)); in main()
454 ? "" : data2->d_buf + name_offset); in main()
455 const void *desc2 = data2->d_buf + desc_offset; in main()
485 %s %s differ: build ID length"), in main()
493 %s %s differ: build ID content"), in main()
509 if (off2 < data2->d_size) in main()
522 assert (shdr1->sh_type == SHT_NOBITS in main()
523 || (data1->d_buf != NULL || data1->d_size == 0)); in main()
524 assert (shdr2->sh_type == SHT_NOBITS in main()
525 || (data2->d_buf != NULL || data1->d_size == 0)); in main()
527 if (unlikely (data1->d_size != data2->d_size in main()
528 || (shdr1->sh_type != SHT_NOBITS in main()
529 && data1->d_size != 0 in main()
530 && memcmp (data1->d_buf, data2->d_buf, in main()
531 data1->d_size) != 0))) in main()
534 && shdr1->sh_type == SHT_HASH in main()
535 && data1->d_size == data2->d_size in main()
536 && hash_content_equivalent (shdr1->sh_entsize, data1, data2)) in main()
573 ehdr_region.to = ehdr1->e_ehsize; in main()
576 phdr_region.from = ehdr1->e_phoff; in main()
577 phdr_region.to = ehdr1->e_phoff + phnum1 * ehdr1->e_phentsize; in main()
595 fname1, elf_errmsg (-1)); in main()
600 fname2, elf_errmsg (-1)); in main()
605 regions = regions->next; in main()
619 ndx, fname1, elf_errmsg (-1)); in main()
625 ndx, fname2, elf_errmsg (-1)); in main()
635 if (gaps != gaps_ignore && phdr1->p_type == PT_LOAD) in main()
638 while (cnt < nregions && regionsarr[cnt].to < phdr1->p_offset) in main()
641 GElf_Off last = phdr1->p_offset; in main()
642 GElf_Off end = phdr1->p_offset + phdr1->p_filesz; in main()
650 regionsarr[cnt].from - last) != 0)) in main()
683 static error_t
705 _("Invalid value '%s' for --gaps parameter."), in parse_opt()
728 static Elf *
732 if (unlikely (fd == -1)) in open_file()
738 fname, elf_errmsg (-1)); in open_file()
750 static bool
754 while ((scn = elf_nextscn (ebl->elf, scn)) != NULL) in search_for_copy_reloc()
761 elf_ndxscn (scn), elf_errmsg (-1)); in search_for_copy_reloc()
763 if ((shdr->sh_type != SHT_REL && shdr->sh_type != SHT_RELA) in search_for_copy_reloc()
764 || shdr->sh_link != scnndx) in search_for_copy_reloc()
771 elf_ndxscn (scn), elf_errmsg (-1)); in search_for_copy_reloc()
773 if (shdr->sh_type == SHT_REL && shdr->sh_entsize != 0) in search_for_copy_reloc()
774 for (int ndx = 0; ndx < (int) (shdr->sh_size / shdr->sh_entsize); in search_for_copy_reloc()
778 GElf_Rel *rel = gelf_getrel (data, ndx, &rel_mem); in search_for_copy_reloc() local
779 if (rel == NULL) in search_for_copy_reloc()
781 elf_errmsg (-1)); in search_for_copy_reloc()
783 if ((int) GELF_R_SYM (rel->r_info) == symndx in search_for_copy_reloc()
784 && ebl_copy_reloc_p (ebl, GELF_R_TYPE (rel->r_info))) in search_for_copy_reloc()
787 else if (shdr->sh_entsize != 0) in search_for_copy_reloc()
788 for (int ndx = 0; ndx < (int) (shdr->sh_size / shdr->sh_entsize); in search_for_copy_reloc()
795 elf_errmsg (-1)); in search_for_copy_reloc()
797 if ((int) GELF_R_SYM (rela->r_info) == symndx in search_for_copy_reloc()
798 && ebl_copy_reloc_p (ebl, GELF_R_TYPE (rela->r_info))) in search_for_copy_reloc()
807 static int
813 if (r1->from < r2->from) in regioncompare()
814 return -1; in regioncompare()
819 static int
824 return *w1 < *w2 ? -1 : *w1 > *w2 ? 1 : 0; in compare_Elf32_Word()
827 static int
832 return *w1 < *w2 ? -1 : *w1 > *w2 ? 1 : 0; in compare_Elf64_Xword()
835 static bool
840 const Hash_Word *const hash1 = data1->d_buf; \ in hash_content_equivalent()
841 const Hash_Word *const hash2 = data2->d_buf; \ in hash_content_equivalent()
844 if (data1->d_size != (2 + nbucket + nchain) * sizeof hash1[0] \ in hash_content_equivalent()
854 Hash_Word temp1[nchain - 1]; \ in hash_content_equivalent()
855 Hash_Word temp2[nchain - 1]; \ in hash_content_equivalent()
864 if (p >= nchain || b1 >= nchain - 1) \ in hash_content_equivalent()
871 if (p >= nchain || b2 >= nchain - 1) \ in hash_content_equivalent()