arch/mips/boot/tools/relocs_main.c

Source file repositories/reference/linux-study-clean/arch/mips/boot/tools/relocs_main.c

File Facts

System
Linux kernel
Corpus path
arch/mips/boot/tools/relocs_main.c
Extension
.c
Size
1553 bytes
Lines
86
Domain
Architecture Layer
Bucket
arch/mips
Inferred role
Architecture Layer: implementation source
Status
source implementation candidate

Why This File Exists

CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.

Dependency Surface

Detected Declarations

Annotated Snippet

if (*arg == '-') {
			if (strcmp(arg, "--reloc-info") == 0) {
				show_reloc_info = 1;
				continue;
			}
			if (strcmp(arg, "--text") == 0) {
				as_text = 1;
				continue;
			}
			if (strcmp(arg, "--bin") == 0) {
				as_bin = 1;
				continue;
			}
			if (strcmp(arg, "--keep") == 0) {
				keep_relocs = 1;
				continue;
			}
		} else if (!fname) {
			fname = arg;
			continue;
		}
		usage();
	}
	if (!fname)
		usage();

	fp = fopen(fname, "r+");
	if (!fp)
		die("Cannot open %s: %s\n", fname, strerror(errno));

	if (fread(&e_ident, 1, EI_NIDENT, fp) != EI_NIDENT)
		die("Cannot read %s: %s", fname, strerror(errno));

	rewind(fp);
	if (e_ident[EI_CLASS] == ELFCLASS64)
		process_64(fp, as_text,  as_bin, show_reloc_info, keep_relocs);
	else
		process_32(fp, as_text, as_bin, show_reloc_info, keep_relocs);
	fclose(fp);
	return 0;
}

Annotation

Implementation Notes