# # Copyright (c) 2020, Google, Inc. All rights reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. #
# Build a userspace app. # # This file must be included at the end of userspace app rules.mk files. # # args: # MODULE : module name (required) # TRUSTY_APP_NAME : Simple name of app (without the path to the source # directory) # TRUSTY_APP_BUILDDIR : Build directory for trusty apps (app will be built in # $(TRUSTY_APP_BUILDDIR)/$(MODULE)) # TRUSTY_APP_IN_TREE : Boolean indicating if the app is being built in-tree # MANIFEST : App manifest JSON file # MANIFEST_OVERLAY : Additional manifest overlay JSON file(s) # MODULE_CONSTANTS : JSON files with constants used for both the manifest and C # headers (optional) (CONSTANTS is a deprecated equivalent to # MODULE_CONSTANTS) # TRUSTY_APP_ALLOCATOR : the userspace memory allocator to utilize in the app. # Currently dlmalloc and scudo are supported. If unset, dlmalloc will be # used. # # The following input arguments control app linking behavior and are not cleared # after building the app: # TRUSTY_APP_BASE_LDFLAGS : LDFLAGS for the app # TRUSTY_APP_ALIGNMENT : Alignment of app image (defaults to 1) # TRUSTY_APP_MEMBASE : App base address, if fixed # TRUSTY_APP_SYMTAB_ENABLED : If true do not strip symbols from the # resulting app binary # # # All library.mk input variables are also valid for apps when building in tree, # see library.mk for additional args and usage.
ifeq (true,$(call TOBOOL,$(MODULE_ADD_IMPLICIT_DEPS))) # Accept explicitly-set scudo or dlmalloc allocators, # default to dlmalloc if TRUSTY_APP_ALLOCATOR is empty, # error if non-supported allocator is explicitly specified ifeq (,$(TRUSTY_APP_ALLOCATOR))
TRUSTY_APP_ALLOCATOR_FOR_$(MODULE) ?= dlmalloc
TRUSTY_APP_ALLOCATOR := $(TRUSTY_APP_ALLOCATOR_FOR_$(MODULE)) endif
MANIFEST_ALLOCATOR := $(subst .json,-$(TRUSTY_APP_ALLOCATOR).json,$(MANIFEST) $(MANIFEST_OVERLAY)) # append allocator-based manifest to the end, so it overrides base manifest values
MANIFEST_OVERLAY += $(wildcard $(MANIFEST_ALLOCATOR))
# Save the path to the output elf file for user-tasks.mk
_MODULES_$(MODULE)_TRUSTY_APP_ELF := $(TRUSTY_APP_ELF)
ifneq ($(filter-out bin,$(MODULE_RUST_CRATE_TYPES)),)
$(error $(MODULE) is an app but MODULE_RUST_CRATE_TYPES is not set to "bin") endif
MODULE_RUST_CRATE_TYPES := bin
# Only include the rest of the build system if we're building in-tree ifeq ($(call TOBOOL,$(TRUSTY_APP_IN_TREE)),true) includemake/library.mk else # Generate manifest binary if building with the SDK
-include $(SDK_DIR)/make/gen_manifest.mk all:: $(MODULE_SRCDEPS) endif
# If ASLR is disabled, don't make PIEs, it burns space ifneq ($(ASLR), false) # Generate PIE code to allow ASLR to be applied ifeq ($(call TOBOOL,$(TRUSTY_USERSPACE)),true)
TRUSTY_APP_LDFLAGS += -static -pie --no-dynamic-linker -z text -Bsymbolic endif endif
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.