You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(208) |
Jun
(43) |
Jul
|
Aug
(2) |
Sep
(17) |
Oct
|
Nov
(4) |
Dec
(9) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
|
Feb
(11) |
Mar
(3) |
Apr
(2) |
May
|
Jun
(3) |
Jul
(29) |
Aug
(29) |
Sep
(48) |
Oct
|
Nov
|
Dec
(5) |
2004 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
2005 |
Jan
(12) |
Feb
(1) |
Mar
(1) |
Apr
|
May
(1) |
Jun
(2) |
Jul
|
Aug
|
Sep
(4) |
Oct
(3) |
Nov
(1) |
Dec
(2) |
2006 |
Jan
(1) |
Feb
(2) |
Mar
(1) |
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
(1) |
Sep
(2) |
Oct
(21) |
Nov
(25) |
Dec
(16) |
2007 |
Jan
(26) |
Feb
(26) |
Mar
(18) |
Apr
(51) |
May
(45) |
Jun
(26) |
Jul
(6) |
Aug
(85) |
Sep
(161) |
Oct
(111) |
Nov
(83) |
Dec
(18) |
2008 |
Jan
(31) |
Feb
(27) |
Mar
|
Apr
(16) |
May
(142) |
Jun
(136) |
Jul
(51) |
Aug
(21) |
Sep
(47) |
Oct
(428) |
Nov
(19) |
Dec
(6) |
2009 |
Jan
(11) |
Feb
(37) |
Mar
(17) |
Apr
(15) |
May
(13) |
Jun
(61) |
Jul
(127) |
Aug
(15) |
Sep
(22) |
Oct
(28) |
Nov
(37) |
Dec
(10) |
2010 |
Jan
(18) |
Feb
(22) |
Mar
(10) |
Apr
(41) |
May
|
Jun
(48) |
Jul
(61) |
Aug
(54) |
Sep
(34) |
Oct
(15) |
Nov
(49) |
Dec
(11) |
2011 |
Jan
|
Feb
(24) |
Mar
(10) |
Apr
(9) |
May
|
Jun
(33) |
Jul
(41) |
Aug
(20) |
Sep
|
Oct
|
Nov
|
Dec
|
2012 |
Jan
|
Feb
(86) |
Mar
(12) |
Apr
|
May
(10) |
Jun
|
Jul
(9) |
Aug
(4) |
Sep
(11) |
Oct
(3) |
Nov
(3) |
Dec
(10) |
2013 |
Jan
(1) |
Feb
(23) |
Mar
(15) |
Apr
(7) |
May
(20) |
Jun
(3) |
Jul
(15) |
Aug
|
Sep
(29) |
Oct
(16) |
Nov
(69) |
Dec
(18) |
2014 |
Jan
|
Feb
(8) |
Mar
|
Apr
|
May
(16) |
Jun
(7) |
Jul
|
Aug
(5) |
Sep
(2) |
Oct
(4) |
Nov
(25) |
Dec
(8) |
2015 |
Jan
(6) |
Feb
(6) |
Mar
|
Apr
(1) |
May
(2) |
Jun
(1) |
Jul
(7) |
Aug
|
Sep
(2) |
Oct
(1) |
Nov
(6) |
Dec
|
2016 |
Jan
(12) |
Feb
(97) |
Mar
(57) |
Apr
(52) |
May
(33) |
Jun
(1) |
Jul
(1) |
Aug
|
Sep
|
Oct
(3) |
Nov
(3) |
Dec
|
2017 |
Jan
(4) |
Feb
|
Mar
(23) |
Apr
(5) |
May
|
Jun
(2) |
Jul
(3) |
Aug
(2) |
Sep
|
Oct
(6) |
Nov
(3) |
Dec
(3) |
2018 |
Jan
(4) |
Feb
(11) |
Mar
|
Apr
(1) |
May
(3) |
Jun
(6) |
Jul
|
Aug
(5) |
Sep
(5) |
Oct
(36) |
Nov
(128) |
Dec
(18) |
2019 |
Jan
|
Feb
|
Mar
(1) |
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2020 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(24) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: nasm-bot f. C. G. <gor...@gm...> - 2017-03-18 12:18:26
|
Commit-ID: 3a994a92ccb23022a6313f025cd10698e83188f7 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=3a994a92ccb23022a6313f025cd10698e83188f7 Author: Cyrill Gorcunov <gor...@gm...> AuthorDate: Wed, 8 Mar 2017 16:48:00 +0300 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Sat, 18 Mar 2017 15:16:10 +0300 output: Elf -- Start using ElfX_Ehdr instead of opencoded writes This should be more convenient. At least both headers are well documented in specifications so we simply follow them. Signed-off-by: Cyrill Gorcunov <gor...@gm...> --- output/outelf.c | 90 +++++++++++++++++++++++++++++++++------------------------ 1 file changed, 52 insertions(+), 38 deletions(-) diff --git a/output/outelf.c b/output/outelf.c index d99a49b..3c90ac3 100644 --- a/output/outelf.c +++ b/output/outelf.c @@ -1610,46 +1610,60 @@ static void elf_write(void) * Output the ELF header. */ if (is_elf32() || is_elfx32()) { - nasm_write("\177ELF\1\1\1", 7, ofile); - fputc(elf_osabi, ofile); - fputc(elf_abiver, ofile); - fwritezero(7, ofile); - fwriteint16_t(ET_REL, ofile); /* relocatable file */ - fwriteint16_t(is_elf32() ? EM_386 : EM_X86_64, ofile); /* processor ID */ - fwriteint32_t(1L, ofile); /* EV_CURRENT file format version */ - fwriteint32_t(0L, ofile); /* no entry point */ - fwriteint32_t(0L, ofile); /* no program header table */ - fwriteint32_t(0x40L, ofile); /* section headers straight after ELF header plus alignment */ - fwriteint32_t(0L, ofile); /* no special flags */ - fwriteint16_t(0x34, ofile); /* size of ELF header */ - fwriteint16_t(0, ofile); /* no program header table, again */ - fwriteint16_t(0, ofile); /* still no program header table */ - fwriteint16_t(sizeof(Elf32_Shdr), ofile); /* size of section header */ - fwriteint16_t(nsections, ofile); /* number of sections */ - fwriteint16_t(sec_shstrtab, ofile); /* string table section index for section header table */ - - fwriteint32_t(0L, ofile); /* align to 0x40 bytes */ - fwriteint32_t(0L, ofile); - fwriteint32_t(0L, ofile); + Elf32_Ehdr ehdr; + + nasm_zero(&ehdr.e_ident); + memcpy(ehdr.e_ident, ELFMAG, SELFMAG); + ehdr.e_ident[EI_CLASS] = char_le(ELFCLASS32); + ehdr.e_ident[EI_DATA] = char_le(ELFDATA2LSB); + ehdr.e_ident[EI_VERSION] = char_le(EV_CURRENT); + ehdr.e_ident[EI_OSABI] = char_le(elf_osabi); + ehdr.e_ident[EI_ABIVERSION] = char_le(elf_abiver); + + ehdr.e_type = short_le(ET_REL); + ehdr.e_machine = short_le(is_elf32() ? EM_386 : EM_X86_64); + ehdr.e_version = short_le(EV_CURRENT); + ehdr.e_entry = 0; + ehdr.e_phoff = 0; + ehdr.e_shoff = sizeof(Elf64_Ehdr); + ehdr.e_flags = 0; + ehdr.e_ehsize = short_le(sizeof(Elf32_Ehdr)); + ehdr.e_phentsize = 0; + ehdr.e_phnum = 0; + ehdr.e_shentsize = short_le(sizeof(Elf32_Shdr)); + ehdr.e_shnum = short_le(nsections); + ehdr.e_shstrndx = short_le(sec_shstrtab); + + nasm_write(&ehdr, sizeof(ehdr), ofile); + fwritezero(sizeof(Elf64_Ehdr) - sizeof(Elf32_Ehdr), ofile); } else { + Elf64_Ehdr ehdr; + nasm_assert(is_elf64()); - nasm_write("\177ELF\2\1\1", 7, ofile); - fputc(elf_osabi, ofile); - fputc(elf_abiver, ofile); - fwritezero(7, ofile); - fwriteint16_t(ET_REL, ofile); /* relocatable file */ - fwriteint16_t(EM_X86_64, ofile); /* processor ID */ - fwriteint32_t(1L, ofile); /* EV_CURRENT file format version */ - fwriteint64_t(0L, ofile); /* no entry point */ - fwriteint64_t(0L, ofile); /* no program header table */ - fwriteint64_t(0x40L, ofile); /* section headers straight after ELF header plus alignment */ - fwriteint32_t(0L, ofile); /* no special flags */ - fwriteint16_t(0x40, ofile); /* size of ELF header */ - fwriteint16_t(0, ofile); /* no program header table, again */ - fwriteint16_t(0, ofile); /* still no program header table */ - fwriteint16_t(sizeof(Elf64_Shdr), ofile); /* size of section header */ - fwriteint16_t(nsections, ofile); /* number of sections */ - fwriteint16_t(sec_shstrtab, ofile); /* string table section index for section header table */ + + nasm_zero(&ehdr.e_ident); + memcpy(ehdr.e_ident, ELFMAG, SELFMAG); + ehdr.e_ident[EI_CLASS] = char_le(ELFCLASS64); + ehdr.e_ident[EI_DATA] = char_le(ELFDATA2LSB); + ehdr.e_ident[EI_VERSION] = char_le(EV_CURRENT); + ehdr.e_ident[EI_OSABI] = char_le(elf_osabi); + ehdr.e_ident[EI_ABIVERSION] = char_le(elf_abiver); + + ehdr.e_type = short_le(ET_REL); + ehdr.e_machine = short_le(EM_X86_64); + ehdr.e_version = short_le(EV_CURRENT); + ehdr.e_entry = 0; + ehdr.e_phoff = 0; + ehdr.e_shoff = sizeof(Elf64_Ehdr); + ehdr.e_flags = 0; + ehdr.e_ehsize = short_le(sizeof(Elf64_Ehdr)); + ehdr.e_phentsize = 0; + ehdr.e_phnum = 0; + ehdr.e_shentsize = short_le(sizeof(Elf64_Shdr)); + ehdr.e_shnum = short_le(nsections); + ehdr.e_shstrndx = short_le(sec_shstrtab); + + nasm_write(&ehdr, sizeof(ehdr), ofile); } /* |
From: nasm-bot f. C. G. <gor...@gm...> - 2017-03-18 12:18:25
|
Commit-ID: a95a8e6d7f39a965ac57dc205214e2cf97828c8c Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=a95a8e6d7f39a965ac57dc205214e2cf97828c8c Author: Cyrill Gorcunov <gor...@gm...> AuthorDate: Sun, 12 Mar 2017 17:39:55 +0300 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Sat, 18 Mar 2017 15:16:10 +0300 output: elf -- Add ELF32_R_INFO, ELF64_R_INFO helpers Signed-off-by: Cyrill Gorcunov <gor...@gm...> --- output/elf.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/output/elf.h b/output/elf.h index 4ae818a..32f5b47 100644 --- a/output/elf.h +++ b/output/elf.h @@ -317,6 +317,7 @@ typedef struct elf64_dyn { #define ELF32_R_SYM(x) ((x) >> 8) #define ELF32_R_TYPE(x) ((x) & 0xff) +#define ELF32_R_INFO(s,t) (((Elf32_Word)(s) << 8) + ELF32_R_TYPE(t)) typedef struct elf32_rel { Elf32_Addr r_offset; @@ -351,6 +352,7 @@ enum reloc32_type { #define ELF64_R_SYM(x) ((x) >> 32) #define ELF64_R_TYPE(x) ((x) & 0xffffffff) +#define ELF64_R_INFO(s,t) (((Elf64_Xword)(s) << 32) + ELF64_R_TYPE(t)) typedef struct elf64_rel { Elf64_Addr r_offset; |
From: nasm-bot f. C. G. <gor...@gm...> - 2017-03-18 12:18:24
|
Commit-ID: 2f038e9d5d47eed9ac35c85073b2f8a125b64ffe Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=2f038e9d5d47eed9ac35c85073b2f8a125b64ffe Author: Cyrill Gorcunov <gor...@gm...> AuthorDate: Wed, 8 Mar 2017 13:03:52 +0300 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Sat, 18 Mar 2017 15:16:10 +0300 nasmlib: Add _le helpers Signed-off-by: Cyrill Gorcunov <gor...@gm...> --- include/nasmlib.h | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/include/nasmlib.h b/include/nasmlib.h index 8df71bc..c705b50 100644 --- a/include/nasmlib.h +++ b/include/nasmlib.h @@ -249,6 +249,11 @@ void standard_extension(char *inname, char *outname, char *extension); #if X86_MEMORY +static inline uint8_t char_le(uint8_t v) { return v; } +static inline uint16_t short_le(uint16_t v) { return v; } +static inline uint32_t long_le(uint32_t v) { return v; } +static inline uint64_t dlong_le(uint64_t v) { return v; } + #define WRITECHAR(p,v) \ do { \ *(uint8_t *)(p) = (v); \ @@ -282,6 +287,32 @@ void standard_extension(char *inname, char *outname, char *extension); #else /* !X86_MEMORY */ +static inline uint8_t char_le(uint8_t v) +{ + return v; +} + +static inline uint16_t short_le(uint16_t v) +{ + return (v << 8) | (v >> 8); +} + +static inline uint32_t long_le(uint32_t v) +{ + v = ((v << 8) & 0xff00ff00 ) | + ((v >> 8) & 0x00ff00ff); + return (v << 16) | (v >> 16); +} + +static inline uint64_t dlong_le(uint64_t v) +{ + v = ((v << 8) & 0xff00ff00ff00ff00ull) | + ((v >> 8) & 0x00ff00ff00ff00ffull); + v = ((v << 16) & 0xffff0000ffff0000ull) | + ((v >> 16) & 0x0000ffff0000ffffull); + return (v << 32) | (v >> 32); +} + #define WRITECHAR(p,v) \ do { \ uint8_t *_wc_p = (uint8_t *)(p); \ |
From: nasm-bot f. C. G. <gor...@gm...> - 2017-03-12 21:39:24
|
Commit-ID: e07a0ab548e21d00726114b2f7bb101e98488809 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=e07a0ab548e21d00726114b2f7bb101e98488809 Author: Cyrill Gorcunov <gor...@gm...> AuthorDate: Sun, 12 Mar 2017 17:39:55 +0300 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Sun, 12 Mar 2017 17:39:55 +0300 output: elf -- Add ELF32_R_INFO, ELF64_R_INFO helpers Signed-off-by: Cyrill Gorcunov <gor...@gm...> --- output/elf.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/output/elf.h b/output/elf.h index 4ae818a..32f5b47 100644 --- a/output/elf.h +++ b/output/elf.h @@ -317,6 +317,7 @@ typedef struct elf64_dyn { #define ELF32_R_SYM(x) ((x) >> 8) #define ELF32_R_TYPE(x) ((x) & 0xff) +#define ELF32_R_INFO(s,t) (((Elf32_Word)(s) << 8) + ELF32_R_TYPE(t)) typedef struct elf32_rel { Elf32_Addr r_offset; @@ -351,6 +352,7 @@ enum reloc32_type { #define ELF64_R_SYM(x) ((x) >> 32) #define ELF64_R_TYPE(x) ((x) & 0xffffffff) +#define ELF64_R_INFO(s,t) (((Elf64_Xword)(s) << 32) + ELF64_R_TYPE(t)) typedef struct elf64_rel { Elf64_Addr r_offset; |
From: nasm-bot f. C. G. <gor...@gm...> - 2017-03-12 21:39:24
|
Commit-ID: 16d1018e44c4168f2100f604518a25e15fc0504c Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=16d1018e44c4168f2100f604518a25e15fc0504c Author: Cyrill Gorcunov <gor...@gm...> AuthorDate: Wed, 8 Mar 2017 21:32:54 +0300 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Sun, 12 Mar 2017 11:41:44 +0300 elf: Switch writting sections with Elf structs The target of all this code rework is to start using general backend engine with native Elf types behind. Signed-off-by: Cyrill Gorcunov <gor...@gm...> --- output/outelf.c | 48 ++++++++++++++++++++++++++++-------------------- 1 file changed, 28 insertions(+), 20 deletions(-) diff --git a/output/outelf.c b/output/outelf.c index a4f8283..2177a12 100644 --- a/output/outelf.c +++ b/output/outelf.c @@ -2127,39 +2127,47 @@ static void elf_section_header(int name, int type, uint64_t flags, void *data, bool is_saa, uint64_t datalen, int link, int info, int align, int eltsize) { + union { + Elf32_Shdr shdr32; + Elf64_Shdr shdr64; + } shdr; + elf_sects[elf_nsect].data = data; elf_sects[elf_nsect].len = datalen; elf_sects[elf_nsect].is_saa = is_saa; elf_nsect++; if (is_elf32() || is_elfx32()) { - fwriteint32_t((int32_t)name, ofile); - fwriteint32_t((int32_t)type, ofile); - fwriteint32_t((int32_t)flags, ofile); - fwriteint32_t(0L, ofile); /* no address, ever, in object files */ - fwriteint32_t(type == 0 ? 0L : elf_foffs, ofile); - fwriteint32_t(datalen, ofile); + shdr.shdr32.sh_name = long_le(name); + shdr.shdr32.sh_type = long_le(type); + shdr.shdr32.sh_flags = long_le(flags); + shdr.shdr32.sh_addr = 0; + shdr.shdr32.sh_offset = long_le(type == SHT_NULL ? 0 : elf_foffs); + shdr.shdr32.sh_size = long_le(datalen); if (data) elf_foffs += ALIGN(datalen, SEC_FILEALIGN); - fwriteint32_t((int32_t)link, ofile); - fwriteint32_t((int32_t)info, ofile); - fwriteint32_t((int32_t)align, ofile); - fwriteint32_t((int32_t)eltsize, ofile); + shdr.shdr32.sh_link = long_le(link); + shdr.shdr32.sh_info = long_le(info); + shdr.shdr32.sh_addralign = long_le(align); + shdr.shdr32.sh_entsize = long_le(eltsize); } else { nasm_assert(is_elf64()); - fwriteint32_t((int32_t)name, ofile); - fwriteint32_t((int32_t)type, ofile); - fwriteint64_t((int64_t)flags, ofile); - fwriteint64_t(0L, ofile); /* no address, ever, in object files */ - fwriteint64_t(type == 0 ? 0L : elf_foffs, ofile); - fwriteint64_t(datalen, ofile); + + shdr.shdr64.sh_name = long_le(name); + shdr.shdr64.sh_type = long_le(type); + shdr.shdr64.sh_flags = dlong_le(flags); + shdr.shdr64.sh_addr = 0; + shdr.shdr64.sh_offset = dlong_le(type == SHT_NULL ? 0 : elf_foffs); + shdr.shdr64.sh_size = long_le(datalen); if (data) elf_foffs += ALIGN(datalen, SEC_FILEALIGN); - fwriteint32_t((int32_t)link, ofile); - fwriteint32_t((int32_t)info, ofile); - fwriteint64_t((int64_t)align, ofile); - fwriteint64_t((int64_t)eltsize, ofile); + shdr.shdr64.sh_link = long_le(link); + shdr.shdr64.sh_info = long_le(info); + shdr.shdr64.sh_addralign = dlong_le(align); + shdr.shdr64.sh_entsize = dlong_le(eltsize); } + + nasm_write(&shdr, is_elf64() ? sizeof(shdr.shdr64) : sizeof(shdr.shdr32), ofile); } static void elf_write_sections(void) |
From: nasm-bot f. C. G. <gor...@gm...> - 2017-03-12 21:39:24
|
Commit-ID: 209d62e564611e1087f4bc244ac929856d0016fe Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=209d62e564611e1087f4bc244ac929856d0016fe Author: Cyrill Gorcunov <gor...@gm...> AuthorDate: Sun, 12 Mar 2017 17:42:09 +0300 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Sun, 12 Mar 2017 17:42:09 +0300 output: elf -- Use ElfX_Relx in elf_build_reltab Signed-off-by: Cyrill Gorcunov <gor...@gm...> --- output/outelf.c | 41 ++++++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/output/outelf.c b/output/outelf.c index f6502fe..612e449 100644 --- a/output/outelf.c +++ b/output/outelf.c @@ -2053,9 +2053,16 @@ static struct SAA *elf_build_symtab(int32_t *len, int32_t *local) static struct SAA *elf_build_reltab(uint64_t *len, struct elf_reloc *r) { struct SAA *s; - uint8_t *p, entry[24]; int32_t global_offset; + size_t usize = is_elf64() ? sizeof(Elf64_Rela) : + (is_elfx32() ? sizeof(Elf32_Rela) : sizeof(Elf32_Rel)); + union { + Elf32_Rel rel32; + Elf32_Rela rela32; + Elf64_Rela rela64; + } u; + if (!r) return NULL; @@ -2076,11 +2083,10 @@ static struct SAA *elf_build_reltab(uint64_t *len, struct elf_reloc *r) if (sym >= GLOBAL_TEMP_BASE) sym += global_offset; - p = entry; - WRITELONG(p, r->address); - WRITELONG(p, (sym << 8) + r->type); - saa_wbytes(s, entry, 8L); - *len += 8; + u.rel32.r_offset = long_le(r->address); + u.rel32.r_info = long_le(ELF32_R_INFO(sym, r->type)); + saa_wbytes(s, &u, usize); + *len += usize; r = r->next; } @@ -2091,12 +2097,11 @@ static struct SAA *elf_build_reltab(uint64_t *len, struct elf_reloc *r) if (sym >= GLOBAL_TEMP_BASE) sym += global_offset; - p = entry; - WRITELONG(p, r->address); - WRITELONG(p, (sym << 8) + r->type); - WRITELONG(p, r->offset); - saa_wbytes(s, entry, 12L); - *len += 12; + u.rela32.r_offset = long_le(r->address); + u.rela32.r_info = long_le(ELF32_R_INFO(sym, r->type)); + u.rela32.r_addend = long_le(r->offset); + saa_wbytes(s, &u, usize); + *len += usize; r = r->next; } @@ -2108,13 +2113,11 @@ static struct SAA *elf_build_reltab(uint64_t *len, struct elf_reloc *r) if (sym >= GLOBAL_TEMP_BASE) sym += global_offset; - p = entry; - WRITEDLONG(p, r->address); - WRITELONG(p, r->type); - WRITELONG(p, sym); - WRITEDLONG(p, r->offset); - saa_wbytes(s, entry, 24L); - *len += 24; + u.rela64.r_offset = dlong_le(r->address); + u.rela64.r_info = dlong_le(ELF64_R_INFO(sym, r->type)); + u.rela64.r_addend = dlong_le(r->offset); + saa_wbytes(s, &u, usize); + *len += usize; r = r->next; } |
From: nasm-bot f. C. G. <gor...@gm...> - 2017-03-12 21:39:24
|
Commit-ID: ca82049da49488effea4586a07a7568275bbb4b9 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=ca82049da49488effea4586a07a7568275bbb4b9 Author: Cyrill Gorcunov <gor...@gm...> AuthorDate: Sun, 12 Mar 2017 17:24:28 +0300 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Sun, 12 Mar 2017 17:24:28 +0300 output: elf -- Start using ElfX_Sym in elf_build_symtab Signed-off-by: Cyrill Gorcunov <gor...@gm...> --- output/outelf.c | 242 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 121 insertions(+), 121 deletions(-) diff --git a/output/outelf.c b/output/outelf.c index 2177a12..f6502fe 100644 --- a/output/outelf.c +++ b/output/outelf.c @@ -1839,68 +1839,72 @@ static struct SAA *elf_build_symtab(int32_t *len, int32_t *local) { struct SAA *s = saa_init(1L); struct elf_symbol *sym; - uint8_t entry[24], *p; int i; + size_t usize = is_elf64() ? sizeof(Elf64_Sym) : sizeof(Elf32_Sym); + union { + Elf32_Sym sym32; + Elf64_Sym sym64; + } u; + *len = *local = 0; /* - * First, an all-zeros entry, required by the ELF spec. + * Zero symbol first as required by spec. */ - saa_wbytes(s, NULL, is_elf64() ? 24L : 16L); /* null symbol table entry */ - *len += is_elf64() ? 24L : 16L; + saa_wbytes(s, NULL, usize); + *len += usize; (*local)++; /* * Next, an entry for the file name. */ - p = entry; if (is_elf64()) { - WRITELONG(p, 1); /* we know it's 1st entry in strtab */ - WRITESHORT(p, STT_FILE); /* type FILE */ - WRITESHORT(p, SHN_ABS); - WRITEDLONG(p, (uint64_t) 0); /* no value */ - WRITEDLONG(p, (uint64_t) 0); /* no size either */ - saa_wbytes(s, entry, 24L); - *len += 24; - (*local)++; + u.sym64.st_name = long_le(1); + u.sym64.st_info = char_le(ELF64_ST_INFO(STB_LOCAL, STT_FILE)); + u.sym64.st_other = 0; + u.sym64.st_shndx = short_le(SHN_ABS); + u.sym64.st_value = 0; + u.sym64.st_size = 0; } else { - WRITELONG(p, 1); /* we know it's 1st entry in strtab */ - WRITELONG(p, 0); /* no value */ - WRITELONG(p, 0); /* no size either */ - WRITESHORT(p, STT_FILE); /* type FILE */ - WRITESHORT(p, SHN_ABS); - saa_wbytes(s, entry, 16L); - *len += 16; - (*local)++; + u.sym32.st_name = long_le(1); + u.sym32.st_value = 0; + u.sym32.st_size = 0; + u.sym32.st_info = char_le(ELF32_ST_INFO(STB_LOCAL, STT_FILE)); + u.sym32.st_other = 0; + u.sym32.st_shndx = short_le(SHN_ABS); } + saa_wbytes(s, &u, usize); + *len += usize; + (*local)++; + /* * Now some standard symbols defining the segments, for relocation * purposes. */ if (is_elf64()) { + u.sym64.st_name = 0; + u.sym64.st_other = 0; + u.sym64.st_value = 0; + u.sym64.st_size = 0; for (i = 1; i <= nsects; i++) { - p = entry; - WRITELONG(p, 0); /* no symbol name */ - WRITESHORT(p, STT_SECTION); /* type, binding, and visibility */ - WRITESHORT(p, i); /* section id */ - WRITEDLONG(p, (uint64_t) 0); /* offset zero */ - WRITEDLONG(p, (uint64_t) 0); /* size zero */ - saa_wbytes(s, entry, 24L); - *len += 24; + u.sym64.st_info = char_le(ELF64_ST_INFO(STB_LOCAL, STT_SECTION)); + u.sym64.st_shndx = short_le(i); + saa_wbytes(s, &u, usize); + *len += usize; (*local)++; } } else { + u.sym32.st_name = 0; + u.sym32.st_value = 0; + u.sym32.st_size = 0; + u.sym32.st_other = 0; for (i = 1; i <= nsects; i++) { - p = entry; - WRITELONG(p, 0); /* no symbol name */ - WRITELONG(p, 0); /* offset zero */ - WRITELONG(p, 0); /* size zero */ - WRITESHORT(p, STT_SECTION); /* type, binding, and visibility */ - WRITESHORT(p, i); /* section id */ - saa_wbytes(s, entry, 16L); - *len += 16; + u.sym32.st_info = char_le(ELF32_ST_INFO(STB_LOCAL, STT_SECTION)); + u.sym32.st_shndx = short_le(i); + saa_wbytes(s, &u, usize); + *len += usize; (*local)++; } } @@ -1913,15 +1917,14 @@ static struct SAA *elf_build_symtab(int32_t *len, int32_t *local) while ((sym = saa_rstruct(syms))) { if (sym->type & SYM_GLOBAL) continue; - p = entry; - WRITELONG(p, sym->strpos); /* index into symbol string table */ - WRITECHAR(p, sym->type); /* type and binding */ - WRITECHAR(p, sym->other); /* visibility */ - WRITESHORT(p, sym->section); /* index into section header table */ - WRITEDLONG(p, (int64_t)sym->symv.key); /* value of symbol */ - WRITEDLONG(p, (int64_t)sym->size); /* size of symbol */ - saa_wbytes(s, entry, 24L); - *len += 24; + u.sym64.st_name = long_le(sym->strpos); + u.sym64.st_info = char_le(sym->type); + u.sym64.st_other = char_le(sym->other); + u.sym64.st_shndx = short_le(sym->section); + u.sym64.st_value = dlong_le(sym->symv.key); + u.sym64.st_size = dlong_le(sym->size); + saa_wbytes(s, &u, usize); + *len += usize; (*local)++; } /* @@ -1930,49 +1933,48 @@ static struct SAA *elf_build_symtab(int32_t *len, int32_t *local) */ if (dfmt_is_dwarf()) { dwarf_infosym = *local; - p = entry; - WRITELONG(p, 0); /* no symbol name */ - WRITESHORT(p, STT_SECTION); /* type, binding, and visibility */ - WRITESHORT(p, debug_info); /* section id */ - WRITEDLONG(p, (uint64_t) 0); /* offset zero */ - WRITEDLONG(p, (uint64_t) 0); /* size zero */ - saa_wbytes(s, entry, 24L); - *len += 24; + u.sym64.st_name = 0; + u.sym64.st_info = char_le(ELF64_ST_INFO(STB_LOCAL, STT_SECTION)); + u.sym64.st_other = 0; + u.sym64.st_shndx = short_le(debug_info); + u.sym64.st_value = 0; + u.sym64.st_size = 0; + saa_wbytes(s, &u, usize); + *len += usize; (*local)++; dwarf_abbrevsym = *local; - p = entry; - WRITELONG(p, 0); /* no symbol name */ - WRITESHORT(p, STT_SECTION); /* type, binding, and visibility */ - WRITESHORT(p, debug_abbrev); /* section id */ - WRITEDLONG(p, (uint64_t) 0); /* offset zero */ - WRITEDLONG(p, (uint64_t) 0); /* size zero */ - saa_wbytes(s, entry, 24L); - *len += 24; + u.sym64.st_name = 0; + u.sym64.st_info = char_le(ELF64_ST_INFO(STB_LOCAL, STT_SECTION)); + u.sym64.st_other = 0; + u.sym64.st_shndx = short_le(debug_abbrev); + u.sym64.st_value = 0; + u.sym64.st_size = 0; + saa_wbytes(s, &u, usize); + *len += usize; (*local)++; dwarf_linesym = *local; - p = entry; - WRITELONG(p, 0); /* no symbol name */ - WRITESHORT(p, STT_SECTION); /* type, binding, and visibility */ - WRITESHORT(p, debug_line); /* section id */ - WRITEDLONG(p, (uint64_t) 0); /* offset zero */ - WRITEDLONG(p, (uint64_t) 0); /* size zero */ - saa_wbytes(s, entry, 24L); - *len += 24; + u.sym64.st_name = 0; + u.sym64.st_info = char_le(ELF64_ST_INFO(STB_LOCAL, STT_SECTION)); + u.sym64.st_other = 0; + u.sym64.st_shndx = short_le(debug_line); + u.sym64.st_value = 0; + u.sym64.st_size = 0; + saa_wbytes(s, &u, usize); + *len += usize; (*local)++; } } else { while ((sym = saa_rstruct(syms))) { if (sym->type & SYM_GLOBAL) continue; - p = entry; - WRITELONG(p, sym->strpos); - WRITELONG(p, sym->symv.key); - WRITELONG(p, sym->size); - WRITECHAR(p, sym->type); /* type and binding */ - WRITECHAR(p, sym->other); /* visibility */ - WRITESHORT(p, sym->section); - saa_wbytes(s, entry, 16L); - *len += 16; + u.sym32.st_name = long_le(sym->strpos); + u.sym32.st_value = long_le(sym->symv.key); + u.sym32.st_size = long_le(sym->size); + u.sym32.st_info = char_le(sym->type); + u.sym32.st_other = char_le(sym->other); + u.sym32.st_shndx = short_le(sym->section); + saa_wbytes(s, &u, usize); + *len += usize; (*local)++; } /* @@ -1981,34 +1983,34 @@ static struct SAA *elf_build_symtab(int32_t *len, int32_t *local) */ if (dfmt_is_dwarf()) { dwarf_infosym = *local; - p = entry; - WRITELONG(p, 0); /* no symbol name */ - WRITELONG(p, (uint32_t) 0); /* offset zero */ - WRITELONG(p, (uint32_t) 0); /* size zero */ - WRITESHORT(p, STT_SECTION); /* type, binding, and visibility */ - WRITESHORT(p, sec_debug_info); /* section id */ - saa_wbytes(s, entry, 16L); - *len += 16; + u.sym32.st_name = 0; + u.sym32.st_value = 0; + u.sym32.st_size = 0; + u.sym32.st_info = char_le(ELF32_ST_INFO(STB_LOCAL, STT_SECTION)); + u.sym32.st_other = 0; + u.sym32.st_shndx = short_le(sec_debug_info); + saa_wbytes(s, &u, usize); + *len += usize; (*local)++; dwarf_abbrevsym = *local; - p = entry; - WRITELONG(p, 0); /* no symbol name */ - WRITELONG(p, (uint32_t) 0); /* offset zero */ - WRITELONG(p, (uint32_t) 0); /* size zero */ - WRITESHORT(p, STT_SECTION); /* type, binding, and visibility */ - WRITESHORT(p, sec_debug_abbrev); /* section id */ - saa_wbytes(s, entry, 16L); - *len += 16; + u.sym32.st_name = 0; + u.sym32.st_value = 0; + u.sym32.st_size = 0; + u.sym32.st_info = char_le(ELF32_ST_INFO(STB_LOCAL, STT_SECTION)); + u.sym32.st_other = 0; + u.sym32.st_shndx = short_le(sec_debug_abbrev); + saa_wbytes(s, &u, usize); + *len += usize; (*local)++; dwarf_linesym = *local; - p = entry; - WRITELONG(p, 0); /* no symbol name */ - WRITELONG(p, (uint32_t) 0); /* offset zero */ - WRITELONG(p, (uint32_t) 0); /* size zero */ - WRITESHORT(p, STT_SECTION); /* type, binding, and visibility */ - WRITESHORT(p, sec_debug_line); /* section id */ - saa_wbytes(s, entry, 16L); - *len += 16; + u.sym32.st_name = 0; + u.sym32.st_value = 0; + u.sym32.st_size = 0; + u.sym32.st_info = char_le(ELF32_ST_INFO(STB_LOCAL, STT_SECTION)); + u.sym32.st_other = 0; + u.sym32.st_shndx = short_le(sec_debug_line); + saa_wbytes(s, &u, usize); + *len += usize; (*local)++; } } @@ -2021,29 +2023,27 @@ static struct SAA *elf_build_symtab(int32_t *len, int32_t *local) while ((sym = saa_rstruct(syms))) { if (!(sym->type & SYM_GLOBAL)) continue; - p = entry; - WRITELONG(p, sym->strpos); - WRITECHAR(p, sym->type); /* type and binding */ - WRITECHAR(p, sym->other); /* visibility */ - WRITESHORT(p, sym->section); - WRITEDLONG(p, (int64_t)sym->symv.key); - WRITEDLONG(p, (int64_t)sym->size); - saa_wbytes(s, entry, 24L); - *len += 24; + u.sym64.st_name = long_le(sym->strpos); + u.sym64.st_info = char_le(sym->type); + u.sym64.st_other = char_le(sym->other); + u.sym64.st_shndx = short_le(sym->section); + u.sym64.st_value = dlong_le(sym->symv.key); + u.sym64.st_size = dlong_le(sym->size); + saa_wbytes(s, &u, usize); + *len += usize; } } else { while ((sym = saa_rstruct(syms))) { if (!(sym->type & SYM_GLOBAL)) continue; - p = entry; - WRITELONG(p, sym->strpos); - WRITELONG(p, sym->symv.key); - WRITELONG(p, sym->size); - WRITECHAR(p, sym->type); /* type and binding */ - WRITECHAR(p, sym->other); /* visibility */ - WRITESHORT(p, sym->section); - saa_wbytes(s, entry, 16L); - *len += 16; + u.sym32.st_name = long_le(sym->strpos); + u.sym32.st_value = long_le(sym->symv.key); + u.sym32.st_size = long_le(sym->size); + u.sym32.st_info = char_le(sym->type); + u.sym32.st_other = char_le(sym->other); + u.sym32.st_shndx = short_le(sym->section); + saa_wbytes(s, &u, usize); + *len += usize; } } |
From: nasm-bot f. C. G. <gor...@gm...> - 2017-03-12 21:39:23
|
Commit-ID: 98b28cb3ff8877bb7a37d794160f3fdfa23e7cb1 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=98b28cb3ff8877bb7a37d794160f3fdfa23e7cb1 Author: Cyrill Gorcunov <gor...@gm...> AuthorDate: Wed, 8 Mar 2017 16:48:00 +0300 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Sun, 12 Mar 2017 11:41:44 +0300 output: Elf -- Start using ElfX_Ehdr instead of opencoded writes This should be more convenient. At least both headers are well documented in specifications so we simply follow them. Signed-off-by: Cyrill Gorcunov <gor...@gm...> --- output/outelf.c | 90 +++++++++++++++++++++++++++++++++------------------------ 1 file changed, 52 insertions(+), 38 deletions(-) diff --git a/output/outelf.c b/output/outelf.c index 8be97b3..a4f8283 100644 --- a/output/outelf.c +++ b/output/outelf.c @@ -1610,46 +1610,60 @@ static void elf_write(void) * Output the ELF header. */ if (is_elf32() || is_elfx32()) { - nasm_write("\177ELF\1\1\1", 7, ofile); - fputc(elf_osabi, ofile); - fputc(elf_abiver, ofile); - fwritezero(7, ofile); - fwriteint16_t(ET_REL, ofile); /* relocatable file */ - fwriteint16_t(is_elf32() ? EM_386 : EM_X86_64, ofile); /* processor ID */ - fwriteint32_t(1L, ofile); /* EV_CURRENT file format version */ - fwriteint32_t(0L, ofile); /* no entry point */ - fwriteint32_t(0L, ofile); /* no program header table */ - fwriteint32_t(0x40L, ofile); /* section headers straight after ELF header plus alignment */ - fwriteint32_t(0L, ofile); /* no special flags */ - fwriteint16_t(0x34, ofile); /* size of ELF header */ - fwriteint16_t(0, ofile); /* no program header table, again */ - fwriteint16_t(0, ofile); /* still no program header table */ - fwriteint16_t(sizeof(Elf32_Shdr), ofile); /* size of section header */ - fwriteint16_t(nsections, ofile); /* number of sections */ - fwriteint16_t(sec_shstrtab, ofile); /* string table section index for section header table */ - - fwriteint32_t(0L, ofile); /* align to 0x40 bytes */ - fwriteint32_t(0L, ofile); - fwriteint32_t(0L, ofile); + Elf32_Ehdr ehdr; + + nasm_zero(&ehdr.e_ident); + memcpy(ehdr.e_ident, ELFMAG, SELFMAG); + ehdr.e_ident[EI_CLASS] = char_le(ELFCLASS32); + ehdr.e_ident[EI_DATA] = char_le(ELFDATA2LSB); + ehdr.e_ident[EI_VERSION] = char_le(EV_CURRENT); + ehdr.e_ident[EI_OSABI] = char_le(elf_osabi); + ehdr.e_ident[EI_ABIVERSION] = char_le(elf_abiver); + + ehdr.e_type = short_le(ET_REL); + ehdr.e_machine = short_le(is_elf32() ? EM_386 : EM_X86_64); + ehdr.e_version = short_le(EV_CURRENT); + ehdr.e_entry = 0; + ehdr.e_phoff = 0; + ehdr.e_shoff = sizeof(Elf64_Ehdr); + ehdr.e_flags = 0; + ehdr.e_ehsize = short_le(sizeof(Elf32_Ehdr)); + ehdr.e_phentsize = 0; + ehdr.e_phnum = 0; + ehdr.e_shentsize = short_le(sizeof(Elf32_Shdr)); + ehdr.e_shnum = short_le(nsections); + ehdr.e_shstrndx = short_le(sec_shstrtab); + + nasm_write(&ehdr, sizeof(ehdr), ofile); + fwritezero(sizeof(Elf64_Ehdr) - sizeof(Elf32_Ehdr), ofile); } else { + Elf64_Ehdr ehdr; + nasm_assert(is_elf64()); - nasm_write("\177ELF\2\1\1", 7, ofile); - fputc(elf_osabi, ofile); - fputc(elf_abiver, ofile); - fwritezero(7, ofile); - fwriteint16_t(ET_REL, ofile); /* relocatable file */ - fwriteint16_t(EM_X86_64, ofile); /* processor ID */ - fwriteint32_t(1L, ofile); /* EV_CURRENT file format version */ - fwriteint64_t(0L, ofile); /* no entry point */ - fwriteint64_t(0L, ofile); /* no program header table */ - fwriteint64_t(0x40L, ofile); /* section headers straight after ELF header plus alignment */ - fwriteint32_t(0L, ofile); /* no special flags */ - fwriteint16_t(0x40, ofile); /* size of ELF header */ - fwriteint16_t(0, ofile); /* no program header table, again */ - fwriteint16_t(0, ofile); /* still no program header table */ - fwriteint16_t(sizeof(Elf64_Shdr), ofile); /* size of section header */ - fwriteint16_t(nsections, ofile); /* number of sections */ - fwriteint16_t(sec_shstrtab, ofile); /* string table section index for section header table */ + + nasm_zero(&ehdr.e_ident); + memcpy(ehdr.e_ident, ELFMAG, SELFMAG); + ehdr.e_ident[EI_CLASS] = char_le(ELFCLASS64); + ehdr.e_ident[EI_DATA] = char_le(ELFDATA2LSB); + ehdr.e_ident[EI_VERSION] = char_le(EV_CURRENT); + ehdr.e_ident[EI_OSABI] = char_le(elf_osabi); + ehdr.e_ident[EI_ABIVERSION] = char_le(elf_abiver); + + ehdr.e_type = short_le(ET_REL); + ehdr.e_machine = short_le(EM_X86_64); + ehdr.e_version = short_le(EV_CURRENT); + ehdr.e_entry = 0; + ehdr.e_phoff = 0; + ehdr.e_shoff = sizeof(Elf64_Ehdr); + ehdr.e_flags = 0; + ehdr.e_ehsize = short_le(sizeof(Elf64_Ehdr)); + ehdr.e_phentsize = 0; + ehdr.e_phnum = 0; + ehdr.e_shentsize = short_le(sizeof(Elf64_Shdr)); + ehdr.e_shnum = short_le(nsections); + ehdr.e_shstrndx = short_le(sec_shstrtab); + + nasm_write(&ehdr, sizeof(ehdr), ofile); } /* |
From: nasm-bot f. C. G. <gor...@gm...> - 2017-03-12 21:39:23
|
Commit-ID: e6c7c695a60b29cb35523923343d259c7e618bb6 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=e6c7c695a60b29cb35523923343d259c7e618bb6 Author: Cyrill Gorcunov <gor...@gm...> AuthorDate: Wed, 8 Mar 2017 13:03:52 +0300 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Sun, 12 Mar 2017 11:41:44 +0300 nasmlib: Add _le helpers Signed-off-by: Cyrill Gorcunov <gor...@gm...> --- include/nasmlib.h | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/include/nasmlib.h b/include/nasmlib.h index dbe623b..29e55ca 100644 --- a/include/nasmlib.h +++ b/include/nasmlib.h @@ -248,6 +248,11 @@ void standard_extension(char *inname, char *outname, char *extension); #if X86_MEMORY +static inline uint8_t char_le(uint8_t v) { return v; } +static inline uint16_t short_le(uint16_t v) { return v; } +static inline uint32_t long_le(uint32_t v) { return v; } +static inline uint64_t dlong_le(uint64_t v) { return v; } + #define WRITECHAR(p,v) \ do { \ *(uint8_t *)(p) = (v); \ @@ -281,6 +286,32 @@ void standard_extension(char *inname, char *outname, char *extension); #else /* !X86_MEMORY */ +static inline uint8_t char_le(uint8_t v) +{ + return v; +} + +static inline uint16_t short_le(uint16_t v) +{ + return (v << 8) | (v >> 8); +} + +static inline uint32_t long_le(uint32_t v) +{ + v = ((v << 8) & 0xff00ff00 ) | + ((v >> 8) & 0x00ff00ff); + return (v << 16) | (v >> 16); +} + +static inline uint64_t dlong_le(uint64_t v) +{ + v = ((v << 8) & 0xff00ff00ff00ff00ull) | + ((v >> 8) & 0x00ff00ff00ff00ffull); + v = ((v << 16) & 0xffff0000ffff0000ull) | + ((v >> 16) & 0x0000ffff0000ffffull); + return (v << 32) | (v >> 32); +} + #define WRITECHAR(p,v) \ do { \ uint8_t *_wc_p = (uint8_t *)(p); \ |
From: nasm-bot f. C. G. <gor...@gm...> - 2017-03-12 08:42:25
|
Commit-ID: fa38564c495eb999813012863d1937dd0b87efde Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=fa38564c495eb999813012863d1937dd0b87efde Author: Cyrill Gorcunov <gor...@gm...> AuthorDate: Wed, 8 Mar 2017 23:36:18 +0300 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Sun, 12 Mar 2017 11:40:52 +0300 output: elf -- Fix typo in ELF32_ST_INFO Signed-off-by: Cyrill Gorcunov <gor...@gm...> --- output/elf.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/output/elf.h b/output/elf.h index 149879d..4ae818a 100644 --- a/output/elf.h +++ b/output/elf.h @@ -258,7 +258,7 @@ #define ELF32_ST_BIND(i) ((i) >> 4) #define ELF32_ST_MKBIND(i) ((i) << 4) /* just a helper */ #define ELF32_ST_TYPE(i) ((i) & 0xf) -#define ELF32_ST_INFO(b, i) (ELF_ST_MKBIND(b) + ELF_ST_TYPE(i)) +#define ELF32_ST_INFO(b, i) (ELF32_ST_MKBIND(b) + ELF32_ST_TYPE(i)) #define ELF64_ST_BIND(i) ELF32_ST_BIND(i) #define ELF64_ST_MKBIND(i) ELF32_ST_MKBIND(i) |
From: nasm-bot f. C. G. <gor...@gm...> - 2017-03-12 08:42:24
|
Commit-ID: bcf038948173e20419d9eae84171e302ecf3b1de Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=bcf038948173e20419d9eae84171e302ecf3b1de Author: Cyrill Gorcunov <gor...@gm...> AuthorDate: Wed, 8 Mar 2017 21:19:23 +0300 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Sun, 12 Mar 2017 11:37:41 +0300 elf: Drop code duplication in elf_section_header Signed-off-by: Cyrill Gorcunov <gor...@gm...> --- output/outelf.c | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/output/outelf.c b/output/outelf.c index b347fdf..8be97b3 100644 --- a/output/outelf.c +++ b/output/outelf.c @@ -2118,20 +2118,7 @@ static void elf_section_header(int name, int type, uint64_t flags, elf_sects[elf_nsect].is_saa = is_saa; elf_nsect++; - if (is_elf32()) { - fwriteint32_t((int32_t)name, ofile); - fwriteint32_t((int32_t)type, ofile); - fwriteint32_t((int32_t)flags, ofile); - fwriteint32_t(0L, ofile); /* no address, ever, in object files */ - fwriteint32_t(type == 0 ? 0L : elf_foffs, ofile); - fwriteint32_t(datalen, ofile); - if (data) - elf_foffs += ALIGN(datalen, SEC_FILEALIGN); - fwriteint32_t((int32_t)link, ofile); - fwriteint32_t((int32_t)info, ofile); - fwriteint32_t((int32_t)align, ofile); - fwriteint32_t((int32_t)eltsize, ofile); - } else if (is_elfx32()) { + if (is_elf32() || is_elfx32()) { fwriteint32_t((int32_t)name, ofile); fwriteint32_t((int32_t)type, ofile); fwriteint32_t((int32_t)flags, ofile); |
From: nasm-bot f. C. G. <gor...@gm...> - 2017-03-12 08:42:24
|
Commit-ID: 660101a02e43bc4e8141088de38e92b06e6937e9 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=660101a02e43bc4e8141088de38e92b06e6937e9 Author: Cyrill Gorcunov <gor...@gm...> AuthorDate: Wed, 8 Mar 2017 18:59:48 +0300 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Sun, 12 Mar 2017 11:37:23 +0300 elf: Align members for file format defs For readability sake. Signed-off-by: Cyrill Gorcunov <gor...@gm...> --- output/elf.h | 192 +++++++++++++++++++++++++++++------------------------------ 1 file changed, 96 insertions(+), 96 deletions(-) diff --git a/output/elf.h b/output/elf.h index 3c976e5..149879d 100644 --- a/output/elf.h +++ b/output/elf.h @@ -296,18 +296,18 @@ typedef uint16_t Elf64_Section; */ typedef struct elf32_dyn { - Elf32_Sword d_tag; + Elf32_Sword d_tag; union { Elf32_Sword d_val; - Elf32_Addr d_ptr; + Elf32_Addr d_ptr; } d_un; } Elf32_Dyn; typedef struct elf64_dyn { - Elf64_Sxword d_tag; + Elf64_Sxword d_tag; union { Elf64_Xword d_val; - Elf64_Addr d_ptr; + Elf64_Addr d_ptr; } d_un; } Elf64_Dyn; @@ -319,14 +319,14 @@ typedef struct elf64_dyn { #define ELF32_R_TYPE(x) ((x) & 0xff) typedef struct elf32_rel { - Elf32_Addr r_offset; - Elf32_Word r_info; + Elf32_Addr r_offset; + Elf32_Word r_info; } Elf32_Rel; typedef struct elf32_rela { - Elf32_Addr r_offset; - Elf32_Word r_info; - Elf32_Sword r_addend; + Elf32_Addr r_offset; + Elf32_Word r_info; + Elf32_Sword r_addend; } Elf32_Rela; enum reloc32_type { @@ -353,14 +353,14 @@ enum reloc32_type { #define ELF64_R_TYPE(x) ((x) & 0xffffffff) typedef struct elf64_rel { - Elf64_Addr r_offset; - Elf64_Xword r_info; + Elf64_Addr r_offset; + Elf64_Xword r_info; } Elf64_Rel; typedef struct elf64_rela { - Elf64_Addr r_offset; - Elf64_Xword r_info; - Elf64_Sxword r_addend; + Elf64_Addr r_offset; + Elf64_Xword r_info; + Elf64_Sxword r_addend; } Elf64_Rela; enum reloc64_type { @@ -408,21 +408,21 @@ enum reloc64_type { */ typedef struct elf32_sym { - Elf32_Word st_name; - Elf32_Addr st_value; - Elf32_Word st_size; - unsigned char st_info; - unsigned char st_other; - Elf32_Half st_shndx; + Elf32_Word st_name; + Elf32_Addr st_value; + Elf32_Word st_size; + unsigned char st_info; + unsigned char st_other; + Elf32_Half st_shndx; } Elf32_Sym; typedef struct elf64_sym { - Elf64_Word st_name; - unsigned char st_info; - unsigned char st_other; - Elf64_Half st_shndx; - Elf64_Addr st_value; - Elf64_Xword st_size; + Elf64_Word st_name; + unsigned char st_info; + unsigned char st_other; + Elf64_Half st_shndx; + Elf64_Addr st_value; + Elf64_Xword st_size; } Elf64_Sym; /* @@ -430,37 +430,37 @@ typedef struct elf64_sym { */ typedef struct elf32_hdr { - unsigned char e_ident[EI_NIDENT]; - Elf32_Half e_type; - Elf32_Half e_machine; - Elf32_Word e_version; - Elf32_Addr e_entry; - Elf32_Off e_phoff; - Elf32_Off e_shoff; - Elf32_Word e_flags; - Elf32_Half e_ehsize; - Elf32_Half e_phentsize; - Elf32_Half e_phnum; - Elf32_Half e_shentsize; - Elf32_Half e_shnum; - Elf32_Half e_shstrndx; + unsigned char e_ident[EI_NIDENT]; + Elf32_Half e_type; + Elf32_Half e_machine; + Elf32_Word e_version; + Elf32_Addr e_entry; + Elf32_Off e_phoff; + Elf32_Off e_shoff; + Elf32_Word e_flags; + Elf32_Half e_ehsize; + Elf32_Half e_phentsize; + Elf32_Half e_phnum; + Elf32_Half e_shentsize; + Elf32_Half e_shnum; + Elf32_Half e_shstrndx; } Elf32_Ehdr; typedef struct elf64_hdr { - unsigned char e_ident[EI_NIDENT]; - Elf64_Half e_type; - Elf64_Half e_machine; - Elf64_Word e_version; - Elf64_Addr e_entry; - Elf64_Off e_phoff; - Elf64_Off e_shoff; - Elf64_Word e_flags; - Elf64_Half e_ehsize; - Elf64_Half e_phentsize; - Elf64_Half e_phnum; - Elf64_Half e_shentsize; - Elf64_Half e_shnum; - Elf64_Half e_shstrndx; + unsigned char e_ident[EI_NIDENT]; + Elf64_Half e_type; + Elf64_Half e_machine; + Elf64_Word e_version; + Elf64_Addr e_entry; + Elf64_Off e_phoff; + Elf64_Off e_shoff; + Elf64_Word e_flags; + Elf64_Half e_ehsize; + Elf64_Half e_phentsize; + Elf64_Half e_phnum; + Elf64_Half e_shentsize; + Elf64_Half e_shnum; + Elf64_Half e_shstrndx; } Elf64_Ehdr; /* @@ -468,25 +468,25 @@ typedef struct elf64_hdr { */ typedef struct elf32_phdr { - Elf32_Word p_type; - Elf32_Off p_offset; - Elf32_Addr p_vaddr; - Elf32_Addr p_paddr; - Elf32_Word p_filesz; - Elf32_Word p_memsz; - Elf32_Word p_flags; - Elf32_Word p_align; + Elf32_Word p_type; + Elf32_Off p_offset; + Elf32_Addr p_vaddr; + Elf32_Addr p_paddr; + Elf32_Word p_filesz; + Elf32_Word p_memsz; + Elf32_Word p_flags; + Elf32_Word p_align; } Elf32_Phdr; typedef struct elf64_phdr { - Elf64_Word p_type; - Elf64_Word p_flags; - Elf64_Off p_offset; - Elf64_Addr p_vaddr; - Elf64_Addr p_paddr; - Elf64_Xword p_filesz; - Elf64_Xword p_memsz; - Elf64_Xword p_align; + Elf64_Word p_type; + Elf64_Word p_flags; + Elf64_Off p_offset; + Elf64_Addr p_vaddr; + Elf64_Addr p_paddr; + Elf64_Xword p_filesz; + Elf64_Xword p_memsz; + Elf64_Xword p_align; } Elf64_Phdr; /* @@ -494,44 +494,44 @@ typedef struct elf64_phdr { */ typedef struct elf32_shdr { - Elf32_Word sh_name; - Elf32_Word sh_type; - Elf32_Word sh_flags; - Elf32_Addr sh_addr; - Elf32_Off sh_offset; - Elf32_Word sh_size; - Elf32_Word sh_link; - Elf32_Word sh_info; - Elf32_Word sh_addralign; - Elf32_Word sh_entsize; + Elf32_Word sh_name; + Elf32_Word sh_type; + Elf32_Word sh_flags; + Elf32_Addr sh_addr; + Elf32_Off sh_offset; + Elf32_Word sh_size; + Elf32_Word sh_link; + Elf32_Word sh_info; + Elf32_Word sh_addralign; + Elf32_Word sh_entsize; } Elf32_Shdr; typedef struct elf64_shdr { - Elf64_Word sh_name; - Elf64_Word sh_type; - Elf64_Xword sh_flags; - Elf64_Addr sh_addr; - Elf64_Off sh_offset; - Elf64_Xword sh_size; - Elf64_Word sh_link; - Elf64_Word sh_info; - Elf64_Xword sh_addralign; - Elf64_Xword sh_entsize; + Elf64_Word sh_name; + Elf64_Word sh_type; + Elf64_Xword sh_flags; + Elf64_Addr sh_addr; + Elf64_Off sh_offset; + Elf64_Xword sh_size; + Elf64_Word sh_link; + Elf64_Word sh_info; + Elf64_Xword sh_addralign; + Elf64_Xword sh_entsize; } Elf64_Shdr; /* * Note header */ typedef struct elf32_note { - Elf32_Word n_namesz; /* Name size */ - Elf32_Word n_descsz; /* Content size */ - Elf32_Word n_type; /* Content type */ + Elf32_Word n_namesz; /* Name size */ + Elf32_Word n_descsz; /* Content size */ + Elf32_Word n_type; /* Content type */ } Elf32_Nhdr; typedef struct elf64_note { - Elf64_Word n_namesz; /* Name size */ - Elf64_Word n_descsz; /* Content size */ - Elf64_Word n_type; /* Content type */ + Elf64_Word n_namesz; /* Name size */ + Elf64_Word n_descsz; /* Content size */ + Elf64_Word n_type; /* Content type */ } Elf64_Nhdr; #endif /* OUTPUT_ELF_H */ |
From: nasm-bot f. C. G. <gor...@gm...> - 2017-03-12 08:42:23
|
Commit-ID: 37034f1cc8b6c1b332850a1e3bf4791e849ec22e Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=37034f1cc8b6c1b332850a1e3bf4791e849ec22e Author: Cyrill Gorcunov <gor...@gm...> AuthorDate: Wed, 8 Mar 2017 16:44:57 +0300 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Sun, 12 Mar 2017 11:37:15 +0300 elf: Add EI_ constants Signed-off-by: Cyrill Gorcunov <gor...@gm...> --- output/elf.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/output/elf.h b/output/elf.h index b20d63f..3c976e5 100644 --- a/output/elf.h +++ b/output/elf.h @@ -202,7 +202,8 @@ #define EI_DATA 5 #define EI_VERSION 6 #define EI_OSABI 7 -#define EI_PAD 8 +#define EI_ABIVERSION 8 +#define EI_NINDENT 16 #define ELFMAG0 0x7f /* EI_MAG */ #define ELFMAG1 'E' |
From: nasm-bot f. C. G. <gor...@gm...> - 2017-03-08 08:43:40
|
Commit-ID: 485413344b36a4506b841b3d7fb84452b1811a0f Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=485413344b36a4506b841b3d7fb84452b1811a0f Author: Cyrill Gorcunov <gor...@gm...> AuthorDate: Wed, 8 Mar 2017 11:39:42 +0300 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Wed, 8 Mar 2017 11:39:42 +0300 asm/pragma: Add missing "assemble.h" inclusion | asm/pragma.c:131:6: error: no previous prototype for ‘process_pragma’ [-Werror=missing-prototypes] | void process_pragma(char *str) | ^~~~~~~~~~~~~~ Signed-off-by: Cyrill Gorcunov <gor...@gm...> --- asm/pragma.c | 1 + 1 file changed, 1 insertion(+) diff --git a/asm/pragma.c b/asm/pragma.c index d0518e8..cad2042 100644 --- a/asm/pragma.c +++ b/asm/pragma.c @@ -46,6 +46,7 @@ #include "nasm.h" #include "nasmlib.h" +#include "assemble.h" #include "error.h" /* |
From: nasm-bot f. C. G. <gor...@gm...> - 2017-01-08 13:54:31
|
Commit-ID: dc9c312c975e6959448bc3514630f0f2cf304179 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=dc9c312c975e6959448bc3514630f0f2cf304179 Author: Cyrill Gorcunov <gor...@gm...> AuthorDate: Sun, 8 Jan 2017 16:51:37 +0300 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Sun, 8 Jan 2017 16:51:41 +0300 insns.dat: Fix SHA256RNDS2 optional xmm0 argument In commit 1eef781594b08a7f we allowed xmm0 to be implicit, then in dcaef4b09502aae7 it occasionally got ripped off. Move it back. https://bugzilla.nasm.us/show_bug.cgi?id=3392379 Reported-by: ig <glu...@av...> Signed-off-by: Cyrill Gorcunov <gor...@gm...> --- x86/insns.dat | 1 + 1 file changed, 1 insertion(+) diff --git a/x86/insns.dat b/x86/insns.dat index 9ecb047..ac8bc2b 100644 --- a/x86/insns.dat +++ b/x86/insns.dat @@ -3577,6 +3577,7 @@ SHA1RNDS4 xmmreg,xmmrm128,imm8 [rmi: 0f 3a cc /r ib ] SHA,F SHA256MSG1 xmmreg,xmmrm128 [rm: 0f 38 cc /r ] SHA,FUTURE SHA256MSG2 xmmreg,xmmrm128 [rm: 0f 38 cd /r ] SHA,FUTURE SHA256RNDS2 xmmreg,xmmrm128,xmm0 [rm-: 0f 38 cb /r ] SHA,FUTURE +SHA256RNDS2 xmmreg,xmmrm128 [rm: 0f 38 cb /r ] SHA,FUTURE VADDPD xmmreg|mask|z,xmmreg*,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f.w1 58 /r ] AVX512VL,AVX512,FUTURE VADDPD ymmreg|mask|z,ymmreg*,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f.w1 58 /r ] AVX512VL,AVX512,FUTURE VADDPD zmmreg|mask|z,zmmreg*,zmmrm512|b64|er [rvm:fv: evex.nds.512.66.0f.w1 58 /r ] AVX512,FUTURE |
From: nasm-bot f. C. G. <gor...@gm...> - 2017-01-06 17:30:20
|
Commit-ID: 15ce78fc5b968c750d005a3287d3419e3a994094 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=15ce78fc5b968c750d005a3287d3419e3a994094 Author: Cyrill Gorcunov <gor...@gm...> AuthorDate: Fri, 6 Jan 2017 20:21:28 +0300 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Fri, 6 Jan 2017 20:22:36 +0300 macros: Define ofmt specific macros late In commits e1f985c1674951 and f7606613d047ff we reordered macros handling, but ofmt specific macros are to be handled after standart ones are processed. In particular __SECT__ handling must not change, so the order of inclusion does matter. https://bugzilla.nasm.us/show_bug.cgi?id=3392376 Signed-off-by: Cyrill Gorcunov <gor...@gm...> --- asm/preproc.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/asm/preproc.c b/asm/preproc.c index 24dbc35..ee91d15 100644 --- a/asm/preproc.c +++ b/asm/preproc.c @@ -444,6 +444,7 @@ static uint64_t nested_rep_count; static macros_t *stdmacpos; static macros_t **stdmacnext; static macros_t *stdmacros[8]; +static macros_t *extrastdmac; /* * Tokens are allocated in blocks to improve speed @@ -4969,6 +4970,9 @@ pp_reset(char *file, int apass, StrList **deplist) pp_add_stdmac(nasm_stdmac_nasm); pp_add_stdmac(nasm_stdmac_version); + if (extrastdmac) + pp_add_stdmac(extrastdmac); + stdmacpos = stdmacros[0]; stdmacnext = &stdmacros[1]; @@ -5362,6 +5366,11 @@ static void pp_add_stdmac(macros_t *macros) *mp = macros; } +static void pp_extra_stdmac(macros_t *macros) +{ + extrastdmac = macros; +} + static void make_tok_num(Token * tok, int64_t val) { char numbuf[32]; @@ -5403,7 +5412,7 @@ const struct preproc_ops nasmpp = { pp_reset, pp_getline, pp_cleanup, - pp_add_stdmac, + pp_extra_stdmac, pp_pre_define, pp_pre_undefine, pp_pre_include, |
From: nasm-bot f. C. G. <gor...@gm...> - 2017-01-06 13:33:21
|
Commit-ID: c7b0fe6bbeb17050e4322dde0918287f8e1de340 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=c7b0fe6bbeb17050e4322dde0918287f8e1de340 Author: Cyrill Gorcunov <gor...@gm...> AuthorDate: Fri, 6 Jan 2017 13:37:05 +0300 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Fri, 6 Jan 2017 13:37:05 +0300 macros: standart -- Shift endmacro left Fix code imbalance. Signed-off-by: Cyrill Gorcunov <gor...@gm...> --- macros/standard.mac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macros/standard.mac b/macros/standard.mac index d89278a..5fe9eb6 100644 --- a/macros/standard.mac +++ b/macros/standard.mac @@ -92,7 +92,7 @@ STD: nasm %define %$strucname %1 [absolute %2] %$strucname: ; allow definition of `.member' to work sanely - %endmacro +%endmacro %imacro endstruc 0.nolist %{$strucname}_size equ ($-%$strucname) |
From: nasm-bot f. C. G. <gor...@gm...> - 2017-01-05 21:39:15
|
Commit-ID: 4ff8c63ab64012ee8a037e368d87f284579ef2a9 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=4ff8c63ab64012ee8a037e368d87f284579ef2a9 Author: Cyrill Gorcunov <gor...@gm...> AuthorDate: Fri, 6 Jan 2017 00:36:23 +0300 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Fri, 6 Jan 2017 00:36:23 +0300 preproc: Use found path when opening include It's a typo in 169ac7c152ee13ed0c470ceb3371e9afb10e9a60 https://bugzilla.nasm.us/show_bug.cgi?id=3392378 Reported-by: Ryan Prichard <rya...@gm...> Signed-off-by: Cyrill Gorcunov <gor...@gm...> --- asm/preproc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/asm/preproc.c b/asm/preproc.c index b4c90aa..24dbc35 100644 --- a/asm/preproc.c +++ b/asm/preproc.c @@ -1614,7 +1614,7 @@ static FILE *inc_fopen(const char *file, } if (!fp && omode != INC_PROBE) - fp = nasm_open_read(file, fmode); + fp = nasm_open_read(path, fmode); if (found_path) *found_path = path; |
From: nasm-bot f. C. G. <gor...@gm...> - 2016-11-28 22:21:21
|
Commit-ID: fd610f27d6814b321b2d4420d23cf43664abcaf0 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=fd610f27d6814b321b2d4420d23cf43664abcaf0 Author: Cyrill Gorcunov <gor...@gm...> AuthorDate: Mon, 28 Nov 2016 23:57:08 +0300 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Tue, 29 Nov 2016 01:17:33 +0300 asm/parser.c -- Fix typo in testing for register It should be EXPR_REG_END referred when testing for register present. A typo in 472a7c1d17e0212b3cbf5302a9f5cdb358be4425 https://bugzilla.nasm.us/show_bug.cgi?id=3392375 Signed-off-by: Cyrill Gorcunov <gor...@gm...> --- asm/parser.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/asm/parser.c b/asm/parser.c index a20ef94..7b4cc5c 100644 --- a/asm/parser.c +++ b/asm/parser.c @@ -390,7 +390,7 @@ static int value_to_extop(expr * vect, extop *eop, int32_t myseg) if (!vect->value) /* zero term, safe to ignore */ continue; - if (vect->type < EXPR_SIMPLE) /* false if a register is present */ + if (vect->type <= EXPR_REG_END) /* false if a register is present */ return -1; if (vect->type == EXPR_UNKNOWN) /* something we can't resolve yet */ |
From: nasm-bot f. C. G. <gor...@gm...> - 2016-11-06 15:39:24
|
Commit-ID: 48fe2eea2743f8beb1e07e1bf0fb4b74ecab5426 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=48fe2eea2743f8beb1e07e1bf0fb4b74ecab5426 Author: Cyrill Gorcunov <gor...@gm...> AuthorDate: Sun, 6 Nov 2016 18:35:14 +0300 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Sun, 6 Nov 2016 18:38:34 +0300 output: outelf,dwarf -- Add missing DW_LNS_copy Backport of master commit ed347369aeeb6ff7338249a967bd292ee78debc5 https://bugzilla.nasm.us/show_bug.cgi?id=3392325 Signed-off-by: Cyrill Gorcunov <gor...@gm...> --- output/outelf32.c | 1 + output/outelf64.c | 1 + 2 files changed, 2 insertions(+) diff --git a/output/outelf32.c b/output/outelf32.c index b1596c9..b63ea9d 100644 --- a/output/outelf32.c +++ b/output/outelf32.c @@ -1716,6 +1716,7 @@ static void dwarf32_output(int type, void *param) saa_write8(plinep,DW_LNS_advance_pc); saa_wleb128u(plinep,aa); } + saa_write8(plinep,DW_LNS_copy); } dwarf_csect->line = currentline; dwarf_csect->offset = s->offset; diff --git a/output/outelf64.c b/output/outelf64.c index 878c8e4..d007150 100644 --- a/output/outelf64.c +++ b/output/outelf64.c @@ -1806,6 +1806,7 @@ static void dwarf64_output(int type, void *param) saa_write8(plinep,DW_LNS_advance_pc); saa_wleb128u(plinep,aa); } + saa_write8(plinep,DW_LNS_copy); } dwarf_csect->line = currentline; dwarf_csect->offset = s->offset; |
From: nasm-bot f. C. G. <gor...@gm...> - 2016-11-05 13:42:19
|
Commit-ID: 4d79eed7b7f0c7959084a67b821485ae587aa480 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=4d79eed7b7f0c7959084a67b821485ae587aa480 Author: Cyrill Gorcunov <gor...@gm...> AuthorDate: Sun, 23 Oct 2016 18:12:23 +0300 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Sat, 5 Nov 2016 16:39:27 +0300 x86/insns.dat -- Fix typo in VMOVDQA instruction https://bugzilla.nasm.us/show_bug.cgi?id=3392369 Reported-by: Agner <ag...@ag...> Signed-off-by: Cyrill Gorcunov <gor...@gm...> --- insns.dat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/insns.dat b/insns.dat index d6f5c72..a391802 100644 --- a/insns.dat +++ b/insns.dat @@ -2462,7 +2462,7 @@ VMOVDQA xmmrm128,xmmreg [mr: vex.128.66.0f 7f /r] AVX,SANDYBRIDGE ; These are officially documented as VMOVDQA, but VMOVQQA seems more logical to me... VMOVQQA ymmreg,ymmrm256 [rm: vex.256.66.0f 6f /r] AVX,SANDYBRIDGE VMOVQQA ymmrm256,ymmreg [mr: vex.256.66.0f 7f /r] AVX,SANDYBRIDGE -VMOVDQA ymmreg,ymmrm [rm: vex.256.66.0f 6f /r] AVX,SANDYBRIDGE +VMOVDQA ymmreg,ymmrm256 [rm: vex.256.66.0f 6f /r] AVX,SANDYBRIDGE VMOVDQA ymmrm256,ymmreg [mr: vex.256.66.0f 7f /r] AVX,SANDYBRIDGE VMOVDQU xmmreg,xmmrm128 [rm: vex.128.f3.0f 6f /r] AVX,SANDYBRIDGE VMOVDQU xmmrm128,xmmreg [mr: vex.128.f3.0f 7f /r] AVX,SANDYBRIDGE |
From: nasm-bot f. C. G. <gor...@gm...> - 2016-10-23 15:15:18
|
Commit-ID: 6600eb1188314ddd3eb7fd74d18240cfe7746049 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=6600eb1188314ddd3eb7fd74d18240cfe7746049 Author: Cyrill Gorcunov <gor...@gm...> AuthorDate: Sun, 23 Oct 2016 18:12:23 +0300 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Sun, 23 Oct 2016 18:13:25 +0300 x86/insns.dat -- Fix typo in VMOVDQA instruction https://bugzilla.nasm.us/show_bug.cgi?id=3392369 Reported-by: Agner <ag...@ag...> Signed-off-by: Cyrill Gorcunov <gor...@gm...> --- x86/insns.dat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x86/insns.dat b/x86/insns.dat index d6f5c72..a391802 100644 --- a/x86/insns.dat +++ b/x86/insns.dat @@ -2462,7 +2462,7 @@ VMOVDQA xmmrm128,xmmreg [mr: vex.128.66.0f 7f /r] AVX,SANDYBRIDGE ; These are officially documented as VMOVDQA, but VMOVQQA seems more logical to me... VMOVQQA ymmreg,ymmrm256 [rm: vex.256.66.0f 6f /r] AVX,SANDYBRIDGE VMOVQQA ymmrm256,ymmreg [mr: vex.256.66.0f 7f /r] AVX,SANDYBRIDGE -VMOVDQA ymmreg,ymmrm [rm: vex.256.66.0f 6f /r] AVX,SANDYBRIDGE +VMOVDQA ymmreg,ymmrm256 [rm: vex.256.66.0f 6f /r] AVX,SANDYBRIDGE VMOVDQA ymmrm256,ymmreg [mr: vex.256.66.0f 7f /r] AVX,SANDYBRIDGE VMOVDQU xmmreg,xmmrm128 [rm: vex.128.f3.0f 6f /r] AVX,SANDYBRIDGE VMOVDQU xmmrm128,xmmreg [mr: vex.128.f3.0f 7f /r] AVX,SANDYBRIDGE |
From: nasm-bot f. C. G. <gor...@gm...> - 2016-10-23 13:30:26
|
Commit-ID: 9e8c2466a4eaa3de7d25ea46257ba9b0af45b671 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=9e8c2466a4eaa3de7d25ea46257ba9b0af45b671 Author: Cyrill Gorcunov <gor...@gm...> AuthorDate: Sun, 23 Oct 2016 16:24:10 +0300 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Sun, 23 Oct 2016 16:27:44 +0300 nsis: Import x64.nsh >From NSIS-3.0 source code (Include/x64.nsh). Hopefully it will be enough for nsis-v2.5 to support Win64. https://sourceforge.net/p/nsis/code/HEAD/tree/NSIS/trunk/Include/x64.nsh Signed-off-by: Cyrill Gorcunov <gor...@gm...> --- nsis/x64.nsh | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/nsis/x64.nsh b/nsis/x64.nsh new file mode 100644 index 0000000..e694c1e --- /dev/null +++ b/nsis/x64.nsh @@ -0,0 +1,54 @@ +; --------------------- +; x64.nsh +; --------------------- +; +; A few simple macros to handle installations on x64 machines. +; +; RunningX64 checks if the installer is running on x64. +; +; ${If} ${RunningX64} +; MessageBox MB_OK "running on x64" +; ${EndIf} +; +; DisableX64FSRedirection disables file system redirection. +; EnableX64FSRedirection enables file system redirection. +; +; SetOutPath $SYSDIR +; ${DisableX64FSRedirection} +; File some.dll # extracts to C:\Windows\System32 +; ${EnableX64FSRedirection} +; File some.dll # extracts to C:\Windows\SysWOW64 +; + +!ifndef ___X64__NSH___ +!define ___X64__NSH___ + +!include LogicLib.nsh + +!macro _RunningX64 _a _b _t _f + !insertmacro _LOGICLIB_TEMP + System::Call kernel32::GetCurrentProcess()i.s + System::Call kernel32::IsWow64Process(is,*i.s) + Pop $_LOGICLIB_TEMP + !insertmacro _!= $_LOGICLIB_TEMP 0 `${_t}` `${_f}` +!macroend + +!define RunningX64 `"" RunningX64 ""` + +!macro DisableX64FSRedirection + + System::Call kernel32::Wow64EnableWow64FsRedirection(i0) + +!macroend + +!define DisableX64FSRedirection "!insertmacro DisableX64FSRedirection" + +!macro EnableX64FSRedirection + + System::Call kernel32::Wow64EnableWow64FsRedirection(i1) + +!macroend + +!define EnableX64FSRedirection "!insertmacro EnableX64FSRedirection" + +!endif # !___X64__NSH___ |
From: nasm-bot f. C. G. <gor...@gm...> - 2016-10-23 13:30:26
|
Commit-ID: a1461a5a89811dec60defcdb64dd2980cd45d877 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=a1461a5a89811dec60defcdb64dd2980cd45d877 Author: Cyrill Gorcunov <gor...@gm...> AuthorDate: Sun, 23 Oct 2016 13:16:31 +0300 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Sun, 23 Oct 2016 16:27:48 +0300 nsis: Use Program Files (x86) directory for nasm installation on x86-64 https://bugzilla.nasm.us/show_bug.cgi?id=3392365 Reported-by: Mat <mbe...@gm...> Based-on-patch-by: Mat <mbe...@gm...> Signed-off-by: Cyrill Gorcunov <gor...@gm...> --- nsis/nasm.nsi | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/nsis/nasm.nsi b/nsis/nasm.nsi index ebb8ef9..a021bd5 100644 --- a/nsis/nasm.nsi +++ b/nsis/nasm.nsi @@ -30,6 +30,7 @@ !addincludedir "${srcdir}/nsis" !include "version.nsh" !include /nonfatal "arch.nsh" +!include /nonfatal "x64.nsh" !define PRODUCT_NAME "Netwide Assembler" !define PRODUCT_SHORT_NAME "nasm" @@ -229,6 +230,13 @@ SectionEnd ; MUI requires this hooks Function .onInit !insertmacro MULTIUSER_INIT + ${If} ${RunningX64} + SetRegView 64 + ${EnableX64FSRedirection} + StrCpy $INSTDIR "$PROGRAMFILES64\${PRODUCT_SHORT_NAME}" + ${Else} + StrCpy $INSTDIR "$PROGRAMFILES\${PRODUCT_SHORT_NAME}" + ${EndIf} FunctionEnd Function un.onInit |
From: nasm-bot f. C. G. <gor...@gm...> - 2016-07-23 09:42:26
|
Commit-ID: 5dfcab6bf952f18d30c741118451f29cb61b1412 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=5dfcab6bf952f18d30c741118451f29cb61b1412 Author: Cyrill Gorcunov <gor...@gm...> AuthorDate: Mon, 18 Jul 2016 11:49:47 +0300 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Mon, 18 Jul 2016 11:49:47 +0300 labels: Warn if new label created on pass two When symbols are created turing non-first pass we should at least warn a user since it's a sign of potential problem. http://bugzilla.nasm.us/show_bug.cgi?id=3392358 Signed-off-by: Cyrill Gorcunov <gor...@gm...> --- labels.c | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/labels.c b/labels.c index d7cdb8c..594cc2d 100644 --- a/labels.c +++ b/labels.c @@ -147,7 +147,7 @@ static void out_symdef(char *name, int32_t segment, int64_t offset, * given label name. Creates a new one, if it isn't found, and if * `create' is true. */ -static union label *find_label(char *label, int create) +static union label *find_label(char *label, int create, int *created) { char *prev; int prevlen, len; @@ -175,8 +175,11 @@ static union label *find_label(char *label, int create) lpp = (union label **) hash_find(<ab, label, &ip); lptr = lpp ? *lpp : NULL; - if (lptr || !create) + if (lptr || !create) { + if (created) + *created = 0; return lptr; + } /* Create a new label... */ if (lfree->admin.movingon == END_BLOCK) { @@ -188,6 +191,9 @@ static union label *find_label(char *label, int create) init_block(lfree); } + if (created) + *created = 1; + lfree->admin.movingon = BOGUS_VALUE; lfree->defn.label = perm_copy(label); lfree->defn.special = NULL; @@ -204,7 +210,7 @@ bool lookup_label(char *label, int32_t *segment, int64_t *offset) if (!initialized) return false; - lptr = find_label(label, 0); + lptr = find_label(label, 0, NULL); if (lptr && (lptr->defn.is_global & DEFINED_BIT)) { *segment = lptr->defn.segment; *offset = lptr->defn.offset; @@ -221,7 +227,7 @@ bool is_extern(char *label) if (!initialized) return false; - lptr = find_label(label, 0); + lptr = find_label(label, 0, NULL); return (lptr && (lptr->defn.is_global & EXTERN_BIT)); } @@ -229,7 +235,7 @@ void redefine_label(char *label, int32_t segment, int64_t offset, char *special, bool is_norm, bool isextrn) { union label *lptr; - int exi; + int exi, created; /* This routine possibly ought to check for phase errors. Most assemblers * check for phase errors at this point. I don't know whether phase errors @@ -248,10 +254,13 @@ void redefine_label(char *label, int32_t segment, int64_t offset, char *special, label, segment, offset, special, is_norm, isextrn); #endif - lptr = find_label(label, 1); + lptr = find_label(label, 1, &created); if (!lptr) nasm_panic(0, "can't find label `%s' on pass two", label); + if (created) + nasm_error(ERR_WARNING, "label `%s' defined on pass two", label); + if (!islocal(label)) { if (!islocalchar(*label) && lptr->defn.is_norm) prevlabel = lptr->defn.label; @@ -301,7 +310,7 @@ void define_label(char *label, int32_t segment, int64_t offset, char *special, nasm_error(ERR_DEBUG, "define_label (%s, %"PRIx32", %"PRIx64", %s, %d, %d)", label, segment, offset, special, is_norm, isextrn); #endif - lptr = find_label(label, 1); + lptr = find_label(label, 1, NULL); if (!lptr) return; if (lptr->defn.is_global & DEFINED_BIT) { @@ -353,7 +362,7 @@ void define_common(char *label, int32_t segment, int32_t size, char *special) { union label *lptr; - lptr = find_label(label, 1); + lptr = find_label(label, 1, NULL); if (!lptr) return; if ((lptr->defn.is_global & DEFINED_BIT) && @@ -390,7 +399,7 @@ void declare_as_global(char *label, char *special) " global", label); return; } - lptr = find_label(label, 1); + lptr = find_label(label, 1, NULL); if (!lptr) return; switch (lptr->defn.is_global & TYPE_MASK) { |