Skip to content

Commit 22e1661

Browse files
committed
create-diff-object: base->orig renames
Rename "base" to "orig" when referencing object files and their contents to be consistent with temporary directory structure. Signed-off-by: Artem Savkov <asavkov@redhat.com>
1 parent e2b50d7 commit 22e1661

1 file changed

Lines changed: 22 additions & 22 deletions

File tree

kpatch-build/create-diff-object.c

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
* This file contains the heart of the ELF object differencing engine.
2525
*
2626
* The tool takes two ELF objects from two versions of the same source
27-
* file; a "base" object and a "patched" object. These object need to have
27+
* file; a "orig" object and a "patched" object. These object need to have
2828
* been compiled with the -ffunction-sections and -fdata-sections GCC options.
2929
*
3030
* The tool compares the objects at a section level to determine what
@@ -1255,14 +1255,14 @@ static struct rela *kpatch_find_static_twin_ref(struct section *rela_sec, struct
12551255
* with the same name to be used in the same function if they
12561256
* have different scopes. (We have to assume that in such
12571257
* cases, the order in which they're referenced remains the
1258-
* same between the base and patched objects, as there's no
1258+
* same between the orig and patched objects, as there's no
12591259
* other way to distinguish them.)
12601260
*
12611261
* - Static locals are usually referenced by functions, but
12621262
* they can occasionally be referenced by data sections as
12631263
* well.
12641264
*/
1265-
static void kpatch_correlate_static_local_variables(struct kpatch_elf *base,
1265+
static void kpatch_correlate_static_local_variables(struct kpatch_elf *orig,
12661266
struct kpatch_elf *patched)
12671267
{
12681268
struct symbol *sym, *patched_sym;
@@ -1272,10 +1272,10 @@ static void kpatch_correlate_static_local_variables(struct kpatch_elf *base,
12721272

12731273
/*
12741274
* First undo the correlations for all static locals. Two static
1275-
* locals can have the same numbered suffix in the base and patched
1275+
* locals can have the same numbered suffix in the orig and patched
12761276
* objects by coincidence.
12771277
*/
1278-
list_for_each_entry(sym, &base->symbols, list) {
1278+
list_for_each_entry(sym, &orig->symbols, list) {
12791279

12801280
if (!kpatch_is_normal_static_local(sym))
12811281
continue;
@@ -1299,7 +1299,7 @@ static void kpatch_correlate_static_local_variables(struct kpatch_elf *base,
12991299
* Do the correlations: for each section reference to a static local,
13001300
* look for a corresponding reference in the section's twin.
13011301
*/
1302-
list_for_each_entry(sec, &base->sections, list) {
1302+
list_for_each_entry(sec, &orig->sections, list) {
13031303

13041304
if (!is_rela_section(sec) ||
13051305
is_debug_section(sec) ||
@@ -1355,14 +1355,14 @@ static void kpatch_correlate_static_local_variables(struct kpatch_elf *base,
13551355
/*
13561356
* Make sure that:
13571357
*
1358-
* 1. all the base object's referenced static locals have been
1358+
* 1. all the orig object's referenced static locals have been
13591359
* correlated; and
13601360
*
1361-
* 2. each reference to a static local in the base object has a
1361+
* 2. each reference to a static local in the orig object has a
13621362
* corresponding reference in the patched object (because a static
13631363
* local can be referenced by more than one section).
13641364
*/
1365-
list_for_each_entry(sec, &base->sections, list) {
1365+
list_for_each_entry(sec, &orig->sections, list) {
13661366

13671367
if (!is_rela_section(sec) ||
13681368
is_debug_section(sec))
@@ -3686,7 +3686,7 @@ static struct argp argp = { options, parse_opt, args_doc, NULL };
36863686

36873687
int main(int argc, char *argv[])
36883688
{
3689-
struct kpatch_elf *kelf_base, *kelf_patched, *kelf_out;
3689+
struct kpatch_elf *kelf_orig, *kelf_patched, *kelf_out;
36903690
struct arguments arguments;
36913691
int num_changed, callbacks_exist, new_globals_exist;
36923692
struct lookup_table *lookup;
@@ -3713,30 +3713,30 @@ int main(int argc, char *argv[])
37133713

37143714
childobj = basename(orig_obj);
37153715

3716-
kelf_base = kpatch_elf_open(orig_obj);
3716+
kelf_orig = kpatch_elf_open(orig_obj);
37173717
kelf_patched = kpatch_elf_open(patched_obj);
37183718

3719-
kpatch_compare_elf_headers(kelf_base->elf, kelf_patched->elf);
3720-
kpatch_check_program_headers(kelf_base->elf);
3719+
kpatch_compare_elf_headers(kelf_orig->elf, kelf_patched->elf);
3720+
kpatch_check_program_headers(kelf_orig->elf);
37213721
kpatch_check_program_headers(kelf_patched->elf);
37223722

3723-
kpatch_bundle_symbols(kelf_base);
3723+
kpatch_bundle_symbols(kelf_orig);
37243724
kpatch_bundle_symbols(kelf_patched);
37253725

3726-
kpatch_detect_child_functions(kelf_base);
3726+
kpatch_detect_child_functions(kelf_orig);
37273727
kpatch_detect_child_functions(kelf_patched);
37283728

3729-
lookup = lookup_open(parent_symtab, parent_name, mod_symvers, kelf_base);
3729+
lookup = lookup_open(parent_symtab, parent_name, mod_symvers, kelf_orig);
37303730

37313731
kpatch_mark_grouped_sections(kelf_patched);
3732-
kpatch_replace_sections_syms(kelf_base);
3732+
kpatch_replace_sections_syms(kelf_orig);
37333733
kpatch_replace_sections_syms(kelf_patched);
37343734

3735-
kpatch_correlate_elfs(kelf_base, kelf_patched);
3736-
kpatch_correlate_static_local_variables(kelf_base, kelf_patched);
3735+
kpatch_correlate_elfs(kelf_orig, kelf_patched);
3736+
kpatch_correlate_static_local_variables(kelf_orig, kelf_patched);
37373737

37383738
/*
3739-
* After this point, we don't care about kelf_base anymore.
3739+
* After this point, we don't care about kelf_orig anymore.
37403740
* We access its sections via the twin pointers in the
37413741
* section, symbol, and rela lists of kelf_patched.
37423742
*/
@@ -3745,8 +3745,8 @@ int main(int argc, char *argv[])
37453745
kpatch_mark_ignored_functions_same(kelf_patched);
37463746
kpatch_mark_ignored_sections_same(kelf_patched);
37473747
kpatch_check_func_profiling_calls(kelf_patched);
3748-
kpatch_elf_teardown(kelf_base);
3749-
kpatch_elf_free(kelf_base);
3748+
kpatch_elf_teardown(kelf_orig);
3749+
kpatch_elf_free(kelf_orig);
37503750

37513751
kpatch_include_standard_elements(kelf_patched);
37523752
num_changed = kpatch_include_changed_functions(kelf_patched);

0 commit comments

Comments
 (0)