Elf: Rename SEG_ALIGN to SEC_FILEALIGN

It's Elf specifics. To not mess with segment alignment.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
This commit is contained in:
Cyrill Gorcunov 2010-04-20 15:05:02 +04:00
parent 8d4d060104
commit d807d911fe
3 changed files with 8 additions and 7 deletions

View File

@ -45,7 +45,8 @@
#define GLOBAL_TEMP_BASE 0x40000000 /* bigger than any sane symbol index */ #define GLOBAL_TEMP_BASE 0x40000000 /* bigger than any sane symbol index */
#define SEG_ALIGN 16 /* alignment of sections in file */ /* alignment of sections in file */
#define SEC_FILEALIGN 16
/* this stuff is needed for the stabs debugging format */ /* this stuff is needed for the stabs debugging format */
#define TY_STABSSYMLIN 0x40 /* ouch */ #define TY_STABSSYMLIN 0x40 /* ouch */

View File

@ -975,7 +975,7 @@ static void elf_write(void)
*/ */
elf_foffs = 0x40 + 0x28 * nsections; elf_foffs = 0x40 + 0x28 * nsections;
align = ALIGN(elf_foffs, SEG_ALIGN) - elf_foffs; align = ALIGN(elf_foffs, SEC_FILEALIGN) - elf_foffs;
elf_foffs += align; elf_foffs += align;
elf_nsect = 0; elf_nsect = 0;
elf_sects = nasm_malloc(sizeof(*elf_sects) * nsections); elf_sects = nasm_malloc(sizeof(*elf_sects) * nsections);
@ -1275,7 +1275,7 @@ static void elf_section_header(int name, int type, int flags,
fwriteint32_t(type == 0 ? 0L : elf_foffs, ofile); fwriteint32_t(type == 0 ? 0L : elf_foffs, ofile);
fwriteint32_t(datalen, ofile); fwriteint32_t(datalen, ofile);
if (data) if (data)
elf_foffs += ALIGN(datalen, SEG_ALIGN); elf_foffs += ALIGN(datalen, SEC_FILEALIGN);
fwriteint32_t((int32_t)link, ofile); fwriteint32_t((int32_t)link, ofile);
fwriteint32_t((int32_t)info, ofile); fwriteint32_t((int32_t)info, ofile);
fwriteint32_t((int32_t)align, ofile); fwriteint32_t((int32_t)align, ofile);
@ -1288,7 +1288,7 @@ static void elf_write_sections(void)
for (i = 0; i < elf_nsect; i++) for (i = 0; i < elf_nsect; i++)
if (elf_sects[i].data) { if (elf_sects[i].data) {
int32_t len = elf_sects[i].len; int32_t len = elf_sects[i].len;
int32_t reallen = ALIGN(len, SEG_ALIGN); int32_t reallen = ALIGN(len, SEC_FILEALIGN);
int32_t align = reallen - len; int32_t align = reallen - len;
if (elf_sects[i].is_saa) if (elf_sects[i].is_saa)
saa_fpwrite(elf_sects[i].data, ofile); saa_fpwrite(elf_sects[i].data, ofile);

View File

@ -1074,7 +1074,7 @@ static void elf_write(void)
*/ */
elf_foffs = 0x40 + sizeof(Elf64_Shdr) * nsections; elf_foffs = 0x40 + sizeof(Elf64_Shdr) * nsections;
align = ALIGN(elf_foffs, SEG_ALIGN) - elf_foffs; align = ALIGN(elf_foffs, SEC_FILEALIGN) - elf_foffs;
elf_foffs += align; elf_foffs += align;
elf_nsect = 0; elf_nsect = 0;
elf_sects = nasm_malloc(sizeof(*elf_sects) * nsections); elf_sects = nasm_malloc(sizeof(*elf_sects) * nsections);
@ -1371,7 +1371,7 @@ static void elf_section_header(int name, int type, uint64_t flags,
fwriteint64_t(type == 0 ? 0L : elf_foffs, ofile); fwriteint64_t(type == 0 ? 0L : elf_foffs, ofile);
fwriteint64_t(datalen, ofile); fwriteint64_t(datalen, ofile);
if (data) if (data)
elf_foffs += ALIGN(datalen, SEG_ALIGN); elf_foffs += ALIGN(datalen, SEC_FILEALIGN);
fwriteint32_t((int32_t)link, ofile); fwriteint32_t((int32_t)link, ofile);
fwriteint32_t((int32_t)info, ofile); fwriteint32_t((int32_t)info, ofile);
fwriteint64_t((int64_t)align, ofile); fwriteint64_t((int64_t)align, ofile);
@ -1384,7 +1384,7 @@ static void elf_write_sections(void)
for (i = 0; i < elf_nsect; i++) for (i = 0; i < elf_nsect; i++)
if (elf_sects[i].data) { if (elf_sects[i].data) {
int32_t len = elf_sects[i].len; int32_t len = elf_sects[i].len;
int32_t reallen = ALIGN(len, SEG_ALIGN); int32_t reallen = ALIGN(len, SEC_FILEALIGN);
int32_t align = reallen - len; int32_t align = reallen - len;
if (elf_sects[i].is_saa) if (elf_sects[i].is_saa)
saa_fpwrite(elf_sects[i].data, ofile); saa_fpwrite(elf_sects[i].data, ofile);