Changeset 977c3de in rtems-tools for linkers/rtems-ld.cpp


Ignore:
Timestamp:
Nov 17, 2012, 6:34:33 AM (7 years ago)
Author:
Chris Johns <chrisj@…>
Branches:
4.10, 4.11, master
Children:
065ac15
Parents:
0b65a28
Message:

Refactor the ELF support to allow ELF write suppport.

The refactoring allows better reuse of the ELF support and cleans up
some hacks from the generic file and archive handling improving the
separation of the file handling from the file format, ie ELF. The
handling of ELF object files and ELF object files inside archives
is cleaner.

The refactor cleaned up the symbol handling where the symbols now
reside in the ELF file object and references are take in symbol
pointer containers and symbol table containers.

The main purpose of the refactor is to allow support for creating
and writing ELF files.

Also added an rtems-syms command where special symbol support
can be added.

File:
1 moved

Legend:

Unmodified
Added
Removed
  • linkers/rtems-ld.cpp

    r0b65a28 r977c3de  
    156156  try
    157157  {
    158     rld::files::cache   cache;
    159     rld::files::cache   base;
    160     rld::files::paths   libpaths;
    161     rld::files::paths   libs;
    162     rld::files::paths   objects;
    163     rld::files::paths   libraries;
    164     rld::symbols::table base_symbols;
    165     rld::symbols::table symbols;
    166     rld::symbols::table undefined;
    167     std::string         entry;
    168     std::string         output = "a.out";
    169     std::string         base_name;
    170     std::string         cc_name;
    171     bool                script = false;
    172     bool                standard_libs = true;
    173     bool                exec_prefix_set = false;
    174     bool                map = false;
    175     bool                warnings = false;
     158    rld::files::cache    cache;
     159    rld::files::cache    base;
     160    rld::files::paths    libpaths;
     161    rld::files::paths    libs;
     162    rld::files::paths    objects;
     163    rld::files::paths    libraries;
     164    rld::symbols::bucket defines;
     165    rld::symbols::bucket undefines;
     166    rld::symbols::table  base_symbols;
     167    rld::symbols::table  symbols;
     168    rld::symbols::table  undefined;
     169    std::string          entry;
     170    std::string          output = "a.out";
     171    std::string          base_name;
     172    std::string          cc_name;
     173    bool                 script = false;
     174    bool                 standard_libs = true;
     175    bool                 exec_prefix_set = false;
     176    bool                 map = false;
     177    bool                 warnings = false;
    176178
    177179    libpaths.push_back (".");
     
    255257
    256258        case 'd':
    257           symbols[optarg] = rld::symbols::symbol (optarg);
     259          defines.push_back (rld::symbols::symbol (optarg));
    258260          break;
    259261
    260262        case 'u':
    261           undefined[optarg] = rld::symbols::symbol (optarg);
     263          undefines.push_back (rld::symbols::symbol (optarg));
    262264          break;
    263265
     
    294296    while (argc--)
    295297      objects.push_back (*argv++);
     298
     299    /*
     300     * Load the symbol table with the defined symbols from the defines bucket.
     301     */
     302    rld::symbols::load (defines, symbols);
     303
     304    /*
     305     * Load the undefined table with the undefined symbols from the undefines
     306     * bucket.
     307     */
     308    rld::symbols::load (undefines, undefined);
    296309
    297310    /*
     
    398411    char* realname;
    399412    realname = abi::__cxa_demangle (e.what(), 0, 0, &status);
    400     std::cerr << "error: std::exception: " << realname << " [";
     413    std::cerr << "error: exception: " << realname << " [";
    401414    ::free (realname);
    402415    const std::type_info &ti = typeid (e);
Note: See TracChangeset for help on using the changeset viewer.