#include <objtool/builtin.h>
#include <objtool/cfi.h>
#include <objtool/arch.h>
+#include <objtool/disas.h>
#include <objtool/check.h>
#include <objtool/special.h>
#include <objtool/warn.h>
int check(struct objtool_file *file)
{
+ struct disas_context *disas_ctx;
int ret = 0, warnings = 0;
arch_initial_func_cfi_state(&initial_func_cfi);
if (opts.verbose) {
if (opts.werror && warnings)
WARN("%d warning(s) upgraded to errors", warnings);
- disas_warned_funcs(file);
+ disas_ctx = disas_context_create(file);
+ disas_warned_funcs(disas_ctx);
+ disas_context_destroy(disas_ctx);
}
if (opts.backup && make_backup())
*/
#include <objtool/arch.h>
+#include <objtool/disas.h>
#include <objtool/warn.h>
#include <linux/string.h>
+struct disas_context {
+ struct objtool_file *file;
+};
+
+struct disas_context *disas_context_create(struct objtool_file *file)
+{
+ struct disas_context *dctx;
+
+ dctx = malloc(sizeof(*dctx));
+ if (!dctx) {
+ WARN("failed to allocate disassembly context");
+ return NULL;
+ }
+
+ dctx->file = file;
+
+ return dctx;
+}
+
+void disas_context_destroy(struct disas_context *dctx)
+{
+ free(dctx);
+}
+
/* 'funcs' is a space-separated list of function names */
static void disas_funcs(const char *funcs)
{
}
}
-void disas_warned_funcs(struct objtool_file *file)
+void disas_warned_funcs(struct disas_context *dctx)
{
struct symbol *sym;
char *funcs = NULL, *tmp;
- for_each_sym(file->elf, sym) {
+ if (!dctx)
+ return;
+
+ for_each_sym(dctx->file->elf, sym) {
if (sym->warned) {
if (!funcs) {
funcs = malloc(strlen(sym->name) + 1);
--- /dev/null
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ * Copyright (c) 2025, Oracle and/or its affiliates.
+ */
+
+#ifndef _DISAS_H
+#define _DISAS_H
+
+struct disas_context;
+struct disas_context *disas_context_create(struct objtool_file *file);
+void disas_context_destroy(struct disas_context *dctx);
+void disas_warned_funcs(struct disas_context *dctx);
+
+#endif /* _DISAS_H */
int orc_dump(const char *objname);
int orc_create(struct objtool_file *file);
-void disas_warned_funcs(struct objtool_file *file);
-
#endif /* _OBJTOOL_H */