Re: [RFC v4 02/18] objtool: orc: Refactor ORC API for other architectures to implement.

From: Josh Poimboeuf
Date: Thu Aug 22 2019 - 15:59:23 EST


On Fri, Aug 16, 2019 at 01:23:47PM +0100, Raphael Gault wrote:
> The ORC unwinder is only supported on x86 at the moment and should thus be
> in the x86 architecture code. In order not to break the whole structure in
> case another architecture decides to support the ORC unwinder via objtool

> we choose to let the implementation be done in the architecture dependent
> code.

A general comment for all the patch descriptions: they should use
imperative language, like:

"move the implementation to the architecture-specific code."

Also the subjects shouldn't have periods.

It would be a good idea to review
Documentation/process/submitting-patches.rst.

> --- a/tools/objtool/orc_gen.c
> +++ b/tools/objtool/arch/x86/orc_gen.c
> @@ -6,11 +6,11 @@
> #include <stdlib.h>
> #include <string.h>
>
> -#include "orc.h"
> -#include "check.h"
> -#include "warn.h"
> +#include "../../orc.h"
> +#include "../../check.h"
> +#include "../../warn.h"
>
> -int create_orc(struct objtool_file *file)
> +int arch_create_orc(struct objtool_file *file)
> {
> struct instruction *insn;
>
> @@ -116,7 +116,7 @@ static int create_orc_entry(struct section *u_sec, struct section *ip_relasec,
> return 0;
> }
>
> -int create_orc_sections(struct objtool_file *file)
> +int arch_create_orc_sections(struct objtool_file *file)
> {
> struct instruction *insn, *prev_insn;
> struct section *sec, *u_sec, *ip_relasec;
> @@ -209,3 +209,97 @@ int create_orc_sections(struct objtool_file *file)
>
> return 0;
> }
> +
> +int arch_orc_read_unwind_hints(struct objtool_file *file)
> +{

For naming consistency, please give them all an arch_orc prefix. Also I
think arch_create_orc() should have a more specific name anyway, maybe
arch_orc_init(). So:

arch_orc_init()
arch_orc_create_sections()
arch_orc_read_unwind_hints()

--
Josh