6c2c70c61e
The patch Make: use gcc as LD introduced use of GCC wrapper as linker. LD variable references GCC executable now. But when GCC wrapper s used to build relocatable loadable objects (ELF executables and modules) then it causes linking of toolchain default libc and other libraries even when -r is usd. Another problem is that incorrect multiarch variant is selected for libraries search and possibly even for LTO or C++ templates instantiating and other glue code which causes fails during linking if CFLAGS selects non/default miltiarch variant. Corresponding CFLAGS are passed to LDMODULEFLAGS and LDELFFLAGS as well as -nostartfiles -nodefaultlibs options. Separate line is used to easily find and adjust lines if link process is changed in future. Signed-off-by: Pavel Pisa <ppisa@pikron.com>
83 lines
3.0 KiB
Plaintext
83 lines
3.0 KiB
Plaintext
############################################################################
|
|
# boards/arm/imx6/sabre-6quad/scripts/Make.defs
|
|
#
|
|
# Licensed to the Apache Software Foundation (ASF) under one or more
|
|
# contributor license agreements. See the NOTICE file distributed with
|
|
# this work for additional information regarding copyright ownership. The
|
|
# ASF licenses this file to you 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.
|
|
#
|
|
############################################################################
|
|
|
|
include $(TOPDIR)/.config
|
|
include $(TOPDIR)/tools/Config.mk
|
|
include $(TOPDIR)/arch/arm/src/armv7-a/Toolchain.defs
|
|
|
|
LDSCRIPT = dramboot.ld
|
|
|
|
ifeq ($(CONFIG_CYGWIN_WINTOOL),y)
|
|
ARCHSCRIPT = -T "${shell cygpath -w $(BOARD_DIR)$(DELIM)scripts$(DELIM)$(LDSCRIPT)}"
|
|
else
|
|
ARCHSCRIPT = -T$(BOARD_DIR)$(DELIM)scripts$(DELIM)$(LDSCRIPT)
|
|
endif
|
|
|
|
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
|
|
ARCHOPTIMIZATION = -g
|
|
endif
|
|
|
|
ifneq ($(CONFIG_DEBUG_NOOPT),y)
|
|
ARCHOPTIMIZATION += $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
|
|
endif
|
|
|
|
ARCHCPUFLAGS = -mcpu=cortex-a9 -mfpu=vfpv4-d16
|
|
ARCHCFLAGS = -fno-builtin -ffunction-sections -fdata-sections
|
|
ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fcheck-new -fno-rtti
|
|
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef
|
|
ARCHWARNINGSXX = -Wall -Wshadow -Wundef
|
|
ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
|
|
|
|
CFLAGS := $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe
|
|
CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
|
|
CXXFLAGS := $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe
|
|
CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
|
|
CPPFLAGS := $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS)
|
|
AFLAGS := $(CFLAGS) -D__ASSEMBLY__
|
|
|
|
# NXFLAT module definitions
|
|
|
|
NXFLATLDFLAGS1 = -r -Wl,-d -Wl,-warn-common
|
|
NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)$(DELIM)binfmt$(DELIM)libnxflat$(DELIM)gnu-nxflat-pcrel.ld -Wl,-no-check-sections
|
|
LDNXFLATFLAGS = -e main -s 2048
|
|
|
|
|
|
# ELF module definitions
|
|
|
|
CELFFLAGS = $(CFLAGS) -mlong-calls # --target1-abs
|
|
CXXELFFLAGS = $(CXXFLAGS) -mlong-calls # --target1-abs
|
|
|
|
LDELFFLAGS = -r -e main
|
|
LDELFFLAGS += $(CELFFLAGS) -nostartfiles -nodefaultlibs
|
|
ifeq ($(CONFIG_CYGWIN_WINTOOL),y)
|
|
LDELFFLAGS += -T "${shell cygpath -w $(BOARD_DIR)$(DELIM)scripts$(DELIM)gnu-elf.ld}"
|
|
else
|
|
LDELFFLAGS += -T $(BOARD_DIR)$(DELIM)scripts$(DELIM)gnu-elf.ld
|
|
endif
|
|
|
|
LDFLAGS += -Wl,--gc-sections
|
|
|
|
ifneq ($(CROSSDEV),arm-nuttx-elf-)
|
|
LDFLAGS += -nostartfiles -nodefaultlibs
|
|
endif
|
|
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
|
|
LDFLAGS += -g
|
|
endif
|