From 770f3244ffe758a5581fdf204f83975c6356ff40 Mon Sep 17 00:00:00 2001 From: Eric Gallager Date: Mon, 8 Jan 2024 09:05:50 -0500 Subject: [PATCH] more -Wconversion in bfd/elf*.c Change-Id: I7231e94b3e863c9648df3b416b4e17e4ff9bf088 --- .github/workflows/apple-gdb-1824-macos.yml | 12 +- .github/workflows/codeql.yml | 2 +- macsbug/gdb_plugin_support/Makefile | 1 + src/bfd/elf-nacl.c | 21 ++-- src/bfd/elf-strtab.c | 2 +- src/bfd/elf32-avr.c | 74 +++++------ src/bfd/elf32-cr16c.c | 33 ++--- src/bfd/elf32-cris.c | 44 ++++--- src/bfd/elf32-crx.c | 81 ++++++------ src/bfd/elf32-d10v.c | 38 +++--- src/bfd/elf32-dlx.c | 14 +-- src/bfd/elf32-frv.c | 46 +++---- src/bfd/elf32-h8300.c | 18 +-- src/bfd/elf32-hppa.c | 137 ++++++++++----------- src/bfd/elf32-i386.c | 24 ++-- src/bfd/po/bfd.pot | 2 +- 16 files changed, 276 insertions(+), 273 deletions(-) diff --git a/.github/workflows/apple-gdb-1824-macos.yml b/.github/workflows/apple-gdb-1824-macos.yml index cd614aa13..ff7ac6971 100644 --- a/.github/workflows/apple-gdb-1824-macos.yml +++ b/.github/workflows/apple-gdb-1824-macos.yml @@ -33,12 +33,12 @@ jobs: - run: ./configure --enable-silent-rules CC=${{ matrix.compiler }} OBJC=${{ matrix.compiler }} - run: make -ki -C libcheckpoint || make -ki -C libcheckpoint -f Makefile_orig || make -ki -C macsbug || make -ki -C macsbug/gdb_plugin_support || (if test -x "$(which ant)"; then ant; else echo "ant missing"; fi) - run: if test ! -e libcheckpoint/libcheckpoint.dylib; then (sync && echo "ensuring libcheckpoint is built" && sync && make -ki -C libcheckpoint -f Makefile_orig RC_CFLAGS="-std=gnu89 -w -Wno-error" && sync) || (sync && make -ki -C macsbug) || (sync && make -ki -C macsbug/gdb_plugin_support) || (if test -x "$(which ant)"; then ant; else echo "ant missing"; fi); else (sync && stat libcheckpoint/libcheckpoint.dylib); fi - - run: if test -d .. && test -w .. && test ! -e ../gdb; then (echo "symlinking source directory" && pushd .. && ln -sv apple-gdb-1824 gdb && sync && readlink gdb && sync && popd); else (sync && stat .. && ls ..); fi + - run: if test -d .. && test -w .. && test ! -e ../gdb; then (echo "symlinking source directory" && pushd .. && sync && ln -sv apple-gdb-1824 gdb && sync && readlink gdb && sync && popd); else (sync && stat .. && ls ..); fi - run: (if test -n "$(type ant 2>/dev/null)" && test -x "$(which ant)" && test -r build.xml; then if test ! -d build; then mkdir build; elif test ! -d "${HOME}"/work/apple-gdb-1824/build; then mkdir -pv "${HOME}"/work/apple-gdb-1824/build; fi; ant; else (echo "ant missing" && sync); fi) || (if test -x ./gradlew; then (./gradlew build || ./gradlew assemble || ./gradlew); elif test -r ./gradlew; then sh ./gradlew; elif test -e ./gradlew; then stat ./gradlew; else echo "gradlewrapper missing"; fi) || (if test -x "$(which gradle)"; then gradle; else echo "gradle missing"; fi) || (if test -x ~rc/bin/buildit; then sudo ~rc/bin/buildit "$(pwd)" -arch ppc -arch i386 -arch armv5 -target cross -project gdb -release RELEASENAME RC_CROSS_ARCHS=armv6; else echo "buildit missing"; fi) || ls - run: (if test -x ./gradlew; then (./gradlew build || ./gradlew assemble || ./gradlew); elif test -r ./gradlew; then sh ./gradlew; elif test -e ./gradlew; then stat ./gradlew; else echo "gradlewrapper missing" >&2; fi) || (if test -x "$(which gradle)"; then gradle; else echo "gradle missing"; fi) || (if test -x ~rc/bin/buildit; then sudo ~rc/bin/buildit "$(pwd)" -arch ppc -arch i386 -arch armv5 -target cross -project gdb -release RELEASENAME RC_CROSS_ARCHS=armv6; else echo "buildit missing"; fi) || ls - run: cd src && ./configure --disable-werror --disable-opts-test --enable-carbon-framework --enable-debug-symbols-framework --enable-64-bit-bfd --enable-silent-rules CC=${{ matrix.compiler }} OBJC=${{ matrix.compiler }} - run: cd src && make configure-bfd - - run: cd src && make -C bfd headers + - run: cd src && sync && make -C bfd headers && sync - run: cd src && if test ! -e bfd/bfd.h; then (sync && make -C bfd bfd.h); else (sync && stat bfd/bfd.h); fi - run: cd src && make -C bfd diststuff - run: cd src && make all-bfd @@ -54,20 +54,20 @@ jobs: echo "make my_arparse.h"; \ make my_arparse.h; \ else \ - sync && stat arparse.h; \ + sync && echo "arparse.h exists" && sync && stat arparse.h; \ fi if test ! -f arparse.h; then \ echo "remake arparse.c"; \ remake arparse.c; \ else \ - sync && wc -l arparse.h; \ + sync && echo "checking arparse.h length" && sync && wc -l arparse.h; \ fi # shellcheck disable=SC2046 if test ! -e arparse.h; then \ echo "trying the relevant Makefile rule as copied into this CI workflow"; \ /bin/sh ./../ylwrap arparse.y y.tab.c arparse.c y.tab.h "$(echo arparse.c | sed -e s/cc$/hh/ -e s/cpp$/hpp/ -e s/cxx$/hxx/ -e s/c++$/h++/ -e s/c$/h/)" y.output arparse.output -- $(if [ -f ../bison/bison ]; then echo ../bison/bison -y -L./../bison/; else echo bison -o y.tab.c; fi) -d -t -v -k; \ else \ - sync && du arparse.h; \ + sync && echo "checking arparse.h disk usage" && sync && du arparse.h; \ fi if test -e arparse.h; then \ if test ! -e ../bfd/arparse.h; then \ @@ -139,7 +139,7 @@ jobs: - run: cd src && make check-opcodes && sync && make check-intl - run: cd src && make check-binutils - run: cd src && make check-utils - - run: time (pwd && sync && ls) + - run: time (pwd && sync && ls && sync) if: "${{ success() }}" - name: Upload a Build Artifact uses: actions/upload-artifact@v4.0.0 diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 71540de8f..a46749a1d 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -83,7 +83,7 @@ jobs: else \ (sync && stat /home/runner/work/apple-gdb-1824/build); \ fi - (cd src && sync && echo "now in $(pwd)...") + (cd src && sync && echo "now in $(pwd)..." && sync) - name: Dependencies if: matrix.language == 'c-cpp' diff --git a/macsbug/gdb_plugin_support/Makefile b/macsbug/gdb_plugin_support/Makefile index 649aa6b98..c39eef5e5 100644 --- a/macsbug/gdb_plugin_support/Makefile +++ b/macsbug/gdb_plugin_support/Makefile @@ -173,6 +173,7 @@ install : all $(DSTDIR) $(SYMROOT)/gdb_plugin_support.o : $(OBJS) ld -r $(OBJS) -arch $(TARGET_ARCHITECTURE) -o $(SYMROOT)/gdb_plugin_support.o + if test -d $(SYMROOT); then stat $(SYMROOT)/gdb_plugin_support.o; fi $(OFILE_DIR)/%.o : %.c $(HFILES) $(CC) $(CFLAGS) $(RC_CFLAGS) -o $(OFILE_DIR)/$(notdir $*).o $< diff --git a/src/bfd/elf-nacl.c b/src/bfd/elf-nacl.c index 06df3d3ab..6a4cf2af5 100644 --- a/src/bfd/elf-nacl.c +++ b/src/bfd/elf-nacl.c @@ -57,7 +57,7 @@ segment_eligible_for_headers (struct elf_segment_map *seg, return FALSE; for (i = 0; i < seg->count; ++i) { - if ((seg->sections[i]->flags & (SEC_CODE|SEC_READONLY)) != SEC_READONLY) + if ((seg->sections[i]->flags & (SEC_CODE | SEC_READONLY)) != SEC_READONLY) return FALSE; } return TRUE; @@ -68,14 +68,15 @@ segment_eligible_for_headers (struct elf_segment_map *seg, The first non-executable PT_LOAD segment appears first in the file and contains the ELF file header and phdrs. */ bfd_boolean -nacl_modify_segment_map (bfd *abfd, struct bfd_link_info *info) +nacl_modify_segment_map(bfd *abfd, struct bfd_link_info *info) { - struct elf_segment_map **m = &elf_seg_map (abfd); + struct elf_segment_map **m = &elf_seg_map(abfd); struct elf_segment_map **first_load = NULL; struct elf_segment_map **last_load = NULL; bfd_boolean moved_headers = FALSE; - int sizeof_headers = info == NULL ? 0 : bfd_sizeof_headers (abfd, info); - bfd_vma minpagesize = get_elf_backend_data (abfd)->minpagesize; + int sizeof_headers = ((info == NULL) + ? 0 : bfd_sizeof_headers(abfd, info)); + bfd_vma minpagesize = get_elf_backend_data(abfd)->minpagesize; if (info != NULL && info->user_phdrs) /* The linker script used PHDRS explicitly, so don't change what the @@ -88,15 +89,15 @@ nacl_modify_segment_map (bfd *abfd, struct bfd_link_info *info) if (seg->p_type == PT_LOAD) { - bfd_boolean executable = segment_executable (seg); + bfd_boolean executable = segment_executable(seg); if (executable - && seg->count > 0 - && seg->sections[0]->vma % minpagesize == 0) + && (seg->count > 0) + && ((seg->sections[0]->vma % minpagesize) == 0)) { asection *lastsec = seg->sections[seg->count - 1]; - bfd_vma end = lastsec->vma + lastsec->size; - if (end % minpagesize != 0) + bfd_vma end = (lastsec->vma + lastsec->size); + if ((end % minpagesize) != 0) { /* This is an executable segment that starts on a page boundary but does not end on a page boundary. Fill diff --git a/src/bfd/elf-strtab.c b/src/bfd/elf-strtab.c index 3a7897db8..0adc17715 100644 --- a/src/bfd/elf-strtab.c +++ b/src/bfd/elf-strtab.c @@ -153,7 +153,7 @@ _bfd_elf_strtab_add(struct elf_strtab_hash *tab, const char *str, entry->refcount++; if (entry->len == 0) { - entry->len = (strlen(str) + 1UL); + entry->len = (int)(strlen(str) + 1UL); /* 2G strings lose: */ BFD_ASSERT(entry->len > 0); if (tab->size == tab->alloced) diff --git a/src/bfd/elf32-avr.c b/src/bfd/elf32-avr.c index cc11ce577..5cc4797b8 100644 --- a/src/bfd/elf32-avr.c +++ b/src/bfd/elf32-avr.c @@ -784,66 +784,68 @@ elf32_avr_relocate_section(bfd *output_bfd ATTRIBUTE_UNUSED, Elf_Internal_Sym *local_syms, asection **local_sections) { - Elf_Internal_Shdr * symtab_hdr; - struct elf_link_hash_entry ** sym_hashes; - Elf_Internal_Rela * rel; - Elf_Internal_Rela * relend; + Elf_Internal_Shdr *symtab_hdr; + struct elf_link_hash_entry **sym_hashes; + Elf_Internal_Rela *rel; + Elf_Internal_Rela *relend; if (info->relocatable) return TRUE; - symtab_hdr = & elf_tdata (input_bfd)->symtab_hdr; - sym_hashes = elf_sym_hashes (input_bfd); - relend = relocs + input_section->reloc_count; + symtab_hdr = &elf_tdata(input_bfd)->symtab_hdr; + sym_hashes = elf_sym_hashes(input_bfd); + relend = (relocs + input_section->reloc_count); for (rel = relocs; rel < relend; rel ++) { - reloc_howto_type * howto; - unsigned long r_symndx; - Elf_Internal_Sym * sym; - asection * sec; - struct elf_link_hash_entry * h; - bfd_vma relocation; - bfd_reloc_status_type r; - const char * name; - int r_type; + reloc_howto_type *howto; + unsigned long r_symndx; + Elf_Internal_Sym *sym; + asection *sec; + struct elf_link_hash_entry *h; + bfd_vma relocation; + bfd_reloc_status_type r; + const char *name; + int r_type; /* This is a final link. */ - r_type = ELF32_R_TYPE (rel->r_info); - r_symndx = ELF32_R_SYM (rel->r_info); - howto = elf_avr_howto_table + ELF32_R_TYPE (rel->r_info); - h = NULL; - sym = NULL; - sec = NULL; + r_type = ELF32_R_TYPE(rel->r_info); + r_symndx = ELF32_R_SYM(rel->r_info); + howto = (elf_avr_howto_table + r_type); + h = NULL; + sym = NULL; + sec = NULL; if (r_symndx < symtab_hdr->sh_info) { - sym = local_syms + r_symndx; - sec = local_sections [r_symndx]; - relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); - - name = bfd_elf_string_from_elf_section - (input_bfd, symtab_hdr->sh_link, sym->st_name); - name = (name == NULL) ? bfd_section_name (input_bfd, sec) : name; + sym = (local_syms + r_symndx); + sec = local_sections[r_symndx]; + relocation = _bfd_elf_rela_local_sym(output_bfd, sym, &sec, rel); + + name = + bfd_elf_string_from_elf_section(input_bfd, + (unsigned int)symtab_hdr->sh_link, + (unsigned int)sym->st_name); + name = ((name == NULL) ? bfd_section_name(input_bfd, sec) : name); } else { bfd_boolean unresolved_reloc, warned; - RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel, - r_symndx, symtab_hdr, sym_hashes, - h, sec, relocation, - unresolved_reloc, warned); + RELOC_FOR_GLOBAL_SYMBOL(info, input_bfd, input_section, rel, + r_symndx, symtab_hdr, sym_hashes, + h, sec, relocation, + unresolved_reloc, warned); name = h->root.root.string; } - r = avr_final_link_relocate (howto, input_bfd, input_section, - contents, rel, relocation); + r = avr_final_link_relocate(howto, input_bfd, input_section, + contents, rel, relocation); if (r != bfd_reloc_ok) { - const char * msg = (const char *) NULL; + const char *msg = (const char *)NULL; switch (r) { diff --git a/src/bfd/elf32-cr16c.c b/src/bfd/elf32-cr16c.c index 8a15dc74b..1ef679be2 100644 --- a/src/bfd/elf32-cr16c.c +++ b/src/bfd/elf32-cr16c.c @@ -720,39 +720,40 @@ elf32_cr16c_relocate_section (bfd *output_bfd, sec = NULL; if (r_symndx < symtab_hdr->sh_info) { - sym = local_syms + r_symndx; + sym = (local_syms + r_symndx); sec = local_sections[r_symndx]; - relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); + relocation = _bfd_elf_rela_local_sym(output_bfd, sym, &sec, rel); } else { bfd_boolean unresolved_reloc, warned; - RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel, - r_symndx, symtab_hdr, sym_hashes, - h, sec, relocation, - unresolved_reloc, warned); + RELOC_FOR_GLOBAL_SYMBOL(info, input_bfd, input_section, rel, + r_symndx, symtab_hdr, sym_hashes, + h, sec, relocation, + unresolved_reloc, warned); } - r = cr16c_elf_final_link_relocate (howto, input_bfd, output_bfd, - input_section, - contents, rel->r_offset, - relocation, rel->r_addend, - info, sec, h == NULL); + r = cr16c_elf_final_link_relocate(howto, input_bfd, output_bfd, + input_section, contents, rel->r_offset, + relocation, rel->r_addend, info, sec, + h == NULL); if (r != bfd_reloc_ok) { const char *name; - const char *msg = (const char *) 0; + const char *msg = (const char *)0; if (h != NULL) name = h->root.root.string; else { - name = (bfd_elf_string_from_elf_section - (input_bfd, symtab_hdr->sh_link, sym->st_name)); + name = + bfd_elf_string_from_elf_section(input_bfd, + (unsigned int)symtab_hdr->sh_link, + (unsigned int)sym->st_name); if (name == NULL || *name == '\0') - name = bfd_section_name (input_bfd, sec); + name = bfd_section_name(input_bfd, sec); } switch (r) @@ -760,7 +761,7 @@ elf32_cr16c_relocate_section (bfd *output_bfd, case bfd_reloc_overflow: if (!((*info->callbacks->reloc_overflow) (info, (h ? &h->root : NULL), name, howto->name, - (bfd_vma) 0, input_bfd, input_section, + (bfd_vma)0UL, input_bfd, input_section, rel->r_offset))) return FALSE; break; diff --git a/src/bfd/elf32-cris.c b/src/bfd/elf32-cris.c index 33d7e3072..2e43d7639 100644 --- a/src/bfd/elf32-cris.c +++ b/src/bfd/elf32-cris.c @@ -513,11 +513,12 @@ cris_elf_grok_prstatus(bfd *abfd, Elf_Internal_Note *note) case 202: /* Linux/CRISv32 */ /* pr_cursig */ - elf_tdata(abfd)->core_signal = bfd_get_16(abfd, - (note->descdata + 12)); + elf_tdata(abfd)->core_signal = (int)bfd_get_16(abfd, + (note->descdata + 12)); /* pr_pid */ - elf_tdata(abfd)->core_pid = bfd_get_32(abfd, note->descdata + 22); + elf_tdata(abfd)->core_pid = (int)bfd_get_32(abfd, + (note->descdata + 22)); /* pr_reg */ offset = 70; @@ -533,10 +534,12 @@ cris_elf_grok_prstatus(bfd *abfd, Elf_Internal_Note *note) case 214: /* Linux/CRIS */ /* pr_cursig */ - elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12); + elf_tdata(abfd)->core_signal = (int)bfd_get_16(abfd, + (note->descdata + 12)); /* pr_pid */ - elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 22); + elf_tdata(abfd)->core_pid = (int)bfd_get_32(abfd, + (note->descdata + 22)); /* pr_reg */ offset = 70; @@ -546,24 +549,25 @@ cris_elf_grok_prstatus(bfd *abfd, Elf_Internal_Note *note) } /* Make a ".reg/999" section. */ - return _bfd_elfcore_make_pseudosection (abfd, ".reg", - size, note->descpos + offset); + return _bfd_elfcore_make_pseudosection(abfd, ".reg", size, + (note->descpos + offset)); } +/* */ static bfd_boolean cris_elf_grok_psinfo(bfd *abfd, Elf_Internal_Note *note) { - if (bfd_get_mach (abfd) == bfd_mach_cris_v32) + if (bfd_get_mach(abfd) == bfd_mach_cris_v32) switch (note->descsz) { default: return FALSE; case 124: /* Linux/CRISv32 elf_prpsinfo */ - elf_tdata (abfd)->core_program - = _bfd_elfcore_strndup (abfd, note->descdata + 28, 16); - elf_tdata (abfd)->core_command - = _bfd_elfcore_strndup (abfd, note->descdata + 44, 80); + elf_tdata(abfd)->core_program = + _bfd_elfcore_strndup(abfd, (note->descdata + 28), 16); + elf_tdata(abfd)->core_command = + _bfd_elfcore_strndup(abfd, (note->descdata + 44), 80); } else switch (note->descsz) @@ -572,10 +576,10 @@ cris_elf_grok_psinfo(bfd *abfd, Elf_Internal_Note *note) return FALSE; case 124: /* Linux/CRIS elf_prpsinfo */ - elf_tdata (abfd)->core_program - = _bfd_elfcore_strndup (abfd, note->descdata + 28, 16); - elf_tdata (abfd)->core_command - = _bfd_elfcore_strndup (abfd, note->descdata + 44, 80); + elf_tdata(abfd)->core_program = + _bfd_elfcore_strndup(abfd, (note->descdata + 28), 16); + elf_tdata(abfd)->core_command = + _bfd_elfcore_strndup(abfd, (note->descdata + 44), 80); } /* Note that for some reason, a spurious space is tacked @@ -583,11 +587,11 @@ cris_elf_grok_psinfo(bfd *abfd, Elf_Internal_Note *note) implementations, so strip it off if it exists. */ { - char *command = elf_tdata (abfd)->core_command; - int n = strlen (command); + char *command = elf_tdata(abfd)->core_command; + size_t n = strlen(command); - if (0 < n && command[n - 1] == ' ') - command[n - 1] = '\0'; + if ((n > 0UL) && command[n - 1UL] == ' ') + command[n - 1UL] = '\0'; } return TRUE; diff --git a/src/bfd/elf32-crx.c b/src/bfd/elf32-crx.c index 027ccf696..4a1555af4 100644 --- a/src/bfd/elf32-crx.c +++ b/src/bfd/elf32-crx.c @@ -573,8 +573,8 @@ crx_elf_final_link_relocate (reloc_howto_type *howto, bfd *input_bfd, /* Delete some bytes from a section while relaxing. */ static bfd_boolean -elf32_crx_relax_delete_bytes (struct bfd_link_info *link_info, bfd *abfd, - asection *sec, bfd_vma addr, int count) +elf32_crx_relax_delete_bytes(struct bfd_link_info *link_info, bfd *abfd, + asection *sec, bfd_vma addr, int count) { Elf_Internal_Shdr *symtab_hdr; unsigned int sec_shndx; @@ -587,11 +587,11 @@ elf32_crx_relax_delete_bytes (struct bfd_link_info *link_info, bfd *abfd, struct elf_link_hash_entry **sym_hashes; struct elf_link_hash_entry **end_hashes; struct elf_link_hash_entry **start_hashes; - unsigned int symcount; + unsigned long symcount; - sec_shndx = _bfd_elf_section_from_bfd_section (abfd, sec); + sec_shndx = _bfd_elf_section_from_bfd_section(abfd, sec); - contents = elf_section_data (sec)->this_hdr.contents; + contents = elf_section_data(sec)->this_hdr.contents; /* The deletion must stop at the next ALIGN reloc for an aligment power larger than the number of bytes we are deleting. */ @@ -599,48 +599,47 @@ elf32_crx_relax_delete_bytes (struct bfd_link_info *link_info, bfd *abfd, irelalign = NULL; toaddr = sec->size; - irel = elf_section_data (sec)->relocs; - irelend = irel + sec->reloc_count; + irel = elf_section_data(sec)->relocs; + irelend = (irel + sec->reloc_count); /* Actually delete the bytes. */ - memmove (contents + addr, contents + addr + count, - (size_t) (toaddr - addr - count)); + memmove((contents + addr), (contents + addr + count), + (size_t)(toaddr - addr - count)); sec->size -= count; /* Adjust all the relocs. */ - for (irel = elf_section_data (sec)->relocs; irel < irelend; irel++) + for (irel = elf_section_data(sec)->relocs; irel < irelend; irel++) { /* Get the new reloc address. */ - if ((irel->r_offset > addr - && irel->r_offset < toaddr)) + if ((irel->r_offset > addr) && (irel->r_offset < toaddr)) irel->r_offset -= count; } /* Adjust the local symbols defined in this section. */ - symtab_hdr = &elf_tdata (abfd)->symtab_hdr; - isym = (Elf_Internal_Sym *) symtab_hdr->contents; - for (isymend = isym + symtab_hdr->sh_info; isym < isymend; isym++) + symtab_hdr = &elf_tdata(abfd)->symtab_hdr; + isym = (Elf_Internal_Sym *)symtab_hdr->contents; + for (isymend = (isym + symtab_hdr->sh_info); isym < isymend; isym++) { - if (isym->st_shndx == sec_shndx - && isym->st_value > addr - && isym->st_value < toaddr) + if ((isym->st_shndx == sec_shndx) + && (isym->st_value > addr) + && (isym->st_value < toaddr)) { /* Adjust the addend of SWITCH relocations in this section, which reference this local symbol. */ - for (irel = elf_section_data (sec)->relocs; irel < irelend; irel++) + for (irel = elf_section_data(sec)->relocs; irel < irelend; irel++) { unsigned long r_symndx; Elf_Internal_Sym *rsym; bfd_vma addsym, subsym; /* Skip if not a SWITCH relocation. */ - if (ELF32_R_TYPE (irel->r_info) != (int) R_CRX_SWITCH8 - && ELF32_R_TYPE (irel->r_info) != (int) R_CRX_SWITCH16 - && ELF32_R_TYPE (irel->r_info) != (int) R_CRX_SWITCH32) + if ((ELF32_R_TYPE(irel->r_info) != (int)R_CRX_SWITCH8) + && (ELF32_R_TYPE(irel->r_info) != (int)R_CRX_SWITCH16) + && (ELF32_R_TYPE(irel->r_info) != (int)R_CRX_SWITCH32)) continue; - r_symndx = ELF32_R_SYM (irel->r_info); - rsym = (Elf_Internal_Sym *) symtab_hdr->contents + r_symndx; + r_symndx = ELF32_R_SYM(irel->r_info); + rsym = (Elf_Internal_Sym *)symtab_hdr->contents + r_symndx; /* Skip if not the local adjusted symbol. */ if (rsym != isym) @@ -856,41 +855,43 @@ elf32_crx_relocate_section (bfd *output_bfd, struct bfd_link_info *info, sec = NULL; if (r_symndx < symtab_hdr->sh_info) { - sym = local_syms + r_symndx; + sym = (local_syms + r_symndx); if (local_sections != NULL) sec = local_sections[r_symndx]; - relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); + relocation = _bfd_elf_rela_local_sym(output_bfd, sym, &sec, rel); } else { bfd_boolean unresolved_reloc, warned; - RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel, - r_symndx, symtab_hdr, sym_hashes, - h, sec, relocation, - unresolved_reloc, warned); + RELOC_FOR_GLOBAL_SYMBOL(info, input_bfd, input_section, rel, + r_symndx, symtab_hdr, sym_hashes, + h, sec, relocation, + unresolved_reloc, warned); } - r = crx_elf_final_link_relocate (howto, input_bfd, output_bfd, - input_section, - contents, rel->r_offset, - relocation, rel->r_addend, - info, sec, h == NULL); + r = crx_elf_final_link_relocate(howto, input_bfd, output_bfd, + input_section, contents, rel->r_offset, + relocation, rel->r_addend, info, sec, + h == NULL); if (r != bfd_reloc_ok) { const char *name; - const char *msg = (const char *) 0; + const char *msg = (const char *)0; if (h != NULL) name = h->root.root.string; else { - name = (bfd_elf_string_from_elf_section - (input_bfd, symtab_hdr->sh_link, - ((sym != NULL) ? sym->st_name : 0U))); + name = + bfd_elf_string_from_elf_section(input_bfd, + (unsigned int)symtab_hdr->sh_link, + ((sym != NULL) + ? (unsigned int)sym->st_name + : 0U)); if (name == NULL || *name == '\0') - name = bfd_section_name (input_bfd, sec); + name = bfd_section_name(input_bfd, sec); } switch (r) diff --git a/src/bfd/elf32-d10v.c b/src/bfd/elf32-d10v.c index 677253a3d..4d0566eeb 100644 --- a/src/bfd/elf32-d10v.c +++ b/src/bfd/elf32-d10v.c @@ -468,53 +468,55 @@ elf32_d10v_relocate_section (bfd *output_bfd, sec = NULL; if (r_symndx < symtab_hdr->sh_info) { - sym = local_syms + r_symndx; + sym = (local_syms + r_symndx); sec = local_sections[r_symndx]; relocation = (sec->output_section->vma + sec->output_offset + sym->st_value); if ((sec->flags & SEC_MERGE) - && ELF_ST_TYPE (sym->st_info) == STT_SECTION) + && ELF_ST_TYPE(sym->st_info) == STT_SECTION) { asection *msec; bfd_vma addend; - bfd_byte *where = contents + rel->r_offset; + bfd_byte *where = (contents + rel->r_offset); - addend = extract_rel_addend (input_bfd, where, howto); + addend = extract_rel_addend(input_bfd, where, howto); msec = sec; - addend = _bfd_elf_rel_local_sym (output_bfd, sym, &msec, addend); + addend = _bfd_elf_rel_local_sym(output_bfd, sym, &msec, addend); addend -= relocation; - addend += msec->output_section->vma + msec->output_offset; - insert_rel_addend (input_bfd, where, howto, addend); + addend += (msec->output_section->vma + msec->output_offset); + insert_rel_addend(input_bfd, where, howto, addend); } } else { bfd_boolean unresolved_reloc, warned; - RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel, - r_symndx, symtab_hdr, sym_hashes, - h, sec, relocation, - unresolved_reloc, warned); + RELOC_FOR_GLOBAL_SYMBOL(info, input_bfd, input_section, rel, + r_symndx, symtab_hdr, sym_hashes, + h, sec, relocation, + unresolved_reloc, warned); } if (h != NULL) name = h->root.root.string; else { - name = (bfd_elf_string_from_elf_section - (input_bfd, symtab_hdr->sh_link, sym->st_name)); + name = + bfd_elf_string_from_elf_section(input_bfd, + (unsigned int)symtab_hdr->sh_link, + (unsigned int)sym->st_name); if (name == NULL || *name == '\0') - name = bfd_section_name (input_bfd, sec); + name = bfd_section_name(input_bfd, sec); } - r = _bfd_final_link_relocate (howto, input_bfd, input_section, - contents, rel->r_offset, - relocation, (bfd_vma) 0); + r = _bfd_final_link_relocate(howto, input_bfd, input_section, + contents, rel->r_offset, + relocation, (bfd_vma)0UL); if (r != bfd_reloc_ok) { - const char * msg = (const char *) 0; + const char *msg = (const char *)0; switch (r) { diff --git a/src/bfd/elf32-dlx.c b/src/bfd/elf32-dlx.c index 9243bb66e..0c62c2410 100644 --- a/src/bfd/elf32-dlx.c +++ b/src/bfd/elf32-dlx.c @@ -148,10 +148,10 @@ elf32_dlx_relocate16(bfd *abfd, arelent *reloc_entry, asymbol *symbol, allignment) & ~allignment); /* val is the displacement (PC relative to next instruction). */ - val = ((symbol->section->output_offset - + symbol->section->output_section->vma - + symbol->value) - - (int)vallo); + val = (int)((symbol->section->output_offset + + symbol->section->output_section->vma + + symbol->value) + - vallo); if (abs((int)val) > 0x00007FFF) return bfd_reloc_outofrange; @@ -208,9 +208,9 @@ elf32_dlx_relocate26(bfd *abfd, arelent *reloc_entry, asymbol *symbol, allignment) & ~allignment); /* val is the displacement (PC relative to next instruction). */ - val = ((symbol->section->output_offset - + symbol->section->output_section->vma + symbol->value) - - (int)vallo); + val = (int)((symbol->section->output_offset + + symbol->section->output_section->vma + symbol->value) + - vallo); if (abs((int)val) > 0x01FFFFFF) return bfd_reloc_outofrange; diff --git a/src/bfd/elf32-frv.c b/src/bfd/elf32-frv.c index ce93ef73f..a164ee11d 100644 --- a/src/bfd/elf32-frv.c +++ b/src/bfd/elf32-frv.c @@ -1144,10 +1144,10 @@ frvfdpic_relocs_info_hash(const void *entry_) const struct frvfdpic_relocs_info *entry = (const struct frvfdpic_relocs_info *)entry_; - return (((entry->symndx == -1) - ? (long)entry->d.h->root.root.hash - : (entry->symndx + ((long)entry->d.abfd->id * 257L))) - + (hashval_t)entry->addend); + return (hashval_t)(((entry->symndx == -1) + ? (long)entry->d.h->root.root.hash + : (entry->symndx + ((long)entry->d.abfd->id * 257L))) + + entry->addend); } /* Test whether the key fields of two frvfdpic_relocs_info entries are @@ -1340,21 +1340,21 @@ _frvfdpic_add_rofixup(bfd *output_bfd, asection *rofixup, bfd_vma offset, /* Find the segment number in which OSEC, and output section, is located. */ -static unsigned -_frvfdpic_osec_to_segment (bfd *output_bfd, asection *osec) +static unsigned int +_frvfdpic_osec_to_segment(bfd *output_bfd, asection *osec) { struct elf_segment_map *m; Elf_Internal_Phdr *p; /* Find the segment that contains the output_section. */ - for (m = elf_tdata (output_bfd)->segment_map, - p = elf_tdata (output_bfd)->phdr; + for (m = elf_tdata(output_bfd)->segment_map, + p = elf_tdata(output_bfd)->phdr; m != NULL; m = m->next, p++) { int i; - for (i = m->count - 1; i >= 0; i--) + for (i = (m->count - 1); i >= 0; i--) if (m->sections[i] == osec) break; @@ -1362,15 +1362,15 @@ _frvfdpic_osec_to_segment (bfd *output_bfd, asection *osec) break; } - return p - elf_tdata (output_bfd)->phdr; + return (unsigned int)(p - elf_tdata(output_bfd)->phdr); } inline static bfd_boolean -_frvfdpic_osec_readonly_p (bfd *output_bfd, asection *osec) +_frvfdpic_osec_readonly_p(bfd *output_bfd, asection *osec) { - unsigned seg = _frvfdpic_osec_to_segment (output_bfd, osec); + unsigned int seg = _frvfdpic_osec_to_segment(output_bfd, osec); - return ! (elf_tdata (output_bfd)->phdr[seg].p_flags & PF_W); + return !(elf_tdata(output_bfd)->phdr[seg].p_flags & PF_W); } #define FRVFDPIC_TLS_BIAS (2048 - 16) @@ -1392,12 +1392,12 @@ tls_biased_base (struct bfd_link_info *info) code for PLT and lazy PLT entries. */ inline static bfd_boolean -_frvfdpic_emit_got_relocs_plt_entries (struct frvfdpic_relocs_info *entry, - bfd *output_bfd, - struct bfd_link_info *info, - asection *sec, - Elf_Internal_Sym *sym, - bfd_vma addend) +_frvfdpic_emit_got_relocs_plt_entries(struct frvfdpic_relocs_info *entry, + bfd *output_bfd, + struct bfd_link_info *info, + asection *sec, + Elf_Internal_Sym *sym, + bfd_vma addend) { bfd_vma fd_lazy_rel_offset = (bfd_vma)-1; @@ -1413,13 +1413,13 @@ _frvfdpic_emit_got_relocs_plt_entries (struct frvfdpic_relocs_info *entry, /* If the symbol is dynamic, consider it for dynamic relocations, otherwise decay to section + offset. */ if (entry->symndx == -1 && entry->d.h->dynindx != -1) - dynindx = entry->d.h->dynindx; + dynindx = (int)entry->d.h->dynindx; else { if (sec->output_section - && ! bfd_is_abs_section (sec->output_section) - && ! bfd_is_und_section (sec->output_section)) - dynindx = elf_section_data (sec->output_section)->dynindx; + && ! bfd_is_abs_section(sec->output_section) + && ! bfd_is_und_section(sec->output_section)) + dynindx = elf_section_data(sec->output_section)->dynindx; else dynindx = 0; } diff --git a/src/bfd/elf32-h8300.c b/src/bfd/elf32-h8300.c index 47fb91f72..f073fff3d 100644 --- a/src/bfd/elf32-h8300.c +++ b/src/bfd/elf32-h8300.c @@ -609,7 +609,7 @@ static bfd_boolean elf32_h8_object_p(bfd *abfd) { bfd_default_set_arch_mach(abfd, bfd_arch_h8300, - elf32_h8_mach(elf_elfheader(abfd)->e_flags)); + elf32_h8_mach((flagword)elf_elfheader(abfd)->e_flags)); return TRUE; } @@ -1353,14 +1353,14 @@ elf32_h8_symbol_address_p (bfd *abfd, asection *sec, bfd_vma addr) Elf_Internal_Sym *isymend; struct elf_link_hash_entry **sym_hashes; struct elf_link_hash_entry **end_hashes; - unsigned int symcount; + unsigned long symcount; - sec_shndx = _bfd_elf_section_from_bfd_section (abfd, sec); + sec_shndx = _bfd_elf_section_from_bfd_section(abfd, sec); /* Examine all the symbols. */ - symtab_hdr = &elf_tdata (abfd)->symtab_hdr; - isym = (Elf_Internal_Sym *) symtab_hdr->contents; - isymend = isym + symtab_hdr->sh_info; + symtab_hdr = &elf_tdata(abfd)->symtab_hdr; + isym = (Elf_Internal_Sym *)symtab_hdr->contents; + isymend = (isym + symtab_hdr->sh_info); for (; isym < isymend; isym++) { if (isym->st_shndx == sec_shndx @@ -1368,10 +1368,10 @@ elf32_h8_symbol_address_p (bfd *abfd, asection *sec, bfd_vma addr) return TRUE; } - symcount = (symtab_hdr->sh_size / sizeof (Elf32_External_Sym) + symcount = ((symtab_hdr->sh_size / sizeof(Elf32_External_Sym)) - symtab_hdr->sh_info); - sym_hashes = elf_sym_hashes (abfd); - end_hashes = sym_hashes + symcount; + sym_hashes = elf_sym_hashes(abfd); + end_hashes = (sym_hashes + symcount); for (; sym_hashes < end_hashes; sym_hashes++) { struct elf_link_hash_entry *sym_hash = *sym_hashes; diff --git a/src/bfd/elf32-hppa.c b/src/bfd/elf32-hppa.c index 40a87b50f..e8c383e31 100644 --- a/src/bfd/elf32-hppa.c +++ b/src/bfd/elf32-hppa.c @@ -2631,12 +2631,12 @@ get_local_syms(bfd *output_bfd, bfd *input_bfd, struct bfd_link_info *info) { struct elf_link_hash_entry **eh_syms; struct elf_link_hash_entry **eh_symend; - unsigned int symcount; + unsigned long symcount; - symcount = (symtab_hdr->sh_size / sizeof (Elf32_External_Sym) + symcount = ((symtab_hdr->sh_size / sizeof(Elf32_External_Sym)) - symtab_hdr->sh_info); - eh_syms = (struct elf_link_hash_entry **) elf_sym_hashes (input_bfd); - eh_symend = (struct elf_link_hash_entry **) (eh_syms + symcount); + eh_syms = (struct elf_link_hash_entry **)elf_sym_hashes(input_bfd); + eh_symend = (struct elf_link_hash_entry **)(eh_syms + symcount); /* Look through the global syms for functions; We need to build export stubs for all globally visible functions. */ @@ -2644,7 +2644,7 @@ get_local_syms(bfd *output_bfd, bfd *input_bfd, struct bfd_link_info *info) { struct elf32_hppa_link_hash_entry *hh; - hh = hppa_elf_hash_entry (*eh_syms); + hh = hppa_elf_hash_entry(*eh_syms); while (hh->eh.root.type == bfd_link_hash_indirect || hh->eh.root.type == bfd_link_hash_warning) @@ -2815,7 +2815,7 @@ elf32_hppa_size_stubs /* Now examine each relocation. */ irela = internal_relocs; - irelaend = irela + section->reloc_count; + irelaend = (irela + section->reloc_count); for (; irela < irelaend; irela++) { unsigned int r_type, r_indx; @@ -2828,10 +2828,10 @@ elf32_hppa_size_stubs char *stub_name; const asection *id_sec; - r_type = ELF32_R_TYPE (irela->r_info); - r_indx = ELF32_R_SYM (irela->r_info); + r_type = ELF32_R_TYPE(irela->r_info); + r_indx = (unsigned int)ELF32_R_SYM(irela->r_info); - if (r_type >= (unsigned int) R_PARISC_UNIMPLEMENTED) + if (r_type >= (unsigned int)R_PARISC_UNIMPLEMENTED) { bfd_set_error (bfd_error_bad_value); error_ret_free_internal: @@ -2872,8 +2872,8 @@ elf32_hppa_size_stubs /* It's an external symbol. */ int e_indx; - e_indx = r_indx - symtab_hdr->sh_info; - hh = hppa_elf_hash_entry (elf_sym_hashes (input_bfd)[e_indx]); + e_indx = (int)(r_indx - symtab_hdr->sh_info); + hh = hppa_elf_hash_entry(elf_sym_hashes(input_bfd)[e_indx]); while (hh->eh.root.type == bfd_link_hash_indirect || hh->eh.root.type == bfd_link_hash_warning) @@ -3176,7 +3176,7 @@ final_link_relocate (asection *input_section, if (r_type == R_PARISC_NONE) return bfd_reloc_ok; - insn = bfd_get_32 (input_bfd, hit_data); + insn = (int)bfd_get_32(input_bfd, hit_data); /* Find out where we are and where we're going. */ location = (offset + @@ -3397,8 +3397,7 @@ final_link_relocate (asection *input_section, call to the local stub for this function. */ if (value + addend + max_branch_offset >= 2*max_branch_offset) { - hsh = hppa_get_stub_entry (input_section, sym_sec, - hh, rela, htab); + hsh = hppa_get_stub_entry(input_section, sym_sec, hh, rela, htab); if (hsh == NULL) return bfd_reloc_undefined; @@ -3418,20 +3417,18 @@ final_link_relocate (asection *input_section, } /* Make sure we can reach the stub. */ - if (max_branch_offset != 0 - && value + addend + max_branch_offset >= 2*max_branch_offset) + if ((max_branch_offset != 0) + && ((value + addend + max_branch_offset) >= (2 * max_branch_offset))) { (*_bfd_error_handler) (_("%B(%A+0x%lx): cannot reach %s, recompile with -ffunction-sections"), - input_bfd, - input_section, - offset, + input_bfd, input_section, offset, ((hsh != NULL) ? hsh->bh_root.string : "hsh->bh_root.string")); - bfd_set_error (bfd_error_bad_value); + bfd_set_error(bfd_error_bad_value); return bfd_reloc_notsupported; } - val = hppa_field_adjust (value, addend, r_field); + val = (int)hppa_field_adjust(value, addend, r_field); switch (r_type) { @@ -3463,14 +3460,11 @@ final_link_relocate (asection *input_section, /* Relocate an HPPA ELF section. */ static bfd_boolean -elf32_hppa_relocate_section (bfd *output_bfd, - struct bfd_link_info *info, - bfd *input_bfd, - asection *input_section, - bfd_byte *contents, - Elf_Internal_Rela *relocs, - Elf_Internal_Sym *local_syms, - asection **local_sections) +elf32_hppa_relocate_section(bfd *output_bfd, struct bfd_link_info *info, + bfd *input_bfd, asection *input_section, + bfd_byte *contents, Elf_Internal_Rela *relocs, + Elf_Internal_Sym *local_syms, + asection **local_sections) { bfd_vma *local_got_offsets; struct elf32_hppa_link_hash_table *htab; @@ -3481,13 +3475,13 @@ elf32_hppa_relocate_section (bfd *output_bfd, if (info->relocatable) return TRUE; - symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; + symtab_hdr = &elf_tdata(input_bfd)->symtab_hdr; - htab = hppa_link_hash_table (info); - local_got_offsets = elf_local_got_offsets (input_bfd); + htab = hppa_link_hash_table(info); + local_got_offsets = elf_local_got_offsets(input_bfd); rela = relocs; - relend = relocs + input_section->reloc_count; + relend = (relocs + input_section->reloc_count); for (; rela < relend; rela++) { unsigned int r_type; @@ -3502,18 +3496,18 @@ elf32_hppa_relocate_section (bfd *output_bfd, bfd_boolean plabel; bfd_boolean warned_undef; - r_type = ELF32_R_TYPE (rela->r_info); - if (r_type >= (unsigned int) R_PARISC_UNIMPLEMENTED) + r_type = ELF32_R_TYPE(rela->r_info); + if (r_type >= (unsigned int)R_PARISC_UNIMPLEMENTED) { - bfd_set_error (bfd_error_bad_value); + bfd_set_error(bfd_error_bad_value); return FALSE; } - if (r_type == (unsigned int) R_PARISC_GNU_VTENTRY - || r_type == (unsigned int) R_PARISC_GNU_VTINHERIT) + if (r_type == (unsigned int)R_PARISC_GNU_VTENTRY + || r_type == (unsigned int)R_PARISC_GNU_VTINHERIT) continue; /* This is a final link. */ - r_symndx = ELF32_R_SYM (rela->r_info); + r_symndx = (unsigned int)ELF32_R_SYM(rela->r_info); hh = NULL; sym = NULL; sym_sec = NULL; @@ -3521,20 +3515,20 @@ elf32_hppa_relocate_section (bfd *output_bfd, if (r_symndx < symtab_hdr->sh_info) { /* This is a local symbol, h defaults to NULL. */ - sym = local_syms + r_symndx; + sym = (local_syms + r_symndx); sym_sec = local_sections[r_symndx]; - relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sym_sec, rela); + relocation = _bfd_elf_rela_local_sym(output_bfd, sym, &sym_sec, rela); } else { struct elf_link_hash_entry *eh; bfd_boolean unresolved_reloc; - struct elf_link_hash_entry **sym_hashes = elf_sym_hashes (input_bfd); + struct elf_link_hash_entry **sym_hashes = elf_sym_hashes(input_bfd); - RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rela, - r_symndx, symtab_hdr, sym_hashes, - eh, sym_sec, relocation, - unresolved_reloc, warned_undef); + RELOC_FOR_GLOBAL_SYMBOL(info, input_bfd, input_section, rela, + r_symndx, symtab_hdr, sym_hashes, + eh, sym_sec, relocation, + unresolved_reloc, warned_undef); if (relocation == 0 && eh->root.type != bfd_link_hash_defined @@ -3821,17 +3815,17 @@ elf32_hppa_relocate_section (bfd *output_bfd, if (skip) { - memset (&outrel, 0, sizeof (outrel)); + memset(&outrel, 0, sizeof(outrel)); } - else if (hh != NULL - && hh->eh.dynindx != -1 + else if ((hh != NULL) + && (hh->eh.dynindx != -1) && (plabel - || !IS_ABSOLUTE_RELOC (r_type) + || !IS_ABSOLUTE_RELOC(r_type) || !info->shared || !info->symbolic || !hh->eh.def_regular)) { - outrel.r_info = ELF32_R_INFO (hh->eh.dynindx, r_type); + outrel.r_info = ELF32_R_INFO(hh->eh.dynindx, r_type); } else /* It's a local symbol, or one marked to become local. */ { @@ -3847,16 +3841,16 @@ elf32_hppa_relocate_section (bfd *output_bfd, providing the function symbol for a global plabel reloc, and no symbol for local plabels. */ if (! plabel - && sym_sec != NULL - && sym_sec->output_section != NULL - && ! bfd_is_abs_section (sym_sec)) + && (sym_sec != NULL) + && (sym_sec->output_section != NULL) + && !bfd_is_abs_section(sym_sec)) { /* Skip this relocation if the output section has been discarded. */ - if (bfd_is_abs_section (sym_sec->output_section)) + if (bfd_is_abs_section(sym_sec->output_section)) break; - indx = elf_section_data (sym_sec->output_section)->dynindx; + indx = elf_section_data(sym_sec->output_section)->dynindx; /* We are turning this relocation into one against a section symbol, so subtract out the output section's address but not the offset @@ -3864,15 +3858,15 @@ elf32_hppa_relocate_section (bfd *output_bfd, outrel.r_addend -= sym_sec->output_section->vma; } - outrel.r_info = ELF32_R_INFO (indx, r_type); + outrel.r_info = ELF32_R_INFO(indx, r_type); } - sreloc = elf_section_data (input_section)->sreloc; + sreloc = elf_section_data(input_section)->sreloc; if (sreloc == NULL) - abort (); + abort(); loc = sreloc->contents; - loc += sreloc->reloc_count++ * sizeof (Elf32_External_Rela); - bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc); + loc += (sreloc->reloc_count++ * sizeof(Elf32_External_Rela)); + bfd_elf32_swap_reloca_out(output_bfd, &outrel, loc); } break; @@ -3880,8 +3874,8 @@ elf32_hppa_relocate_section (bfd *output_bfd, break; } - rstatus = final_link_relocate (input_section, contents, rela, relocation, - htab, sym_sec, hh, info); + rstatus = final_link_relocate(input_section, contents, rela, relocation, + htab, sym_sec, hh, info); if (rstatus == bfd_reloc_ok) continue; @@ -3890,16 +3884,16 @@ elf32_hppa_relocate_section (bfd *output_bfd, sym_name = hh->eh.root.root.string; else { - sym_name = bfd_elf_string_from_elf_section (input_bfd, - symtab_hdr->sh_link, - sym->st_name); + sym_name = bfd_elf_string_from_elf_section(input_bfd, + (unsigned int)symtab_hdr->sh_link, + (unsigned int)sym->st_name); if (sym_name == NULL) return FALSE; if (*sym_name == '\0') - sym_name = bfd_section_name (input_bfd, sym_sec); + sym_name = bfd_section_name(input_bfd, sym_sec); } - howto = elf_hppa_howto_table + r_type; + howto = (elf_hppa_howto_table + r_type); if (rstatus == bfd_reloc_undefined || rstatus == bfd_reloc_notsupported) { @@ -3907,12 +3901,9 @@ elf32_hppa_relocate_section (bfd *output_bfd, { (*_bfd_error_handler) (_("%B(%A+0x%lx): cannot handle %s for %s"), - input_bfd, - input_section, - (long) rela->r_offset, - howto->name, + input_bfd, input_section, (long)rela->r_offset, howto->name, sym_name); - bfd_set_error (bfd_error_bad_value); + bfd_set_error(bfd_error_bad_value); return FALSE; } } diff --git a/src/bfd/elf32-i386.c b/src/bfd/elf32-i386.c index c89c26040..e3d1c231e 100644 --- a/src/bfd/elf32-i386.c +++ b/src/bfd/elf32-i386.c @@ -3466,27 +3466,27 @@ elf_i386_finish_dynamic_sections (bfd *output_bfd, /* Correct the .rel.plt.unloaded relocations. */ if (htab->is_vxworks && !info->shared) { - int num_plts = (htab->splt->size / PLT_ENTRY_SIZE) - 1; + int num_plts = (int)((htab->splt->size / PLT_ENTRY_SIZE) - 1); unsigned char *p; p = htab->srelplt2->contents; if (info->shared) - p += PLTRESOLVE_RELOCS_SHLIB * sizeof (Elf32_External_Rel); + p += (PLTRESOLVE_RELOCS_SHLIB * sizeof(Elf32_External_Rel)); else - p += PLTRESOLVE_RELOCS * sizeof (Elf32_External_Rel); + p += (PLTRESOLVE_RELOCS * sizeof(Elf32_External_Rel)); for (; num_plts; num_plts--) { Elf_Internal_Rela rel; - bfd_elf32_swap_reloc_in (output_bfd, p, &rel); - rel.r_info = ELF32_R_INFO (htab->hgot->indx, R_386_32); - bfd_elf32_swap_reloc_out (output_bfd, &rel, p); - p += sizeof (Elf32_External_Rel); - - bfd_elf32_swap_reloc_in (output_bfd, p, &rel); - rel.r_info = ELF32_R_INFO (htab->hplt->indx, R_386_32); - bfd_elf32_swap_reloc_out (output_bfd, &rel, p); - p += sizeof (Elf32_External_Rel); + bfd_elf32_swap_reloc_in(output_bfd, p, &rel); + rel.r_info = ELF32_R_INFO(htab->hgot->indx, R_386_32); + bfd_elf32_swap_reloc_out(output_bfd, &rel, p); + p += sizeof(Elf32_External_Rel); + + bfd_elf32_swap_reloc_in(output_bfd, p, &rel); + rel.r_info = ELF32_R_INFO(htab->hplt->indx, R_386_32); + bfd_elf32_swap_reloc_out(output_bfd, &rel, p); + p += sizeof(Elf32_External_Rel); } } } diff --git a/src/bfd/po/bfd.pot b/src/bfd/po/bfd.pot index b403267b6..6c65ba2c6 100644 --- a/src/bfd/po/bfd.pot +++ b/src/bfd/po/bfd.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-01-07 21:12-0500\n" +"POT-Creation-Date: 2024-01-07 22:32-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n"