kern/CTF: link_elf_ctf_get() on big endian platforms

Check the CTF magic number in big endian platforms.  This lets DTrace FBT
handle types correctly on these platforms.

Submitted by:	Brandon Bergren
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D20413
This commit is contained in:
Justin Hibbits 2019-05-27 04:20:31 +00:00
parent b2aea1ad8f
commit a5868885fa
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=348299

View File

@ -193,8 +193,12 @@ link_elf_ctf_get(linker_file_t lf, linker_ctf_t *lc)
NOCRED, NULL, td)) != 0)
goto out;
/* Check the CTF magic number. (XXX check for big endian!) */
/* Check the CTF magic number. */
#ifdef __LITTLE_ENDIAN__
if (ctf_hdr[0] != 0xf1 || ctf_hdr[1] != 0xcf) {
#else
if (ctf_hdr[0] != 0xcf || ctf_hdr[1] != 0xf1) {
#endif
printf("%s(%d): module %s has invalid format\n",
__func__, __LINE__, lf->pathname);
error = EFTYPE;