aboutsummaryrefslogtreecommitdiff
path: root/sys/i386
diff options
context:
space:
mode:
authorMitchell Horne <mhorne@FreeBSD.org>2020-10-07 18:48:10 +0000
committerMitchell Horne <mhorne@FreeBSD.org>2020-10-07 18:48:10 +0000
commit8481aab1ac34ef07fcf747efbcf4fdbb0435b2f0 (patch)
tree785ea3ad4528b61ff876ce3b2106c7f323102d0d /sys/i386
parent194ddc011ad10900a405fb81cf48a022badf77b8 (diff)
downloadsrc-8481aab1ac34ef07fcf747efbcf4fdbb0435b2f0.tar.gz
src-8481aab1ac34ef07fcf747efbcf4fdbb0435b2f0.zip
Print symbol index for unsupported relocation types
It is unlikely, but possible, that an unrecognized or unsupported relocation type is encountered while trying to load a kernel module. If this occurs we should offer the symbol index as a hint to the user. While here, fix some small style issues. Reviewed by: markj, kib (amd64 part, in D26701) Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc.
Notes
Notes: svn path=/head/; revision=366519
Diffstat (limited to 'sys/i386')
-rw-r--r--sys/i386/i386/elf_machdep.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/sys/i386/i386/elf_machdep.c b/sys/i386/i386/elf_machdep.c
index 82fe3358ef35..230c78869625 100644
--- a/sys/i386/i386/elf_machdep.c
+++ b/sys/i386/i386/elf_machdep.c
@@ -213,7 +213,7 @@ elf_reloc_internal(linker_file_t lf, Elf_Addr relocbase, const void *data,
case R_386_32: /* S + A */
error = lookup(lf, symidx, 1, &addr);
if (error != 0)
- return -1;
+ return (-1);
addr += addend;
if (*where != addr)
*where = addr;
@@ -222,7 +222,7 @@ elf_reloc_internal(linker_file_t lf, Elf_Addr relocbase, const void *data,
case R_386_PC32: /* S + A - P */
error = lookup(lf, symidx, 1, &addr);
if (error != 0)
- return -1;
+ return (-1);
addr += addend - (Elf_Addr)where;
if (*where != addr)
*where = addr;
@@ -233,14 +233,15 @@ elf_reloc_internal(linker_file_t lf, Elf_Addr relocbase, const void *data,
* There shouldn't be copy relocations in kernel
* objects.
*/
- printf("kldload: unexpected R_COPY relocation\n");
- return -1;
+ printf("kldload: unexpected R_COPY relocation, "
+ "symbol index %d\n", symidx);
+ return (-1);
break;
case R_386_GLOB_DAT: /* S */
error = lookup(lf, symidx, 1, &addr);
if (error != 0)
- return -1;
+ return (-1);
if (*where != addr)
*where = addr;
break;
@@ -255,9 +256,9 @@ elf_reloc_internal(linker_file_t lf, Elf_Addr relocbase, const void *data,
*where = addr;
break;
default:
- printf("kldload: unexpected relocation type %d\n",
- rtype);
- return -1;
+ printf("kldload: unexpected relocation type %d, "
+ "symbol index %d\n", rtype, symidx);
+ return (-1);
}
return(0);
}