Skip to content

Commit 3b18571

Browse files
cmaglieumbynos
authored andcommitted
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: #639
1 parent 891e730 commit 3b18571

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

Diff for: legacy/builder/phases/linker.go

+1-10
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,11 @@ func (s *Linker) Run(ctx *types.Context) error {
5757
}
5858

5959
func link(ctx *types.Context, objectFiles paths.PathList, coreDotARelPath *paths.Path, coreArchiveFilePath *paths.Path, buildProperties *properties.Map) error {
60-
optRelax := addRelaxTrickIfATMEGA2560(buildProperties)
61-
6260
quotedObjectFiles := utils.Map(objectFiles.AsStrings(), wrapWithDoubleQuotes)
6361
objectFileList := strings.Join(quotedObjectFiles, constants.SPACE)
6462

6563
properties := buildProperties.Clone()
66-
properties.Set(constants.BUILD_PROPERTIES_COMPILER_C_ELF_FLAGS, properties.Get(constants.BUILD_PROPERTIES_COMPILER_C_ELF_FLAGS)+optRelax)
64+
properties.Set(constants.BUILD_PROPERTIES_COMPILER_C_ELF_FLAGS, properties.Get(constants.BUILD_PROPERTIES_COMPILER_C_ELF_FLAGS))
6765
properties.Set(constants.BUILD_PROPERTIES_COMPILER_WARNING_FLAGS, properties.Get(constants.BUILD_PROPERTIES_COMPILER_WARNING_FLAGS+"."+ctx.WarningsLevel))
6866
properties.Set(constants.BUILD_PROPERTIES_ARCHIVE_FILE, coreDotARelPath.String())
6967
properties.Set(constants.BUILD_PROPERTIES_ARCHIVE_FILE_PATH, coreArchiveFilePath.String())
@@ -76,10 +74,3 @@ func link(ctx *types.Context, objectFiles paths.PathList, coreDotARelPath *paths
7674
func wrapWithDoubleQuotes(value string) string {
7775
return "\"" + value + "\""
7876
}
79-
80-
func addRelaxTrickIfATMEGA2560(buildProperties *properties.Map) string {
81-
if buildProperties.Get(constants.BUILD_PROPERTIES_BUILD_MCU) == "atmega2560" {
82-
return ",--relax"
83-
}
84-
return constants.EMPTY_STRING
85-
}

0 commit comments

Comments
 (0)