Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

newt: Fix autogenerated linker script usage #541

Merged
merged 1 commit into from
Feb 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 13 additions & 11 deletions newt/pkg/bsp_package.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,15 +113,7 @@ func (bsp *BspPackage) resolveLinkerScriptSetting(
return nil, err
}

if path == "autogenerated" {
path, err = bsp.getAutogeneratedLinkerScriptPath()
if err != nil {
return nil, util.PreNewtError(err,
"Could not resolve autogenerated linker script path for target \"%s\"",
bsp.yov.Pkg.Name())
}
paths = append(paths, path)
} else if path != "" {
if path != "" {
paths = append(paths, path)
}
} else {
Expand All @@ -130,9 +122,19 @@ func (bsp *BspPackage) resolveLinkerScriptSetting(
// Read each linker script from the list.
for _, val := range vals {
if val == "autogenerated" {
return nil, util.PreNewtError(err,
"Both autogenerated and custom linker scripts cannot be used."+
if len(vals) > 1 {
return nil, util.NewNewtError("Both autogenerated and custom linker scripts cannot be used. " +
"Newt handles either autogenerated linker script or a list of custom linker scripts.")
} else {
path, err := bsp.getAutogeneratedLinkerScriptPath()
if err != nil {
return nil, util.PreNewtError(err,
"Could not resolve autogenerated linker script path for target \"%s\"",
bsp.yov.Pkg.Name())
}
paths = append(paths, path)
continue
}
}

path, err := proj.ResolvePath(ypkg.Repo().Path(), val)
Expand Down
Loading