in newt/toolchain/compiler.go [1089:1170]
func (c *Compiler) generateExtras(elfFilename string,
options map[string]bool) error {
if options["binFile"] {
binFile := elfFilename + ".bin"
cmd := []string{
c.ocPath,
"-R",
".bss",
"-R",
".bss.core",
"-R",
".bss.core.nz",
"-O",
"binary",
elfFilename,
binFile,
}
o, err := util.ShellCommand(cmd, nil)
if err != nil {
return err
}
util.StatusMessage(util.VERBOSITY_DEFAULT, "%s", string(o))
}
if options["listFile"] {
listFile := elfFilename + ".lst"
f, err := os.OpenFile(listFile, os.O_CREATE|os.O_WRONLY|os.O_TRUNC,
0666)
if err != nil {
return util.NewNewtError(err.Error())
}
defer f.Close()
cmd := []string{
c.odPath,
"-wxdS",
elfFilename,
}
o, err := util.ShellCommandLimitDbgOutput(cmd, nil, true, 0)
if err != nil {
// XXX: gobjdump appears to always crash. Until we get that sorted
// out, don't fail the link process if lst generation fails.
return nil
}
if _, err := f.Write(o); err != nil {
return util.ChildNewtError(err)
}
sects := []string{".text", ".rodata", ".data"}
for _, sect := range sects {
cmd := []string{
c.odPath,
"-s",
"-j",
sect,
elfFilename,
}
o, err := util.ShellCommandLimitDbgOutput(cmd, nil, true, 0)
if err != nil {
if _, err := f.Write(o); err != nil {
return util.NewNewtError(err.Error())
}
}
}
cmd = []string{
c.osPath,
elfFilename,
}
o, err = util.ShellCommandLimitDbgOutput(cmd, nil, true, 0)
if err != nil {
return err
}
if _, err := f.Write(o); err != nil {
return util.NewNewtError(err.Error())
}
}
return nil
}