From 5a1ce6162b4090cd320459cd77e2e4cd209ad1cc Mon Sep 17 00:00:00 2001 From: nickysn Date: Mon, 20 Apr 2015 01:27:26 +0000 Subject: [PATCH] * set the bss, rodata and rodata_norel section alignment to 2 bytes for the i8086-msdos target git-svn-id: trunk@30680 - --- compiler/ogomf.pas | 5 +++-- compiler/x86/agx86nsm.pas | 6 +++--- rtl/msdos/prt0comn.asm | 4 ++-- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/compiler/ogomf.pas b/compiler/ogomf.pas index 4fcc0e0c29..082c7ab112 100644 --- a/compiler/ogomf.pas +++ b/compiler/ogomf.pas @@ -329,9 +329,10 @@ implementation result:=1; sec_code: result:=1; + sec_data, + sec_rodata, + sec_rodata_norel, sec_bss: - result:=1; - sec_data: result:=2; { For idata (at least idata2) it must be 4 bytes, because an entry is always (also in win64) 20 bytes and aligning diff --git a/compiler/x86/agx86nsm.pas b/compiler/x86/agx86nsm.pas index 552d4eb263..51d02511ad 100644 --- a/compiler/x86/agx86nsm.pas +++ b/compiler/x86/agx86nsm.pas @@ -1081,11 +1081,11 @@ interface AsmWriteLn('SECTION ' + CodeSectionName(current_module.modulename^) + ' use16 class=code'); { NASM complains if you put a missing section in the GROUP directive, so } { we add empty declarations to make sure they exist, even if empty } - AsmWriteLn('SECTION .rodata class=data'); - AsmWriteLn('SECTION .data class=data'); + AsmWriteLn('SECTION .rodata class=data align=2'); + AsmWriteLn('SECTION .data class=data align=2'); AsmWriteLn('SECTION .fpc class=data'); { WLINK requires class=bss in order to leave the BSS section out of the executable } - AsmWriteLn('SECTION .bss class=bss'); + AsmWriteLn('SECTION .bss class=bss align=2'); if (current_settings.x86memorymodel<>mm_tiny) and (current_settings.x86memorymodel in x86_near_data_models) then AsmWriteLn('SECTION stack stack class=stack align=16'); diff --git a/rtl/msdos/prt0comn.asm b/rtl/msdos/prt0comn.asm index 666b2873fb..94bfc7e4d4 100644 --- a/rtl/msdos/prt0comn.asm +++ b/rtl/msdos/prt0comn.asm @@ -489,7 +489,7 @@ FPC_CHECK_NULLAREA: %endif %endif - segment data class=data + segment data class=data align=2 %ifdef __NEAR_DATA__ mem_realloc_err_msg: db 'Memory allocation error', 13, 10, '$' @@ -500,7 +500,7 @@ not_enough_mem_msg: ; module, containing the heap segment doesn't get smartlinked away dd ___heap - segment bss class=bss + segment bss class=bss align=2 %ifndef __TINY__ segment _NULL align=16 class=BEGDATA