elf2flt: Add patch for binutils 2.40

Add a patch to deal with the removal of BFD_VMA_FMT from bfd.h in
binutils-2.40.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
This commit is contained in:
Chris Packham 2023-02-27 21:57:26 +13:00
parent 7fcf499b03
commit 1d298004c1

View File

@ -0,0 +1,142 @@
From 50c80021f3351596f75f8dfc06ec45f8a598eb7e Mon Sep 17 00:00:00 2001
From: Chris Packham <judge.packham@gmail.com>
Date: Mon, 27 Feb 2023 20:47:04 +1300
Subject: [PATCH] elf2flt: Use PRIx64 instead of BFD_VMA_FMT"x
As of binutils 2.40 bfd.h no longer defines BFD_VMA_FMT. Use PRIx64
instead.
Signed-off-by: Chris Packham <judge.packham@gmail.com>
---
elf2flt.c | 36 ++++++++++++++++++------------------
1 file changed, 18 insertions(+), 18 deletions(-)
diff --git a/elf2flt.c b/elf2flt.c
index 8dbd9b2..4ec4103 100644
--- a/elf2flt.c
+++ b/elf2flt.c
@@ -216,7 +216,7 @@ dump_symbols(asymbol **symbol_table, long number_of_symbols)
long i;
printf("SYMBOL TABLE:\n");
for (i=0; i<number_of_symbols; i++) {
- printf(" NAME=%s VALUE=0x%"BFD_VMA_FMT"x\n",
+ printf(" NAME=%s VALUE=0x%"PRIx64"\n",
symbol_table[i]->name, symbol_table[i]->value);
}
printf("\n");
@@ -452,7 +452,7 @@ output_relocs (
if (r == NULL)
continue;
if (verbose)
- printf(" RELOCS: %s [%p]: flags=0x%x vma=0x%"BFD_VMA_FMT"x\n",
+ printf(" RELOCS: %s [%p]: flags=0x%x vma=0x%"PRIx64"\n",
r->name, r, r->flags, elf2flt_bfd_section_vma(abs_bfd, r));
if ((r->flags & SEC_RELOC) == 0)
continue;
@@ -879,8 +879,8 @@ output_relocs (
if (verbose)
fprintf(stderr,
"%s vma=0x%x, "
- "value=0x%"BFD_VMA_FMT"x, "
- "address=0x%"BFD_VMA_FMT"x "
+ "value=0x%"PRIx64", "
+ "address=0x%"PRIx64" "
"sym_addr=0x%x rs=0x%x, opcode=0x%x\n",
"ABS32",
sym_vma, (*(q->sym_ptr_ptr))->value,
@@ -898,8 +898,8 @@ output_relocs (
if (verbose)
fprintf(stderr,
"%s vma=0x%x, "
- "value=0x%"BFD_VMA_FMT"x, "
- "address=0x%"BFD_VMA_FMT"x "
+ "value=0x%"PRIx64", "
+ "address=0x%"PRIx64" "
"sym_addr=0x%x rs=0x%x, opcode=0x%x\n",
"PLT32",
sym_vma, (*(q->sym_ptr_ptr))->value,
@@ -921,7 +921,7 @@ output_relocs (
case R_V850_ZDA_16_16_OFFSET:
case R_V850_ZDA_16_16_SPLIT_OFFSET:
/* Can't support zero-relocations. */
- printf ("ERROR: %s+0x%"BFD_VMA_FMT"x: zero relocations not supported\n",
+ printf ("ERROR: %s+0x%"PRIx64": zero relocations not supported\n",
sym_name, q->addend);
continue;
#endif /* TARGET_v850 */
@@ -1014,15 +1014,15 @@ output_relocs (
sprintf(&addstr[0], "+0x%ld", sym_addr - (*(q->sym_ptr_ptr))->value -
elf2flt_bfd_section_vma(abs_bfd, sym_section));
if (verbose)
- printf(" RELOC[%d]: offset=0x%"BFD_VMA_FMT"x symbol=%s%s "
+ printf(" RELOC[%d]: offset=0x%"PRIx64" symbol=%s%s "
"section=%s size=%d "
- "fixup=0x%x (reloc=0x%"BFD_VMA_FMT"x)\n",
+ "fixup=0x%x (reloc=0x%"PRIx64")\n",
flat_reloc_count,
q->address, sym_name, addstr,
section_name, sym_reloc_size,
sym_addr, section_vma + q->address);
if (verbose)
- printf("reloc[%d] = 0x%"BFD_VMA_FMT"x\n",
+ printf("reloc[%d] = 0x%"PRIx64"\n",
flat_reloc_count, section_vma + q->address);
continue;
@@ -1139,9 +1139,9 @@ output_relocs (
temp |= (exist_val & 0x3f);
*(unsigned long *)r_mem = htoniosl(temp);
if (verbose)
- printf("omit: offset=0x%"BFD_VMA_FMT"x symbol=%s%s "
+ printf("omit: offset=0x%"PRIx64" symbol=%s%s "
"section=%s size=%d "
- "fixup=0x%x (reloc=0x%"BFD_VMA_FMT"x) GPREL\n",
+ "fixup=0x%x (reloc=0x%"PRIx64") GPREL\n",
q->address, sym_name, addstr,
section_name, sym_reloc_size,
sym_addr, section_vma + q->address);
@@ -1159,9 +1159,9 @@ output_relocs (
exist_val |= ((sym_addr & 0xFFFF) << 6);
*(unsigned long *)r_mem = htoniosl(exist_val);
if (verbose)
- printf("omit: offset=0x%"BFD_VMA_FMT"x symbol=%s%s "
+ printf("omit: offset=0x%"PRIx64" symbol=%s%s "
"section=%s size=%d "
- "fixup=0x%x (reloc=0x%"BFD_VMA_FMT"x) PCREL\n",
+ "fixup=0x%x (reloc=0x%"PRIx64") PCREL\n",
q->address, sym_name, addstr,
section_name, sym_reloc_size,
sym_addr, section_vma + q->address);
@@ -1176,7 +1176,7 @@ output_relocs (
&& (p[-1]->sym_ptr_ptr == p[0]->sym_ptr_ptr)
&& (p[-1]->addend == p[0]->addend)) {
if (verbose)
- printf("omit: offset=0x%"BFD_VMA_FMT"x symbol=%s%s "
+ printf("omit: offset=0x%"PRIx64" symbol=%s%s "
"section=%s size=%d LO16\n",
q->address, sym_name, addstr,
section_name, sym_reloc_size);
@@ -1586,9 +1586,9 @@ DIS29_RELOCATION:
}
if (verbose)
- printf(" RELOC[%d]: offset=0x%"BFD_VMA_FMT"x symbol=%s%s "
+ printf(" RELOC[%d]: offset=0x%"PRIx64" symbol=%s%s "
"section=%s size=%d "
- "fixup=0x%x (reloc=0x%"BFD_VMA_FMT"x)\n",
+ "fixup=0x%x (reloc=0x%"PRIx64")\n",
flat_reloc_count,
q->address, sym_name, addstr,
section_name, sym_reloc_size,
@@ -1606,7 +1606,7 @@ DIS29_RELOCATION:
(section_vma + q->address);
if (verbose)
- printf("reloc[%d] = 0x%"BFD_VMA_FMT"x\n",
+ printf("reloc[%d] = 0x%"PRIx64"\n",
flat_reloc_count, section_vma + q->address);
#else
switch ((*p)->howto->type) {
--
2.39.1