linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matt Helsley <mhelsley@vmware.com>
To: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: <linux-kernel@vger.kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	Julien Thierry <jthierry@redhat.com>
Subject: Re: [PATCH 1/2] objtool: Rename rela to reloc
Date: Fri, 29 May 2020 17:52:44 -0700	[thread overview]
Message-ID: <20200530005244.GZ9040@rlwimi.vmware.com> (raw)
In-Reply-To: <20200529232200.xhjaemclbg2uqrih@treble>

On Fri, May 29, 2020 at 06:22:00PM -0500, Josh Poimboeuf wrote:
> On Fri, May 29, 2020 at 02:01:13PM -0700, Matt Helsley wrote:
> > Before supporting additional relocation types rename the relevant
> > types and functions from "rela" to "reloc". This work be done with
> > the following regex:
> > 
> > 	sed -i -e 's/struct rela/struct reloc/g' \
> > 		-e 's/\([_\*]\)rela\(s\{0,1\}\)/\1reloc\2/g' \
> > 		-e 's/tmprela\(s\{0,1\}\)/tmpreloc\1/g' \
> > 		-e 's/relasec/relocsec/g' \
> > 		-e 's/rela_list/reloc_list/g' \
> > 		-e 's/rela_hash/reloc_hash/g' \
> > 		-e 's/add_rela/add_reloc/g' \
> > 		-e 's/rela->/reloc->/g' \
> > 		-e '/rela[,\.]/{ s/\([^\.>]\)rela\([\.,]\)/\1reloc\2/g ; }' \
> > 		-e 's/rela =/reloc =/g' \
> > 		-e 's/relas =/relocs =/g' \
> > 		-e 's/relas\[/relocs[/g' \
> > 		-e 's/relaname =/relocname =/g' \
> > 		-e 's/= rela\;/= reloc\;/g' \
> > 		-e 's/= relas\;/= relocs\;/g' \
> > 		-e 's/= relaname\;/= relocname\;/g' \
> > 		-e 's/, rela)/, reloc)/g' \
> > 		-e 's/, relaname/, relocname/g' \
> > 		-e 's/sec->rela/sec->reloc/g' \
> > 		-e 's/(\(!\{0,1\}\)rela/(\1reloc/g' \
> > 		arch.h \
> > 		arch/x86/decode.c  \
> > 		check.c \
> > 		check.h \
> > 		elf.c \
> > 		elf.h \
> > 		orc_gen.c \
> > 		special.c \
> 
> Holy regex!  Thanks for doing that :-)

So I was rebasing my future patches and I found a few spots where
objtool warning strings and code comments weren't fixed-up to
consistent. Here's the new, complete regex -- it includes the original
changes and the missed bits (e.g. note the new substitution for @rela
comments):

sed -i -e 's/struct rela/struct reloc/g' \
        -e 's/\([_\*]\)rela\(s\{0,1\}\)/\1reloc\2/g' \
        -e 's/tmprela\(s\{0,1\}\)/tmpreloc\1/g' \
        -e 's/relasec/relocsec/g' \
        -e 's/rela_list/reloc_list/g' \
        -e 's/rela_hash/reloc_hash/g' \
        -e 's/add_rela/add_reloc/g' \
        -e 's/rela->/reloc->/g' \
        -e '/rela[,\.]/{ s/\([^\.>]\)rela\([\.,]\)/\1reloc\2/g ; }' \
        -e 's/rela =/reloc =/g' \
        -e 's/relas =/relocs =/g' \
        -e 's/relas\[/relocs[/g' \
        -e 's/relaname =/relocname =/g' \
        -e 's/= rela\;/= reloc\;/g' \
        -e 's/= relas\;/= relocs\;/g' \
        -e 's/= relaname\;/= relocname\;/g' \
        -e 's/, rela)/, reloc)/g' \
        -e 's/\([ @]\)rela\([ "]\)/\1reloc\2/g' \
        -e 's/ rela$/ reloc/g' \
        -e 's/, relaname/, relocname/g' \
        -e 's/sec->rela/sec->reloc/g' \
        -e 's/(\(!\{0,1\}\)rela/(\1reloc/g' \
        arch.h \
        arch/x86/decode.c  \
        check.c \
        check.h \
        elf.c \
        elf.h \
        orc_gen.c \
        special.c

If you want to fixup this commit you could just re-run the regex after
applying it but before applying the next commit.

Cheers,
	-Matt Helsley


  reply	other threads:[~2020-05-30  0:52 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-29 21:01 [PATCH 0/2] objtool: Support implicit addend relocations Matt Helsley
2020-05-29 21:01 ` [PATCH 1/2] objtool: Rename rela to reloc Matt Helsley
2020-05-29 23:22   ` Josh Poimboeuf
2020-05-30  0:52     ` Matt Helsley [this message]
2020-06-01 15:09       ` Josh Poimboeuf
2020-05-29 21:01 ` [PATCH 2/2] objtool: Add support for relocations without addends Matt Helsley
2020-06-02  7:36   ` Julien Thierry
2020-06-02 16:12   ` Kamalesh Babulal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200530005244.GZ9040@rlwimi.vmware.com \
    --to=mhelsley@vmware.com \
    --cc=jpoimboe@redhat.com \
    --cc=jthierry@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).