diff --git a/config/recurse.mk b/config/recurse.mk index 24381f8e757a7..779426eb2f03b 100644 --- a/config/recurse.mk +++ b/config/recurse.mk @@ -192,12 +192,6 @@ endif # Interdependencies that moz.build world don't know about yet for compilation. # Note some others are hardcoded or "guessed" in recursivemake.py and emitter.py -ifdef RELRHACK -# When building with RELR-based ELF hack, we need to build the relevant parts -# before any target. -$(filter %/target,$(compile_targets)): build/unix/elfhack/host build/unix/elfhack/inject/target-objects -endif - ifdef MOZ_USING_WASM_SANDBOXING security/rlbox/pre-compile media/libsoundtouch/src/pre-compile: config/external/wasm2c_sandbox_compiler/host dom/media/ogg/target-objects extensions/spellcheck/hunspell/glue/target-objects gfx/thebes/target-objects parser/expat/target-objects parser/htmlparser/target-objects gfx/ots/src/target-objects: security/rlbox/pre-compile diff --git a/python/mozbuild/mozbuild/backend/recursivemake.py b/python/mozbuild/mozbuild/backend/recursivemake.py index 5fd7e0cdfdf49..df237a7d2730e 100644 --- a/python/mozbuild/mozbuild/backend/recursivemake.py +++ b/python/mozbuild/mozbuild/backend/recursivemake.py @@ -437,6 +437,7 @@ def consume_object(self, obj): if isinstance(obj, Linkable): self._process_test_support_file(obj) + self._process_relrhack(obj) if isinstance(obj, DirectoryTraversal): self._process_directory_traversal(obj, backend_file) @@ -1237,6 +1238,16 @@ def _process_simple_program(self, obj, backend_file): def _process_host_simple_program(self, program, backend_file): backend_file.write("HOST_SIMPLE_PROGRAMS += %s\n" % program) + def _process_relrhack(self, obj): + if isinstance( + obj, (SimpleProgram, Program, SharedLibrary) + ) and obj.config.substs.get("RELRHACK"): + # When building with RELR-based ELF hack, we need to build the relevant parts + # before any target. + node = self._compile_graph[self._build_target_for_obj(obj)] + node.add("build/unix/elfhack/host") + node.add("build/unix/elfhack/inject/target-objects") + def _process_test_support_file(self, obj): # Ensure test support programs and libraries are tracked by an # install manifest for the benefit of the test packager.