mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-08-06 13:58:40 +00:00
validate section flags on merge
This commit is contained in:
committed by
Ryan Fleury
parent
cccbbfc74c
commit
3c4edba465
@@ -284,7 +284,7 @@ lnk_section_table_merge(LNK_SectionTable *sectab, LNK_MergeDirectiveList merge_l
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// handle case where destination section doesn't exist
|
// push a new section if the destination section does not exist
|
||||||
if (dst_matches.count == 0) {
|
if (dst_matches.count == 0) {
|
||||||
dst = lnk_section_table_push(sectab, merge->dst, src_matches.v[0]->flags);
|
dst = lnk_section_table_push(sectab, merge->dst, src_matches.v[0]->flags);
|
||||||
} else {
|
} else {
|
||||||
@@ -295,6 +295,11 @@ lnk_section_table_merge(LNK_SectionTable *sectab, LNK_MergeDirectiveList merge_l
|
|||||||
for (U64 src_idx = 0; src_idx < src_matches.count; src_idx += 1) {
|
for (U64 src_idx = 0; src_idx < src_matches.count; src_idx += 1) {
|
||||||
LNK_Section *src = src_matches.v[src_idx];
|
LNK_Section *src = src_matches.v[src_idx];
|
||||||
|
|
||||||
|
if (src->flags != dst->flags) {
|
||||||
|
lnk_error(LNK_Warning_AmbiguousMerge, "unable to merge %S=%S because of conflicting section flags", merge->src, merge->dst);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// merge section with destination
|
// merge section with destination
|
||||||
lnk_section_contrib_chunk_list_concat_in_place(&dst->contribs, &src->contribs);
|
lnk_section_contrib_chunk_list_concat_in_place(&dst->contribs, &src->contribs);
|
||||||
src->merge_dst = dst;
|
src->merge_dst = dst;
|
||||||
|
|||||||
Reference in New Issue
Block a user