OpenCores
URL https://opencores.org/ocsvn/lxp32/lxp32/trunk

Subversion Repositories lxp32

[/] [lxp32/] [trunk/] [tools/] [src/] [lxp32asm/] [linker.h] - Diff between revs 2 and 6

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 2 Rev 6
Line 15... Line 15...
 
 
#include <iostream>
#include <iostream>
#include <map>
#include <map>
#include <vector>
#include <vector>
#include <string>
#include <string>
 
#include <set>
 
 
class Linker {
class Linker {
        struct GlobalSymbolData {
        struct GlobalSymbolData {
                LinkableObject *obj=nullptr;
                LinkableObject *obj=nullptr;
                LinkableObject::Word rva=0;
                LinkableObject::Word rva=0;
                std::multimap<const LinkableObject*,LinkableObject::Word> refs;
                std::set<const LinkableObject*> refs;
        };
        };
 
 
        std::vector<LinkableObject*> _objects;
        std::vector<LinkableObject*> _objects;
        LinkableObject *_entryObject;
        LinkableObject *_entryObject=nullptr;
        std::map<std::string,GlobalSymbolData> _globalSymbolTable;
        std::map<std::string,GlobalSymbolData> _globalSymbolTable;
 
 
// Various output options
// Various output options
        LinkableObject::Word _base=0;
        LinkableObject::Word _base=0;
        std::size_t _align=4;
        std::size_t _align=4;
        std::size_t _imageSize=0;
        std::size_t _imageSize=0;
 
        std::size_t _bytesWritten=0;
public:
public:
        void addObject(LinkableObject &obj);
        void addObject(LinkableObject &obj);
        void link(OutputWriter &writer);
        void link(OutputWriter &writer);
        void setBase(LinkableObject::Word base);
        void setBase(LinkableObject::Word base);
        void setAlignment(std::size_t align);
        void setAlignment(std::size_t align);
        void setImageSize(std::size_t size);
        void setImageSize(std::size_t size);
 
        void generateMap(std::ostream &s);
private:
private:
        void buildSymbolTable();
        void buildSymbolTable();
        void placeObjects();
        void placeObjects();
        void relocateObject(LinkableObject *obj);
        void relocateObject(LinkableObject *obj);
        void writeObjects(OutputWriter &writer);
        void writeObjects(OutputWriter &writer);
 
        void markAsUsed(const LinkableObject *obj,std::set<const LinkableObject*> &used);
};
};
 
 
#endif
#endif
 
 
 No newline at end of file
 No newline at end of file

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.