-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathraw_section.h
More file actions
40 lines (40 loc) · 1.59 KB
/
raw_section.h
File metadata and controls
40 lines (40 loc) · 1.59 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
/*
* Auto-added header
* File: raw_section.h
* Author: camradeling
* Email: camradeling@gmail.com
* 2025
*/
//------------------------------------------------------------------------------------------------------------------------------
#ifndef RAW_SECTION_H
#define RAW_SECTION_H
//------------------------------------------------------------------------------------------------------------------------------
#include <stdint.h>
#include <string>
#include <iterator>
#include <vector>
#include <algorithm>
#include <memory>
#include <elf.h>
//------------------------------------------------------------------------------------------------------------------------------
#include "section.h"
//------------------------------------------------------------------------------------------------------------------------------
namespace ElfMan
{
//------------------------------------------------------------------------------------------------------------------------------
class RawSection : public Section {
public:
RawSection(Elf32_Shdr* header, const uint8_t* buffer, uint32_t total_sz, ObjectFile* obj)
: Section(header, obj), data(total_sz)
{
memcpy(data.data(), buffer, total_sz);
}
virtual std::vector<uint8_t> serialize() {
return data;
}
std::vector<uint8_t> data;
};
//------------------------------------------------------------------------------------------------------------------------------
} //namespace ElfMan
//------------------------------------------------------------------------------------------------------------------------------
#endif/*RAW_SECTION_H*/