| # Copyright 2025 The Fuchsia Authors |
| # |
| # Use of this source code is governed by a MIT-style |
| # license that can be found in the LICENSE file or at |
| # https://opensource.org/licenses/MIT |
| |
| import("kernel_elf_binary.gni") |
| |
| # Compile an ELF binary image to be loaded by physload. |
| # |
| # This defines a kernel_elf_binary() target that with settings appropriate for |
| # being a physload module with a `PhysLoadModuleMain` function (as declared in |
| # "physload.h"). See kernel_elf_binary() for more details. |
| # |
| # Parameters |
| # |
| # * has_patches |
| # - Optional: As for kernel_elf_image(), but with the opposite default. |
| # - Type: bool |
| # - Default: false |
| # |
| # All other parameters are as for kernel_elf_binary(). |
| # |
| template("physload_module") { |
| kernel_elf_binary(target_name) { |
| assert_no_deps = [] |
| deps = [] |
| has_patches = false |
| forward_variables_from(invoker, "*", [ "target_type" ]) |
| |
| target_type = "loadable_module" |
| deps += [ "//zircon/kernel/phys:physload.module" ] |
| assert_no_deps += [ "//zircon/kernel/phys:uart-console" ] |
| } |
| } |
| |
| set_defaults("physload_module") { |
| # This isn't default_shared_library_configs even though loadable_module() |
| # defaults to that. The physload modules don't use any _symbolic_ dynamic |
| # linking, so they can use -fPIE rather than -fPIC in code generation even |
| # though they are linked as -shared. |
| configs = default_executable_configs |
| } |