63 OMF_VERSION_0 = 0x0000,
64 OMF_VERSION_1 = 0x0100,
65 OMF_VERSION_2 = 0x0200,
66 OMF_VERSION_2_1 = 0x0201,
136 virtual offset_t GetLength(
Segment& segment) = 0;
148 OPC_CONST_BASE = 0x00,
149 OPC_CONST_FIRST = 0x01,
150 OPC_CONST_LAST = 0xDF,
171 OPC_C_INTERSEG = 0xF6,
182 virtual offset_t GetLength(
Segment& segment);
190 std::vector<uint8_t> data;
192 DataRecord(record_type type, std::vector<uint8_t> data)
193 :
Record(type), data(data)
198 :
Record(type), data(length, 0)
207 offset_t GetLength(
Segment& segment)
override;
218 :
Record(type), value(value)
222 offset_t GetLength(
Segment& segment)
override;
233 :
Record(type), value(value)
237 offset_t GetLength(
Segment& segment)
override;
255 RelocationRecord(record_type type, uint8_t size, uint8_t shift, offset_t source, offset_t target)
256 :
Record(type), size(size), shift(shift), source(source), target(target)
260 offset_t GetLength(
Segment& segment)
override;
268 uint16_t file_number = 0;
269 uint16_t segment_number = 0;
276 IntersegmentRelocationRecord(record_type type, uint8_t size, uint8_t shift, offset_t source, uint16_t file_number, uint16_t segment_number, offset_t target)
277 :
RelocationRecord(type, size, shift, source, target), file_number(file_number), segment_number(segment_number)
281 offset_t GetLength(
Segment& segment)
override;
290 uint16_t line_length = 0;
296 operation_type operation = operation_type(0);
297 uint16_t private_flag = 0;
304 LabelRecord(record_type type, std::string name, uint16_t line_length,
int operation, uint16_t private_flag)
305 :
Record(type), name(name), line_length(line_length), operation(operation_type(operation)), private_flag(private_flag)
309 offset_t GetLength(
Segment& segment)
override;
317 std::unique_ptr<Expression> expression;
324 LabelExpressionRecord(record_type type, std::string name, uint16_t line_length,
int operation, uint16_t private_flag, std::unique_ptr<Expression> expression)
325 :
LabelRecord(type, name, line_length, operation, private_flag), expression(std::move(expression))
329 offset_t GetLength(
Segment& segment)
override;
345 RangeRecord(record_type type, offset_t start, offset_t end)
346 :
Record(type), start(start), end(end)
350 offset_t GetLength(
Segment& segment)
override;
359 std::unique_ptr<Expression> expression;
366 ExpressionRecord(record_type type, uint8_t size, std::unique_ptr<Expression> expression)
367 :
Record(type), size(size), expression(std::move(expression))
371 offset_t GetLength(
Segment& segment)
override;
391 offset_t GetLength(
Segment& segment)
override;
399 uint16_t segment_number;
408 EntryRecord(record_type type, uint16_t segment_number, offset_t location, std::string name)
409 :
Record(type), segment_number(segment_number), location(location), name(name)
413 offset_t GetLength(
Segment& segment)
override;
421 enum super_record_type
426 SUPER_INTERSEG13 = SUPER_INTERSEG1 - 1 + 13,
427 SUPER_INTERSEG25 = SUPER_INTERSEG1 - 1 + 25,
430 super_record_type super_type = super_record_type(0);
432 std::vector<uint16_t> offsets;
434 SuperCompactRecord(record_type type, super_record_type super_type = super_record_type(0))
435 :
Record(type), super_type(super_type)
439 offset_t GetLength(
Segment& segment)
override;
443 void WritePatchList(
Linker::Writer& wr,
const std::vector<uint8_t>& patches);
450 std::unique_ptr<Record> makeEND();
451 std::unique_ptr<Record> makeCONST(std::vector<uint8_t> data);
452 std::unique_ptr<Record> makeCONST(std::vector<uint8_t> data,
size_t length);
453 std::unique_ptr<Record> makeCONST(
size_t length);
454 std::unique_ptr<Record> makeALIGN(offset_t
align = 0);
455 std::unique_ptr<Record> makeORG(offset_t value = 0);
456 std::unique_ptr<Record> makeRELOC(uint8_t size, uint8_t shift, offset_t source, offset_t target);
457 std::unique_ptr<Record> makeRELOC();
458 std::unique_ptr<Record> makeINTERSEG(uint8_t size, uint8_t shift, offset_t source, uint16_t file_number, uint16_t
segment_number, offset_t target);
459 std::unique_ptr<Record> makeINTERSEG();
460 std::unique_ptr<Record> makeUSING(std::string name =
"");
461 std::unique_ptr<Record> makeSTRONG(std::string name =
"");
462 std::unique_ptr<Record> makeGLOBAL();
463 std::unique_ptr<Record> makeGLOBAL(std::string name, uint16_t line_length,
int operation, uint16_t private_flag);
464 std::unique_ptr<Record> makeGEQU();
465 std::unique_ptr<Record> makeGEQU(std::string name, uint16_t line_length,
int operation, uint16_t private_flag, std::unique_ptr<Expression> expression);
466 std::unique_ptr<Record> makeMEM();
467 std::unique_ptr<Record> makeMEM(offset_t start, offset_t end);
468 std::unique_ptr<Record> makeEXPR();
469 std::unique_ptr<Record> makeEXPR(uint8_t size, std::unique_ptr<Expression> expression);
470 std::unique_ptr<Record> makeZEXPR();
471 std::unique_ptr<Record> makeZEXPR(uint8_t size, std::unique_ptr<Expression> expression);
472 std::unique_ptr<Record> makeBEXPR();
473 std::unique_ptr<Record> makeBEXPR(uint8_t size, std::unique_ptr<Expression> expression);
474 std::unique_ptr<Record> makeRELEXPR();
475 std::unique_ptr<Record> makeRELEXPR(uint8_t size, offset_t origin, std::unique_ptr<Expression> expression);
476 std::unique_ptr<Record> makeLOCAL();
477 std::unique_ptr<Record> makeLOCAL(std::string name, uint16_t line_length,
int operation, uint16_t private_flag);
478 std::unique_ptr<Record> makeEQU();
479 std::unique_ptr<Record> makeEQU(std::string name, uint16_t line_length,
int operation, uint16_t private_flag, std::unique_ptr<Expression> expression);
480 std::unique_ptr<Record> makeDS(offset_t count = 0);
481 std::unique_ptr<Record> makeLCONST();
482 std::unique_ptr<Record> makeLCONST(std::vector<uint8_t> data);
483 std::unique_ptr<Record> makeLCONST(std::vector<uint8_t> data,
size_t length);
484 std::unique_ptr<Record> makeLEXPR();
485 std::unique_ptr<Record> makeLEXPR(uint8_t size, std::unique_ptr<Expression> expression);
486 std::unique_ptr<Record> makeENTRY();
487 std::unique_ptr<Record> makeENTRY(uint16_t
segment_number, offset_t location, std::string name);
488 std::unique_ptr<Record> makecRELOC(uint8_t size, uint8_t shift, uint16_t source, uint16_t target);
489 std::unique_ptr<Record> makecRELOC();
490 std::unique_ptr<Record> makecINTERSEG(uint8_t size, uint8_t shift, uint16_t source, uint16_t
segment_number, uint16_t target);
491 std::unique_ptr<Record> makecINTERSEG();
492 std::unique_ptr<Record> makeSUPER(SuperCompactRecord::super_record_type super_type = SuperCompactRecord::super_record_type(0));