mirror of
https://github.com/ksherlock/merlin-utils.git
synced 2025-01-17 13:31:07 +00:00
ORG support.
This commit is contained in:
parent
4a05a8687c
commit
f7d70702f9
5
link.cpp
5
link.cpp
@ -31,7 +31,7 @@
|
||||
#include "script.h"
|
||||
|
||||
void save_omf(const std::string &path, std::vector<omf::segment> &segments, bool compress, bool expressload);
|
||||
void save_bin(const std::string &path, omf::segment &segment, uint32_t org);
|
||||
void save_bin(const std::string &path, omf::segment &segment);
|
||||
|
||||
int set_file_type(const std::string &path, uint16_t file_type, uint32_t aux_type, std::error_code &ec);
|
||||
void set_file_type(const std::string &path, uint16_t file_type, uint32_t aux_type);
|
||||
@ -796,7 +796,7 @@ void finish(void) {
|
||||
if (verbose) printf("Saving %s\n", path.c_str());
|
||||
try {
|
||||
if (lkv == 0)
|
||||
save_bin(path, segments.back(), org);
|
||||
save_bin(path, segments.back());
|
||||
else
|
||||
save_omf(path, segments, compress, express);
|
||||
|
||||
@ -1205,6 +1205,7 @@ void evaluate(label_t label, opcode_t opcode, const char *cursor) {
|
||||
|
||||
case OP_ORG:
|
||||
org = number_operand(cursor, local_symbol_table);
|
||||
segments.back().org = org;
|
||||
atype = org;
|
||||
break;
|
||||
|
||||
|
5
omf.cpp
5
omf.cpp
@ -446,7 +446,7 @@ uint32_t add_relocs(std::vector<uint8_t> &data, size_t data_offset, omf::segment
|
||||
return reloc_size;
|
||||
}
|
||||
|
||||
void save_bin(const std::string &path, omf::segment &segment, uint32_t org) {
|
||||
void save_bin(const std::string &path, omf::segment &segment) {
|
||||
|
||||
int fd;
|
||||
fd = open(path.c_str(), O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0666);
|
||||
@ -454,6 +454,7 @@ void save_bin(const std::string &path, omf::segment &segment, uint32_t org) {
|
||||
err(EX_CANTCREAT, "Unable to open %s", path.c_str());
|
||||
}
|
||||
|
||||
uint32_t org = segment.org;
|
||||
auto &data = segment.data;
|
||||
|
||||
for (auto &r : segment.relocs) {
|
||||
@ -494,6 +495,7 @@ void save_object(const std::string &path, omf::segment &s, uint32_t length) {
|
||||
h.segnum = 0;
|
||||
h.alignment = s.alignment;
|
||||
h.reserved_space = s.reserved_space;
|
||||
h.org = s.org;
|
||||
|
||||
std::vector<uint8_t> data;
|
||||
|
||||
@ -560,6 +562,7 @@ void save_omf(const std::string &path, std::vector<omf::segment> &segments, bool
|
||||
h.segnum = s.segnum;
|
||||
h.alignment = s.alignment;
|
||||
h.reserved_space = s.reserved_space;
|
||||
h.org = s.org;
|
||||
|
||||
uint32_t reserved_space = 0;
|
||||
if (expressload) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user