-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstatic_library.h
More file actions
41 lines (40 loc) · 1.9 KB
/
static_library.h
File metadata and controls
41 lines (40 loc) · 1.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/*
* Auto-added header
* File: static_library.h
* Author: camradeling
* Email: camradeling@gmail.com
* 2025
*/
//------------------------------------------------------------------------------------------------------------------------------
#ifndef STATIC_LIBRARY_H
#define STATIC_LIBRARY_H
//------------------------------------------------------------------------------------------------------------------------------
#include <vector>
#include <string>
#include <cstdint>
//------------------------------------------------------------------------------------------------------------------------------
#include "object_file.h"
//------------------------------------------------------------------------------------------------------------------------------
namespace ElfMan
{
//------------------------------------------------------------------------------------------------------------------------------
class StaticLibrary {
public:
explicit StaticLibrary(const std::vector<uint8_t>& data);
// Returns parsed object files
const std::vector<std::shared_ptr<ArchiveObjectFile>>& getObjects() const { return objects; }
std::vector<uint8_t> serialize();
void reorder_symtab_and_relocations();
// Debug dump of archive contents
void dump();
std::shared_ptr<ElfMan::Symbol> find_symbol(std::string sym_name);
bool rename_symbol(std::string old_name, std::string new_name, std::string match_object);
private:
std::vector<std::shared_ptr<ArchiveObjectFile>> objects;
std::string nameTable; // GNU string table for long filenames
std::string symbolTable; // GNU string table for symbols
};
//------------------------------------------------------------------------------------------------------------------------------
} //namespace ElfMan
//------------------------------------------------------------------------------------------------------------------------------
#endif /*STATIC_LIBRARY_H*/