Message ID | 9faf4908b8b923ca077b4a0eac10465d754350d2.1660573629.git.fweimer@redhat.com |
---|---|
State | New |
Headers | show |
Series | Forced ordering for DFS ELF dependency sorting (bug 28937) | expand |
* Florian Weimer via Libc-alpha: > The main program needs to depend on all shared objects, even objects > that have link-time dependencies among shared objects. Filtering > out shared objects that already have an link-time dependencies is not > necessary here; make will do this automatically. > --- > scripts/dso-ordering-test.py | 14 +++++++------- > 1 file changed, 7 insertions(+), 7 deletions(-) > > diff --git a/scripts/dso-ordering-test.py b/scripts/dso-ordering-test.py > index 2dd6bfda18..f6d22aa00e 100644 > --- a/scripts/dso-ordering-test.py > +++ b/scripts/dso-ordering-test.py > @@ -707,13 +707,12 @@ def process_testcase(t): > "\t$(compile.c) $(OUTPUT_OPTION)\n") > makefile.write (rule) > > - not_depended_objs = find_objs_not_depended_on(test_descr) > - if not_depended_objs: > - depstr = "" > - for dep in not_depended_objs: > - depstr += (" $(objpfx)" + test_subdir + "/" > - + test_name + "-" + dep + ".so") > - makefile.write("$(objpfx)%s.out:%s\n" % (base_test_name, depstr)) > + # Ensure that all shared objects are built before running the > + # test, whether there link-time dependencies or not. > + depobjs = ["$(objpfx){}/{}-{}.so".format(test_subdir, test_name, dep) > + for dep in test_descr.objs] > + makefile.write("$(objpfx){}.out: {}\n".format( > + base_test_name, " ".join(depobjs))) > > # Add main executable to test-srcs > makefile.write("test-srcs += %s/%s\n" % (test_subdir, test_name)) > @@ -779,6 +778,7 @@ def process_testcase(t): > # description string. > for obj in test_descr.objs: > src_name = test_name + "-" + obj + ".c" > + print('Generating {}...'.format(src_name)) > f = open(testpfx_src + src_name, "w") > if obj in test_descr.callrefs: > called_objs = test_descr.callrefs[obj] Ugh, I'm going to remove that debugging leftover before committing. Thanks, Florian
On 15/08/22 11:30, Florian Weimer via Libc-alpha wrote: > The main program needs to depend on all shared objects, even objects > that have link-time dependencies among shared objects. Filtering > out shared objects that already have an link-time dependencies is not > necessary here; make will do this automatically. LGTM with the print debug leftover removed. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org> > --- > scripts/dso-ordering-test.py | 14 +++++++------- > 1 file changed, 7 insertions(+), 7 deletions(-) > > diff --git a/scripts/dso-ordering-test.py b/scripts/dso-ordering-test.py > index 2dd6bfda18..f6d22aa00e 100644 > --- a/scripts/dso-ordering-test.py > +++ b/scripts/dso-ordering-test.py > @@ -707,13 +707,12 @@ def process_testcase(t): > "\t$(compile.c) $(OUTPUT_OPTION)\n") > makefile.write (rule) > > - not_depended_objs = find_objs_not_depended_on(test_descr) > - if not_depended_objs: > - depstr = "" > - for dep in not_depended_objs: > - depstr += (" $(objpfx)" + test_subdir + "/" > - + test_name + "-" + dep + ".so") > - makefile.write("$(objpfx)%s.out:%s\n" % (base_test_name, depstr)) > + # Ensure that all shared objects are built before running the > + # test, whether there link-time dependencies or not. > + depobjs = ["$(objpfx){}/{}-{}.so".format(test_subdir, test_name, dep) > + for dep in test_descr.objs] > + makefile.write("$(objpfx){}.out: {}\n".format( > + base_test_name, " ".join(depobjs))) > > # Add main executable to test-srcs > makefile.write("test-srcs += %s/%s\n" % (test_subdir, test_name)) > @@ -779,6 +778,7 @@ def process_testcase(t): > # description string. > for obj in test_descr.objs: > src_name = test_name + "-" + obj + ".c" > + print('Generating {}...'.format(src_name)) > f = open(testpfx_src + src_name, "w") > if obj in test_descr.callrefs: > called_objs = test_descr.callrefs[obj]
diff --git a/scripts/dso-ordering-test.py b/scripts/dso-ordering-test.py index 2dd6bfda18..f6d22aa00e 100644 --- a/scripts/dso-ordering-test.py +++ b/scripts/dso-ordering-test.py @@ -707,13 +707,12 @@ def process_testcase(t): "\t$(compile.c) $(OUTPUT_OPTION)\n") makefile.write (rule) - not_depended_objs = find_objs_not_depended_on(test_descr) - if not_depended_objs: - depstr = "" - for dep in not_depended_objs: - depstr += (" $(objpfx)" + test_subdir + "/" - + test_name + "-" + dep + ".so") - makefile.write("$(objpfx)%s.out:%s\n" % (base_test_name, depstr)) + # Ensure that all shared objects are built before running the + # test, whether there link-time dependencies or not. + depobjs = ["$(objpfx){}/{}-{}.so".format(test_subdir, test_name, dep) + for dep in test_descr.objs] + makefile.write("$(objpfx){}.out: {}\n".format( + base_test_name, " ".join(depobjs))) # Add main executable to test-srcs makefile.write("test-srcs += %s/%s\n" % (test_subdir, test_name)) @@ -779,6 +778,7 @@ def process_testcase(t): # description string. for obj in test_descr.objs: src_name = test_name + "-" + obj + ".c" + print('Generating {}...'.format(src_name)) f = open(testpfx_src + src_name, "w") if obj in test_descr.callrefs: called_objs = test_descr.callrefs[obj]