From f7a6d63d208a620036518abde6cc954de500d05d Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Fri, 12 Jun 2020 17:26:41 +0200 Subject: [PATCH] Removed automatic '--relax' hack for compiles on Atmega2560 MCU (#749) This removes the --relax option, potentially producing slightly bigger code for the atmega2560. On the longer term, the AVR core should just add this option for all boards, but this is not currently the case yet because removing --relax also works around a gcc miscompilation (see arduino/ArduinoCore-avr#339). Close: https://github.com/arduino/arduino-cli/issues/639 --- legacy/builder/phases/linker.go | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/legacy/builder/phases/linker.go b/legacy/builder/phases/linker.go index 76884bf4602..32bcaf8bafb 100644 --- a/legacy/builder/phases/linker.go +++ b/legacy/builder/phases/linker.go @@ -57,13 +57,11 @@ func (s *Linker) Run(ctx *types.Context) error { } func link(ctx *types.Context, objectFiles paths.PathList, coreDotARelPath *paths.Path, coreArchiveFilePath *paths.Path, buildProperties *properties.Map) error { - optRelax := addRelaxTrickIfATMEGA2560(buildProperties) - quotedObjectFiles := utils.Map(objectFiles.AsStrings(), wrapWithDoubleQuotes) objectFileList := strings.Join(quotedObjectFiles, constants.SPACE) properties := buildProperties.Clone() - properties.Set(constants.BUILD_PROPERTIES_COMPILER_C_ELF_FLAGS, properties.Get(constants.BUILD_PROPERTIES_COMPILER_C_ELF_FLAGS)+optRelax) + properties.Set(constants.BUILD_PROPERTIES_COMPILER_C_ELF_FLAGS, properties.Get(constants.BUILD_PROPERTIES_COMPILER_C_ELF_FLAGS)) properties.Set(constants.BUILD_PROPERTIES_COMPILER_WARNING_FLAGS, properties.Get(constants.BUILD_PROPERTIES_COMPILER_WARNING_FLAGS+"."+ctx.WarningsLevel)) properties.Set(constants.BUILD_PROPERTIES_ARCHIVE_FILE, coreDotARelPath.String()) properties.Set(constants.BUILD_PROPERTIES_ARCHIVE_FILE_PATH, coreArchiveFilePath.String()) @@ -76,10 +74,3 @@ func link(ctx *types.Context, objectFiles paths.PathList, coreDotARelPath *paths func wrapWithDoubleQuotes(value string) string { return "\"" + value + "\"" } - -func addRelaxTrickIfATMEGA2560(buildProperties *properties.Map) string { - if buildProperties.Get(constants.BUILD_PROPERTIES_BUILD_MCU) == "atmega2560" { - return ",--relax" - } - return constants.EMPTY_STRING -}