Messages in this thread | | | Date | Fri, 29 May 2020 17:52:44 -0700 | From | Matt Helsley <> | Subject | Re: [PATCH 1/2] objtool: Rename rela to reloc |
| |
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
| |