For relocatable links the output .sframe section size may be wrong.
This can be observed when dumping the SFrame information from the x86-64
sframe-reloc-1 test:
Name Address Off Size
.sframe 0000000000000000 000110 00007f
Offset Type Symbol's Value Symbol's Name + Addend
000000000000001c R_X86_64_PC32 0000000000000000 .text + 1c
0000000000000030 R_X86_64_PC32 0000000000000000 .text + 65
0x00000000 e2de0201 0300f800 02000000 08000000 ................
0x00000010 1e000000 00000000 28000000 00000000 ........(.......
0x00000020 35000000 00000000 04000000 00000000 5...............
0x00000030 00000000 25000000 0f000000 04000000 ....%...........
offset 1st FRE---^^^^^^^^ ^^^^^^^^---number of FREs
0x00000040 00000000 00030801 0510f004 0410f034 ...............4
FDE info---^^ | begin of FDEs
0x00000050 0508f000 03080105 10f00404 10f02405 ..............$.
11111112222222223333333334444---FRE 1, 2, 3, 4
0x00000060 08f00000 00000000 00000000 00000000 ................
4444^^^^...
0x00000070 00000000 00000000 00000000 000000 ...............
...^^^^^^---excessive section
When running the x86-64 test cross build on a big-endian system, such
as s390x, objdump and readelf fail to dump the SFrame information with
the following error message:
Error: SFrame decode failure: Buffer does not contain SFrame data.
This is because the following check in flip_sframe() fails, which gets
only invoked if the endianness of the SFrame data is different from the
host system one:
/* All FDEs and FREs must have been endian flipped by now. */
if ((j != ihp->sfh_num_fres) || (bytes_flipped != (buf_size - hdrsz)))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
With:
j=8, ihp->sfh_num_fres=8, bytes_flipped=70, buf_size=127, hdrsz=28
While at it, remove the incorrect code comment. There is no
relationship between "do not update size" and the fact that the
"contents have not been relocated".
bfd/
* elf-sframe.c (_bfd_elf_write_section_sframe): Update section
size also for relocatable links.
Signed-off-by: Jens Remus <jremus@linux.ibm.com>
---
[Changes in V4]
- Adjust commit log to indicate that the comment being removed was
bogus to begin with.
[End of changes in V4]
[No changes in V3]
[No changes in V2]
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
BFD is an object file library. It permits applications to use the
same routines to process object files regardless of their format.
BFD is used by the GNU debugger, assembler, linker, and the binary
utilities.
The documentation on using BFD is scanty and may be occasionally
incorrect. Pointers to documentation problems, or an entirely
rewritten manual, would be appreciated.
There is some BFD internals documentation in doc/bfdint.texi which may
help programmers who want to modify BFD.
BFD is normally built as part of another package. See the build
instructions for that package, probably in a README file in the
appropriate directory.
BFD supports the following configure options:
--target=TARGET
The default target for which to build the library. TARGET is
a configuration target triplet, such as sparc-sun-solaris.
--enable-targets=TARGET,TARGET,TARGET...
Additional targets the library should support. To include
support for all known targets, use --enable-targets=all.
--enable-64-bit-bfd
Include support for 64 bit targets. This is automatically
turned on if you explicitly request a 64 bit target, but not
for --enable-targets=all. This requires a compiler with a 64
bit integer type, such as gcc.
--enable-shared
Build BFD as a shared library.
--with-mmap
Use mmap when accessing files. This is faster on some hosts,
but slower on others. It may not work on all hosts.
Report bugs in BFD to https://sourceware.org/bugzilla/
Patches are encouraged. When sending patches, always send the output
of diff -u or diff -c from the original file to the new file. Do not
send default diff output. Do not make the diff from the new file to
the original file. Remember that any patch must not break other
systems. Remember that BFD must support cross compilation from any
host to any target, so patches which use ``#ifdef HOST'' are not
acceptable. Please also read the ``Reporting Bugs'' section of the
gcc manual.
Bug reports without patches will be remembered, but they may never get
fixed until somebody volunteers to fix them.
Copyright (C) 2012-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved.