func()

in newt/builder/library.go [127:206]


func (b *Builder) ParseObjectLibraryFile(bp *BuildPackage,
	file string, textDataOnly bool) (error, *symbol.SymbolMap) {

	c, err := b.targetBuilder.NewCompiler(b.AppElfPath(), "")

	ext := filepath.Ext(file)

	if err != nil {
		return err, nil
	}

	err, out := c.ParseLibrary(file)

	if err != nil {
		return err, nil
	}

	sm := symbol.NewSymbolMap()

	buffer := bytes.NewBuffer(out)

	err, r := getParseRexeg()

	if err != nil {
		return err, nil
	}

	for {
		line, err := buffer.ReadString('\n')
		if err != nil {
			break
		}
		err, si := parseObjectLine(line, r)

		if err == nil && si != nil {

			/* assign the library */
			if bp != nil {
				(*si).Bpkg = bp.rpkg.Lpkg.Name()
			} else {
				(*si).Bpkg = "elf"
			}

			/*  discard undefined */
			if (*si).IsSection("*UND*") {
				continue
			}

			/* discard debug symbols */
			if (*si).IsDebug() {
				continue
			}

			if (*si).IsFile() {
				continue
			}

			/* if we are looking for text and data only, do a special check */
			if textDataOnly {
				include := (*si).IsSection(".bss") ||
					(*si).IsSection(".text") ||
					(*si).IsSection(".data") ||
					(*si).IsSection("*COM*") ||
					(*si).IsSection(".rodata")

				if !include {
					continue
				}
			}

			/* add the symbol to the map */
			(*si).Ext = ext
			sm.Add(*si)
			util.StatusMessage(util.VERBOSITY_VERBOSE,
				"Keeping Symbol %s in package %s\n", (*si).Name, (*si).Bpkg)
		}
	}

	return nil, sm
}