aboutsummaryrefslogtreecommitdiff
path: root/libctf/ctf-open.c
diff options
context:
space:
mode:
authorNick Alcock <nick.alcock@oracle.com>2024-07-05 15:53:14 +0100
committerNick Alcock <nick.alcock@oracle.com>2024-07-31 21:02:04 +0100
commit95861bb39663bd69e8dd9cbf0fe82b03b8634d94 (patch)
tree88ba6d21940fca81ac8e7fdec060f4cf6fdcecc4 /libctf/ctf-open.c
parentc60b22e8edaeb7beffcf00c5616f4d4f12aae1be (diff)
downloadbinutils-95861bb39663bd69e8dd9cbf0fe82b03b8634d94.zip
binutils-95861bb39663bd69e8dd9cbf0fe82b03b8634d94.tar.gz
binutils-95861bb39663bd69e8dd9cbf0fe82b03b8634d94.tar.bz2
libctf: we do in fact support foreign-endian old versions
The worry that caused this to not be supported was because we don't bother endian-flipping version-related fields before checking them. But they're all unsigned chars anyway, and don't need any flipping at all. This should be supported and should already work. Enable it. libctf/ * ctf-open.c (ctf_bufopen): Don't prohibit foreign-endian upgrades.
Diffstat (limited to 'libctf/ctf-open.c')
-rw-r--r--libctf/ctf-open.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/libctf/ctf-open.c b/libctf/ctf-open.c
index 2ae0a69..fd6d36e 100644
--- a/libctf/ctf-open.c
+++ b/libctf/ctf-open.c
@@ -1474,18 +1474,12 @@ ctf_bufopen (const ctf_sect_t *ctfsect, const ctf_sect_t *symsect,
First, we validate the preamble (common to all versions). At that point,
we know the endianness and specific header version, and can validate the
- version-specific parts including section offsets and alignments.
-
- We specifically do not support foreign-endian old versions. */
+ version-specific parts including section offsets and alignments. */
if (_libctf_unlikely_ (pp->ctp_magic != CTF_MAGIC))
{
if (pp->ctp_magic == bswap_16 (CTF_MAGIC))
- {
- if (pp->ctp_version != CTF_VERSION_3)
- return (ctf_set_open_errno (errp, ECTF_CTFVERS));
- foreign_endian = 1;
- }
+ foreign_endian = 1;
else
return (ctf_set_open_errno (errp, ECTF_NOCTFBUF));
}