You can subscribe to this list here.
2000 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
(71) |
Aug
(152) |
Sep
(123) |
Oct
(49) |
Nov
|
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2001 |
Jan
|
Feb
|
Mar
|
Apr
(2) |
May
|
Jun
|
Jul
|
Aug
|
Sep
(3) |
Oct
|
Nov
|
Dec
|
2002 |
Jan
|
Feb
|
Mar
|
Apr
(37) |
May
(554) |
Jun
(301) |
Jul
(84) |
Aug
(39) |
Sep
(44) |
Oct
(99) |
Nov
(41) |
Dec
(52) |
2003 |
Jan
(15) |
Feb
(32) |
Mar
(19) |
Apr
(4) |
May
(8) |
Jun
(30) |
Jul
(122) |
Aug
(100) |
Sep
(120) |
Oct
(4) |
Nov
(39) |
Dec
(32) |
2004 |
Jan
(38) |
Feb
(87) |
Mar
(11) |
Apr
(23) |
May
(7) |
Jun
(6) |
Jul
(18) |
Aug
(2) |
Sep
(22) |
Oct
(2) |
Nov
(7) |
Dec
(48) |
2005 |
Jan
(74) |
Feb
(29) |
Mar
(28) |
Apr
(1) |
May
(24) |
Jun
(16) |
Jul
(9) |
Aug
(7) |
Sep
(69) |
Oct
(11) |
Nov
(13) |
Dec
(13) |
2006 |
Jan
(5) |
Feb
(3) |
Mar
(7) |
Apr
|
May
(12) |
Jun
(12) |
Jul
(5) |
Aug
(1) |
Sep
(4) |
Oct
(61) |
Nov
(68) |
Dec
(46) |
2007 |
Jan
(16) |
Feb
(15) |
Mar
(46) |
Apr
(171) |
May
(78) |
Jun
(109) |
Jul
(61) |
Aug
(71) |
Sep
(189) |
Oct
(219) |
Nov
(162) |
Dec
(91) |
2008 |
Jan
(49) |
Feb
(41) |
Mar
(43) |
Apr
(31) |
May
(70) |
Jun
(98) |
Jul
(39) |
Aug
(8) |
Sep
(75) |
Oct
(47) |
Nov
(11) |
Dec
(17) |
2009 |
Jan
(9) |
Feb
(12) |
Mar
(8) |
Apr
(11) |
May
(27) |
Jun
(25) |
Jul
(161) |
Aug
(28) |
Sep
(66) |
Oct
(36) |
Nov
(49) |
Dec
(22) |
2010 |
Jan
(34) |
Feb
(20) |
Mar
(3) |
Apr
(12) |
May
(1) |
Jun
(10) |
Jul
(28) |
Aug
(98) |
Sep
(7) |
Oct
(25) |
Nov
(4) |
Dec
(9) |
2011 |
Jan
|
Feb
(12) |
Mar
(7) |
Apr
(16) |
May
(11) |
Jun
(59) |
Jul
(120) |
Aug
(7) |
Sep
(4) |
Oct
(5) |
Nov
(3) |
Dec
(2) |
2012 |
Jan
|
Feb
(6) |
Mar
(21) |
Apr
|
May
|
Jun
|
Jul
(9) |
Aug
|
Sep
(5) |
Oct
(3) |
Nov
(6) |
Dec
(1) |
2013 |
Jan
|
Feb
(19) |
Mar
(10) |
Apr
|
May
(2) |
Jun
|
Jul
(7) |
Aug
(62) |
Sep
(14) |
Oct
(44) |
Nov
(38) |
Dec
(47) |
2014 |
Jan
(14) |
Feb
(1) |
Mar
(4) |
Apr
|
May
(20) |
Jun
|
Jul
|
Aug
(8) |
Sep
(6) |
Oct
(11) |
Nov
(9) |
Dec
(9) |
2015 |
Jan
(3) |
Feb
(2) |
Mar
(2) |
Apr
(3) |
May
(2) |
Jun
(5) |
Jul
|
Aug
(2) |
Sep
(1) |
Oct
(1) |
Nov
(10) |
Dec
(2) |
2016 |
Jan
(12) |
Feb
(13) |
Mar
(9) |
Apr
(45) |
May
(9) |
Jun
(2) |
Jul
(15) |
Aug
(32) |
Sep
(6) |
Oct
(28) |
Nov
(1) |
Dec
|
2017 |
Jan
(1) |
Feb
|
Mar
|
Apr
(13) |
May
(8) |
Jun
(2) |
Jul
(3) |
Aug
(10) |
Sep
|
Oct
(2) |
Nov
|
Dec
(1) |
2018 |
Jan
(2) |
Feb
(4) |
Mar
(2) |
Apr
(7) |
May
|
Jun
(8) |
Jul
|
Aug
(8) |
Sep
(2) |
Oct
(2) |
Nov
(8) |
Dec
(6) |
2019 |
Jan
(2) |
Feb
|
Mar
(1) |
Apr
|
May
(1) |
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(3) |
2020 |
Jan
(3) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2021 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(3) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2022 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Zenith432 <zen...@us...> - 2016-04-29 08:23:06
|
I hope this time I got it right.... Previous patch does not work for sections containing instructions other than the .text section. Here's another try, and I think this is it. =========== begin patch diff a/output/outmacho.c b/output/outmacho.c --- a/output/outmacho.c +++ b/output/outmacho.c @@ -464,6 +464,8 @@ static int64_t add_reloc(struct section *sect, int32_t section, r->snum = raa_read(extsyms, section); if (reltype == RL_BRANCH) r->type = X86_64_RELOC_BRANCH; + if (r->type == GENERIC_RELOC_VANILLA) + adjust = -sect->size; } else { /* local */ r->ext = 0; @@ -1320,6 +1322,8 @@ static void macho_write_section (void) l += sectstab[r->snum]->addr; if (r->pcrel) l -= s->addr; + } else if (r->pcrel && r->type == GENERIC_RELOC_VANILLA) { + l -= s->addr; } /* write new offset back */ =========== end patch Attached are also 1) test32.nasm and test64.nasm designed to do a comprehensive test of pc-relative relocations. 2) sample_disasm.txt of what a disassembly by 'otool -jV' should look like. |
From: Cyrill G. <gor...@gm...> - 2016-04-28 21:20:26
|
On Thu, Apr 28, 2016 at 01:48:15PM -0700, Fabian Giesen wrote: > When assembling on Windows machines with CRLF line endings, computing > the MD5 hash from the file read in "text" mode (transforms CRLF->LF) > gives incorrect results. > > Signed-off-by: Fabian Giesen <fa...@ra...> Thanks for all your patches, Fabian! I'll try take a look on the weekend. |
From: Fabian G. <fa...@ra...> - 2016-04-28 21:19:57
|
The hash calculation in calc_md5 tries to open the source file via "filename" again. For %includes, this is the file name that was specified in the %include directive, not the actual name of the file that was opened by the preprocessor. In other words, this fails if the include file is not in the current working directory. Add pp_input_fopen that uses the preprocessor include path lookup code to resolve a file name and open it, and use that in codeview.c. Signed-off-by: Fabian Giesen <fa...@ra...> --- output/codeview.c | 3 ++- preproc.c | 17 +++++++++++++++++ preproc.h | 3 +++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/output/codeview.c b/output/codeview.c index a63fd63..b3d6248 100644 --- a/output/codeview.c +++ b/output/codeview.c @@ -44,6 +44,7 @@ #include "nasm.h" #include "nasmlib.h" +#include "preproc.h" #include "saa.h" #include "output/outlib.h" #include "output/pecoff.h" @@ -308,7 +309,7 @@ static void calc_md5(const char *const filename, FILE *f; MD5_CTX ctx; - f = fopen(filename, "r"); + f = pp_input_fopen(filename); if (!f) goto done; diff --git a/preproc.c b/preproc.c index 343a77d..a504b88 100644 --- a/preproc.c +++ b/preproc.c @@ -1555,6 +1555,23 @@ static FILE *inc_fopen(const char *file, StrList **dhead, StrList ***dtail, } /* + * Opens an include or input file. Public version, for use by modules + * that get a file:lineno pair and need to look at the file again + * (e.g. the CodeView debug backend). Returns NULL on failure. + */ +FILE *pp_input_fopen(const char *filename) +{ + FILE *fp; + StrList *xsl = NULL; + StrList **xst = &xsl; + + fp = inc_fopen(filename, &xsl, &xst, true); + if (xsl) + nasm_free(xsl); + return fp; +} + +/* * Determine if we should warn on defining a single-line macro of * name `name', with `nparam' parameters. If nparam is 0 or -1, will * return true if _any_ single-line macro of that name is defined. diff --git a/preproc.h b/preproc.h index fdda37c..3dee45f 100644 --- a/preproc.h +++ b/preproc.h @@ -48,4 +48,7 @@ typedef const unsigned char macros_t; enum preproc_token pp_token_hash(const char *token); +/* Opens an include file or input file. This uses the include path. */ +FILE *pp_input_fopen(const char *filename); + #endif -- 2.8.1 |
From: Fabian G. <fa...@ra...> - 2016-04-28 21:19:54
|
Previously, debug info would refer to the first file seen, even when it did not actually generate line numbers (e.g. segto=-1). Fix it so we only lock in the file name the first time we actually produce a line number record. Not as good as proper support for debug info referencing multiple source files but much more useful than the current behavior. Signed-off-by: Fabian Giesen <fa...@ra...> --- output/codeview.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/output/codeview.c b/output/codeview.c index 0a38268..cfdd825 100644 --- a/output/codeview.c +++ b/output/codeview.c @@ -169,9 +169,6 @@ static void cv8_linenum(const char *filename, int32_t linenumber, struct coff_Section *s; struct linepair *li; - if (cv8_state.source_file.name == NULL) - register_file(filename); - s = find_section(segto); if (s == NULL) return; @@ -179,6 +176,9 @@ static void cv8_linenum(const char *filename, int32_t linenumber, if ((s->flags & IMAGE_SCN_MEM_EXECUTE) == 0) return; + if (cv8_state.source_file.name == NULL) + register_file(filename); + li = saa_wstruct(cv8_state.lines); li->file_offset = cv8_state.text_offset; li->linenumber = linenumber; -- 2.8.1 |
From: Fabian G. <fa...@ra...> - 2016-04-28 21:17:55
|
When assembling on Windows machines with CRLF line endings, computing the MD5 hash from the file read in "text" mode (transforms CRLF->LF) gives incorrect results. Signed-off-by: Fabian Giesen <fa...@ra...> --- output/codeview.c | 2 +- preproc.c | 12 ++++++------ preproc.h | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/output/codeview.c b/output/codeview.c index b3d6248..0a38268 100644 --- a/output/codeview.c +++ b/output/codeview.c @@ -309,7 +309,7 @@ static void calc_md5(const char *const filename, FILE *f; MD5_CTX ctx; - f = pp_input_fopen(filename); + f = pp_input_fopen(filename, "rb"); if (!f) goto done; diff --git a/preproc.c b/preproc.c index a504b88..08e3ad5 100644 --- a/preproc.c +++ b/preproc.c @@ -1504,7 +1504,7 @@ static bool in_list(const StrList *list, const char *str) * the end of the path. */ static FILE *inc_fopen(const char *file, StrList **dhead, StrList ***dtail, - bool missing_ok) + bool missing_ok, const char *mode) { FILE *fp; char *prefix = ""; @@ -1517,7 +1517,7 @@ static FILE *inc_fopen(const char *file, StrList **dhead, StrList ***dtail, sl = nasm_malloc(prefix_len+len+1+sizeof sl->next); memcpy(sl->str, prefix, prefix_len); memcpy(sl->str+prefix_len, file, len+1); - fp = fopen(sl->str, "r"); + fp = fopen(sl->str, mode); if (fp && dhead && !in_list(*dhead, sl->str)) { sl->next = NULL; **dtail = sl; @@ -1559,13 +1559,13 @@ static FILE *inc_fopen(const char *file, StrList **dhead, StrList ***dtail, * that get a file:lineno pair and need to look at the file again * (e.g. the CodeView debug backend). Returns NULL on failure. */ -FILE *pp_input_fopen(const char *filename) +FILE *pp_input_fopen(const char *filename, const char *mode) { FILE *fp; StrList *xsl = NULL; StrList **xst = &xsl; - fp = inc_fopen(filename, &xsl, &xst, true); + fp = inc_fopen(filename, &xsl, &xst, true, mode); if (xsl) nasm_free(xsl); return fp; @@ -2512,7 +2512,7 @@ static int do_directive(Token * tline) inc = nasm_malloc(sizeof(Include)); inc->next = istk; inc->conds = NULL; - inc->fp = inc_fopen(p, dephead, &deptail, pass == 0); + inc->fp = inc_fopen(p, dephead, &deptail, pass == 0, "r"); if (!inc->fp) { /* -MG given but file not found */ nasm_free(inc); @@ -3253,7 +3253,7 @@ issue_error: if (t->type != TOK_INTERNAL_STRING) nasm_unquote(p, NULL); - fp = inc_fopen(p, &xsl, &xst, true); + fp = inc_fopen(p, &xsl, &xst, true, "r"); if (fp) { p = xsl->str; fclose(fp); /* Don't actually care about the file */ diff --git a/preproc.h b/preproc.h index 3dee45f..3d1aa9c 100644 --- a/preproc.h +++ b/preproc.h @@ -49,6 +49,6 @@ typedef const unsigned char macros_t; enum preproc_token pp_token_hash(const char *token); /* Opens an include file or input file. This uses the include path. */ -FILE *pp_input_fopen(const char *filename); +FILE *pp_input_fopen(const char *filename, const char *mode); #endif -- 2.8.1 |
From: Zenith432 <zen...@us...> - 2016-04-28 15:18:11
|
Please accept a correction to my previous post. The patch in that post breaks relocations of type X86_64_RELOC_SIGNED in macho64. The following patch restricts the correction to macho32 object files. ----------begin patch diff a/output/outmacho.c b/output/outmacho.c --- a/output/outmacho.c +++ b/output/outmacho.c @@ -464,6 +464,8 @@ static int64_t add_reloc(struct section *sect, int32_t section, r->snum = raa_read(extsyms, section); if (reltype == RL_BRANCH) r->type = X86_64_RELOC_BRANCH; + if (r->type == GENERIC_RELOC_VANILLA) + adjust = -sect->size; } else { /* local */ r->ext = 0; ----------end patch |
From: Zenith432 <zen...@us...> - 2016-04-28 10:35:55
|
Attached is a patch to fix http://bugzilla.nasm.us/show_bug.cgi?id=3392348 that I filed. The patch is relative to git commit 3421a3f3f34a9b6c4edef69e40dc1b38d58dade3 dated Sun, 24 Apr 2016 20:57:52 +0300 -------------------- begin patch diff a/output/outmacho.c b/output/outmacho.c --- a/output/outmacho.c +++ b/output/outmacho.c @@ -464,6 +464,8 @@ static int64_t add_reloc(struct section *sect, int32_t section, r->snum = raa_read(extsyms, section); if (reltype == RL_BRANCH) r->type = X86_64_RELOC_BRANCH; + else + adjust = -sect->size; } else { /* local */ r->ext = 0; -------------------- end patch I tested it on the sample program I provided with 3392348, and assembled with 3 variants of NASM 1) nasm v2.12.01 OS X binary as published on nasm.us. 2) Apple's nasm that comes with Xcode 7.3, and is versioned as NASM version 0.98.40 (Apple Computer, Inc. build 11) compiled on Feb 10 2016 3) nasm complied from source of commit 3421a3f3f patched with patch above. Apple's nasm, and patched nasm both give the same result in .o file (assembled with -f macho, or -f macho32). The published binary of v2.12.01 gives a wrong result as explained in bug 3392348. I believe this patch also solves bug 3392346, which is probably due to the same problem, but there's not enough information in the bug description to be sure. Regards. |
From: Fabian G. <fa...@ra...> - 2016-04-28 04:36:33
|
The hash calculation in calc_md5 tries to open the source file via "filename" again. For %includes, this is the file name that was specified in the %include directive, not the actual name of the file that was opened by the preprocessor. In other words, this fails if the include file is not in the current working directory. Add pp_input_fopen that uses the preprocessor include path lookup code to resolve a file name and open it, and use that in codeview.c. Signed-off-by: Fabian Giesen <fa...@ra...> --- output/codeview.c | 3 ++- preproc.c | 17 +++++++++++++++++ preproc.h | 3 +++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/output/codeview.c b/output/codeview.c index a63fd63..b3d6248 100644 --- a/output/codeview.c +++ b/output/codeview.c @@ -44,6 +44,7 @@ #include "nasm.h" #include "nasmlib.h" +#include "preproc.h" #include "saa.h" #include "output/outlib.h" #include "output/pecoff.h" @@ -308,7 +309,7 @@ static void calc_md5(const char *const filename, FILE *f; MD5_CTX ctx; - f = fopen(filename, "r"); + f = pp_input_fopen(filename); if (!f) goto done; diff --git a/preproc.c b/preproc.c index 343a77d..a504b88 100644 --- a/preproc.c +++ b/preproc.c @@ -1555,6 +1555,23 @@ static FILE *inc_fopen(const char *file, StrList **dhead, StrList ***dtail, } /* + * Opens an include or input file. Public version, for use by modules + * that get a file:lineno pair and need to look at the file again + * (e.g. the CodeView debug backend). Returns NULL on failure. + */ +FILE *pp_input_fopen(const char *filename) +{ + FILE *fp; + StrList *xsl = NULL; + StrList **xst = &xsl; + + fp = inc_fopen(filename, &xsl, &xst, true); + if (xsl) + nasm_free(xsl); + return fp; +} + +/* * Determine if we should warn on defining a single-line macro of * name `name', with `nparam' parameters. If nparam is 0 or -1, will * return true if _any_ single-line macro of that name is defined. diff --git a/preproc.h b/preproc.h index fdda37c..3dee45f 100644 --- a/preproc.h +++ b/preproc.h @@ -48,4 +48,7 @@ typedef const unsigned char macros_t; enum preproc_token pp_token_hash(const char *token); +/* Opens an include file or input file. This uses the include path. */ +FILE *pp_input_fopen(const char *filename); + #endif -- 2.8.1 |
From: Cyrill G. <gor...@gm...> - 2016-04-21 07:02:14
|
On Wed, Apr 20, 2016 at 11:31:39PM -0700, H. Peter Anvin wrote: > On 04/20/16 23:22, Cyrill Gorcunov wrote: > >On Wed, Apr 20, 2016 at 11:17:53PM -0700, H. Peter Anvin wrote: > >>On 04/20/16 23:15, nasm-bot for Knut St. Osmundsen wrote: > >>>+L = lib > >> > >>This should be $(A) not $(L), but that's an easy fix. > > > >Could you please? > > > Yeah. It's cosmetic, so I'll worry about it later. OK, thanks! |
From: H. P. A. <hp...@zy...> - 2016-04-21 06:31:51
|
On 04/20/16 23:22, Cyrill Gorcunov wrote: > On Wed, Apr 20, 2016 at 11:17:53PM -0700, H. Peter Anvin wrote: >> On 04/20/16 23:15, nasm-bot for Knut St. Osmundsen wrote: >>> +L = lib >> >> This should be $(A) not $(L), but that's an easy fix. > > Could you please? > Yeah. It's cosmetic, so I'll worry about it later. -hpa |
From: Cyrill G. <gor...@gm...> - 2016-04-21 06:23:04
|
On Wed, Apr 20, 2016 at 11:17:53PM -0700, H. Peter Anvin wrote: > On 04/20/16 23:15, nasm-bot for Knut St. Osmundsen wrote: > > +L = lib > > This should be $(A) not $(L), but that's an easy fix. Could you please? |
From: H. P. A. <hp...@zy...> - 2016-04-21 06:18:06
|
On 04/20/16 23:15, nasm-bot for Knut St. Osmundsen wrote: > +L = lib This should be $(A) not $(L), but that's an easy fix. -hpa |
From: Cyrill G. <gor...@gm...> - 2016-04-21 06:15:23
|
On Wed, Apr 20, 2016 at 10:33:25PM -0700, H. Peter Anvin wrote: > > Looks good to me! > Pushed into @master. Thanks all! | committ 6fd298418b6d57d8513ad916f650ee815bef80af | Author: Knut St. Osmundsen <bir...@an...> | Date: Thu Apr 21 09:13:19 2016 +0300 | | msvc.mak: Build fixes, updates and improvements. | | * Added missing rules for creating a library out of LIBOBJ | and using it when linking. | * Updated the clean rule and PRELREQ list. | * Always build with debug info as it ends up in external PDB files | anyway and doesn't really impact binary size. | * Added /RELEASE to the LDFLAGS so the linker checksums the headers and | the binary can be signed. | | Signed-off-by: Knut St. Osmundsen<bir...@an...> | Reviewed-by: "H. Peter Anvin" <hp...@zy...> | Signed-off-by: Cyrill Gorcunov <gor...@gm...> |
From: Cyrill G. <gor...@gm...> - 2016-04-21 05:58:26
|
On Wed, Apr 20, 2016 at 10:33:25PM -0700, H. Peter Anvin wrote: > > > > Hi Knut! Thanks a huge for the patch! (And sorry for delay > > in response). The patch istself looks ok to me, but I'm not > > msvc nmake expert. I tend to merge it, but would love > > to hear Peter's opinion first (CC'ed). > > > > Looks good to me! Thanks! Will merge! |
From: Cyrill G. <gor...@gm...> - 2016-04-21 05:56:24
|
On Wed, Apr 20, 2016 at 10:35:24PM -0700, H. Peter Anvin wrote: > > Looks really good to me. Great, I'll merge it on the weekend. |
From: H. P. A. <hp...@zy...> - 2016-04-21 05:42:04
|
On 04/14/16 04:07, Knut St. Osmundsen wrote: > Hi! > > Found the problem. You dropped a '!' when merging error and error_preproc. > > Kind Regards, > bird. > Indeed... I beat you to fixing it though... it is in 2.12.02rc1 :) -hpa |
From: H. P. A. <hp...@zy...> - 2016-04-21 05:37:45
|
On 04/12/16 17:04, Knut St. Osmundsen wrote: > Hi! > > Ran into a little problem with the OMF output backend and relocations of > RIP relative addresses followed by an immediate. For example this: > and byte [rel g_bBs3CurrentMode wrt BS3FLAT], ~0x0f > ended up 2 bytes after the g_bBs3CurrentMode symbol. > > Problem was that the adjusting was done the wrong way, instead of > subtracting the size of the immediate value, it was added. The patch > below explains it in (too much?) details and fixes the problem for me. > > Unless nasm has some way of defining data with a relative reference as > value (along the lines of "dd rel somesymbol" or "this: dd (somesymbol - > this - 4)") that I don't know about, AFAIK the size != realsize() > problem should never happen with 16-bit and 32-bit x86 instruction, only > when encoding RIP relative addresses in 64-bit mode. > Not yet, but before that happens we are planning to rework some of the backend interface anyway. -hpa |
From: H. P. A. <hp...@zy...> - 2016-04-21 05:35:37
|
On 04/07/16 15:16, Cyrill Gorcunov wrote: > Not everything yet covered but just to share for easier review. > It's sitting in https://github.com/cyrillos/nasm/tree/uelf > > The series is on top of 89c1770e14c8ca3fa478ddf3106f76835fc0704f > > Cyrill Gorcunov (18): > out: Elfx32, Elf32 -- Unify elf_add_reloc > out: Elf32 -- Add missing comment > out: Elf32, Elfx32, Elf64 -- Use ofmt->maxbits > out: Elf64, Elf32, Elfx32 -- Style merge > out: Elf32 -- Unify struct symlininfo > out: Elf32 -- Reuse TY_DEBUGSYMLIN > out: Elf32, Elfx32 -- Unify struct ELF_SECTDATA and @elf_foffs > out: Elf64, Elfx32 -- Style fix > out: Elf32, Elfx32 -- Unify elf_sect_write, elf_section_header and add > elf_sect_writeaddr > out: Elf32, Elfx32, Elf64 -- more unifications > out: Elf32 -- Unify dwarf_ nums > out: Elf32, Elfx32, Elf64 -- Unify elf_init and elf_deflabel > out: Elf64, Elfx32 -- Drop useless DEBUG > output: Elf32, Elfx32, Elf64 -- Declare ofmt for all > out: Elf32 -- A few more constants usage > output: Elf32, Elfx32 -- Unify elf_add_gsym_reloc > output: Elf32 -- Shuffle few lines to make it close to other code > output: Elf32, Elfx32 -- Use 64 bit address > Looks really good to me. -hpa |
From: H. P. A. <hp...@zy...> - 2016-04-21 05:33:45
|
On 04/17/16 11:21, Cyrill Gorcunov wrote: > On Thu, Apr 14, 2016 at 11:58:46PM +0200, Knut St. Osmundsen wrote: >> Hi! >> >> Since I had to fix the broken mkfiles/msvc.mak to fix and build me a new >> nasm here, I thought I share the patch. >> >> msvc.mak: Build fixes, updates and improvements. >> * Added missing rules for creating a library out of LIBOBJ and using it >> when linking. >> * Updated the clean rule and PRELREQ list. >> * Always build with debug info as it ends up in external PDB files >> anyway and doesn't really impact binary size. >> * Added /RELEASE to the LDFLAGS so the linker checksums the headers and >> the binary can be signed. >> >> .gitignore: Ignore above libraries, debuginfo. >> >> >> Kind Regards, >> bird. >> >> Signed-off-by: Knut St. Osmundsen <bir...@an...> > > Hi Knut! Thanks a huge for the patch! (And sorry for delay > in response). The patch istself looks ok to me, but I'm not > msvc nmake expert. I tend to merge it, but would love > to hear Peter's opinion first (CC'ed). > Looks good to me! -hpa |
From: Cyrill G. <gor...@gm...> - 2016-04-17 18:21:58
|
On Thu, Apr 14, 2016 at 11:58:46PM +0200, Knut St. Osmundsen wrote: > Hi! > > Since I had to fix the broken mkfiles/msvc.mak to fix and build me a new > nasm here, I thought I share the patch. > > msvc.mak: Build fixes, updates and improvements. > * Added missing rules for creating a library out of LIBOBJ and using it > when linking. > * Updated the clean rule and PRELREQ list. > * Always build with debug info as it ends up in external PDB files > anyway and doesn't really impact binary size. > * Added /RELEASE to the LDFLAGS so the linker checksums the headers and > the binary can be signed. > > .gitignore: Ignore above libraries, debuginfo. > > > Kind Regards, > bird. > > Signed-off-by: Knut St. Osmundsen <bir...@an...> Hi Knut! Thanks a huge for the patch! (And sorry for delay in response). The patch istself looks ok to me, but I'm not msvc nmake expert. I tend to merge it, but would love to hear Peter's opinion first (CC'ed). |
From: Knut S. O. <bir...@an...> - 2016-04-15 09:24:13
|
Hi again. I ended up fixing the Open Watcom build as well the other day, adding librarian support to the makefile and fixing rules for perl generated sources. Also enabled using the automatic borland/watcom dependencies, optional debug info, and adjusted the clean rule a little. OW v1.9 has trouble with switching on 64-bit integers, so I had to convert three minor switch statements to if statements. It also have some issues comparing default integers and 64-bit integers, or something along those lines, so I had to apply UINT64_C() to a couple of constants too. Kind Regards, bird. Signed-off-by: Knut St. Osmundsen<bir...@an...> --- Mkfiles/openwcom.mak | 69 +++++++++++++++++++++++++++++++++------------------- assemble.c | 8 ++---- output/codeview.c | 5 ++-- parser.c | 24 ++++++------------ 4 files changed, 57 insertions(+), 49 deletions(-) diff --git a/Mkfiles/openwcom.mak b/Mkfiles/openwcom.mak index 4382536..4e1681f 100644 --- a/Mkfiles/openwcom.mak +++ b/Mkfiles/openwcom.mak @@ -1,33 +1,42 @@ # -*- makefile -*- # -# Makefile for building NASM using OpenWatcom +# Makefile (wmake) for building NASM using OpenWatcom # cross-compile on a DOS/Win32/OS2/Linux platform host # top_srcdir = . srcdir = . -VPATH = .;$(srcdir)/output;$(srcdir)/lib +VPATH = .;$(srcdir)/output;$(srcdir)/lib;$(srcdir)/stdlib;$(srcdir)/nasmlib prefix = C:\Program Files\NASM exec_prefix = $(prefix) bindir = $(prefix)\bin mandir = $(prefix)\man +!if "$(DEBUG)" == "1" +CDEBUG = -d2 -hd +LDEBUG = debug dwarf +!else +CDEBUG = +LDEBUG = +!endif + CC = *wcl386 -DEBUG = -CFLAGS = -zq -6 -ox -wx -ze -fpi $(DEBUG) +CFLAGS = -zq -6 -ox -wx -ze -fpi $(CDEBUG) BUILD_CFLAGS = $(CFLAGS) $(%TARGET_CFLAGS) INTERNAL_CFLAGS = -I$(srcdir) -I. -DHAVE_CONFIG_H ALL_CFLAGS = $(BUILD_CFLAGS) $(INTERNAL_CFLAGS) LD = *wlink -LDEBUG = LDFLAGS = op quiet $(%TARGET_LFLAGS) $(LDEBUG) LIBS = +AR = *wlib +ARFLAGS = -n -q -b PERL = perl -I$(srcdir)/perllib STRIP = wstrip # Binary suffixes O = obj +L = lib X = .exe # WMAKE errors out if a suffix is declared more than once, including @@ -40,7 +49,7 @@ X = .exe # Needed to find C files anywhere but in the current directory .c : $(VPATH) -.c.$(O): +.c.$(O): .AUTODEPEND @set INCLUDE= $(CC) -c $(ALL_CFLAGS) -fo=$^@ $[@ @@ -102,11 +111,14 @@ linux386: .SYMBOLIC all: config.h perlreq nasm$(X) ndisasm$(X) .SYMBOLIC # cd rdoff && $(MAKE) all -nasm$(X): $(NASM) - $(LD) $(LDFLAGS) name nasm$(X) file {$(NASM)} $(LIBS) +nasm$(X): $(NASM) nasm.$(L) + $(LD) $(LDFLAGS) name nasm$(X) file {$(NASM)} library {nasm.$(L) $(LIBS)} ndisasm$(X): $(NDISASM) - $(LD) $(LDFLAGS) name ndisasm$(X) file {$(NDISASM)} $(LIBS) + $(LD) $(LDFLAGS) name ndisasm$(X) file {$(NDISASM)} library {nasm.$(L) $(LIBS)} + +nasm.$(L): $(LIBOBJ) + $(AR) $(ARFLAGS) -o $@ +$(LIBOBJ: = +) # These source files are automagically generated from a single # instruction-table file by a Perl script. They're distributed, @@ -115,18 +127,23 @@ ndisasm$(X): $(NDISASM) insns.pl: insns-iflags.pl -iflag.c iflag.h: insns.dat insns.pl - $(PERL) $(srcdir)/insns.pl -t $(srcdir)/insns.dat -insnsb.c: insns.dat insns.pl - $(PERL) $(srcdir)/insns.pl -b $(srcdir)/insns.dat -insnsa.c: insns.dat insns.pl - $(PERL) $(srcdir)/insns.pl -a $(srcdir)/insns.dat -insnsd.c: insns.dat insns.pl - $(PERL) $(srcdir)/insns.pl -d $(srcdir)/insns.dat -insnsi.h: insns.dat insns.pl - $(PERL) $(srcdir)/insns.pl -i $(srcdir)/insns.dat -insnsn.c: insns.dat insns.pl - $(PERL) $(srcdir)/insns.pl -n $(srcdir)/insns.dat +INSDEP = insns.dat insns.pl insns-iflags.pl + +iflag.c: $(INSDEP) + $(PERL) $(srcdir)/insns.pl -fc $(srcdir)/insns.dat +iflaggen.h: $(INSDEP) + $(PERL) $(srcdir)/insns.pl -fh $(srcdir)/insns.dat +insnsb.c: $(INSDEP) + $(PERL) $(srcdir)/insns.pl -b $(srcdir)/insns.dat +insnsa.c: $(INSDEP) + $(PERL) $(srcdir)/insns.pl -a $(srcdir)/insns.dat +insnsd.c: $(INSDEP) + $(PERL) $(srcdir)/insns.pl -d $(srcdir)/insns.dat +insnsi.h: $(INSDEP) + $(PERL) $(srcdir)/insns.pl -i $(srcdir)/insns.dat +insnsn.c: $(INSDEP) + $(PERL) $(srcdir)/insns.pl -n $(srcdir)/insns.dat + # These files contains all the standard macros that are derived from # the version number. @@ -189,13 +206,15 @@ PERLREQ = pptok.ph macros.c insnsb.c insnsa.c insnsd.c insnsi.h insnsn.c & tokhash.c tokens.h pptok.h pptok.c & directiv.c directiv.h & version.h version.mac & - iflag.c iflag.h + iflag.c iflaggen.h perlreq: $(PERLREQ) .SYMBOLIC clean: .SYMBOLIC - rm -f *.$(O) *.s *.i - rm -f lib/*.$(O) lib/*.s lib/*.i - rm -f output/*.$(O) output/*.s output/*.i + rm -f *.$(O) *.$(L) *.s *.i *.err + rm -f lib/*.$(O) lib/*.s lib/*.i lib/*.err + rm -f output/*.$(O) output/*.s output/*.i output/*.err + rm -f nasmlib/*.$(O) nasmlib/*.$(L) nasmlib/*.s nasmlib/*.i nasmlib/*.err + rm -f stdlib/*.$(O) stdlib/*.$(L) stdlib/*.s stdlib/*.i stdlib/*.err rm -f config.h config.log config.status rm -f nasm$(X) ndisasm$(X) # cd rdoff && $(MAKE) clean diff --git a/assemble.c b/assemble.c index 0fe323c..57ad6f3 100644 --- a/assemble.c +++ b/assemble.c @@ -2153,14 +2153,10 @@ static uint8_t get_broadcast_num(opflags_t opflags, opflags_t brsize) nasm_error(ERR_FATAL, "size of broadcasting element is greater than 64 bits"); - switch (opsize) { - case BITS64: + if (opsize == BITS64) brcast_num = BITS64 / brsize; - break; - default: + else brcast_num = (opsize / BITS128) * (BITS64 / brsize) * 2; - break; - } return brcast_num; } diff --git a/output/codeview.c b/output/codeview.c index a63fd63..8ddc692 100644 --- a/output/codeview.c +++ b/output/codeview.c @@ -364,6 +364,7 @@ static void register_reloc(struct coff_Section *const sect, { struct coff_Reloc *r; struct coff_Section *sec; + uint32_t i; r = *sect->tail = nasm_malloc(sizeof(struct coff_Reloc)); sect->tail = &r->next; @@ -375,7 +376,7 @@ static void register_reloc(struct coff_Section *const sect, r->type = type; r->symbol = 0; - for (int i = 0; i < coff_nsects; i++) { + for (i = 0; i < (uint32_t)coff_nsects; i++) { sec = coff_sects[i]; if (!strcmp(sym, sec->name)) { return; @@ -384,7 +385,7 @@ static void register_reloc(struct coff_Section *const sect, } saa_rewind(coff_syms); - for (uint32_t i = 0; i < coff_nsyms; i++) { + for (i = 0; i < coff_nsyms; i++) { struct coff_Symbol *s = saa_rstruct(coff_syms); r->symbol++; if (s->strpos == -1 && !strcmp(sym, s->name)) { diff --git a/parser.c b/parser.c index 6210cc6..5c6b594 100644 --- a/parser.c +++ b/parser.c @@ -214,18 +214,15 @@ static bool parse_braces(decoflags_t *decoflags) } *decoflags |= VAL_OPMASK(nasm_regvals[tokval.t_integer]); } else if (i == TOKEN_DECORATOR) { - switch (tokval.t_integer) { - case BRC_Z: + if (tokval.t_integer == BRC_Z) { /* * according to AVX512 spec, only zeroing/merging decorator * is supported with opmask */ *decoflags |= GEN_Z(0); - break; - default: + } else { nasm_error(ERR_NONFATAL, "{%s} is not an expected decorator", tokval.t_charptr); - break; } } else if (i == ',' || i == TOKEN_EOS){ break; @@ -1023,9 +1020,9 @@ is_expression: op->type |= SBYTEDWORD; if ((uint16_t) (n + 128) <= 255) op->type |= SBYTEWORD; - if (n <= 0xFFFFFFFF) + if (n <= UINT64_C(0xFFFFFFFF)) op->type |= UDWORD; - if (n + 0x80000000 <= 0xFFFFFFFF) + if (n + UINT64_C(0x80000000) <= UINT64_C(0xFFFFFFFF)) op->type |= SDWORD; } } @@ -1036,18 +1033,13 @@ is_expression: * of previous operand. */ opnum--; op--; - switch (value->value) { - case BRC_RN: - case BRC_RU: - case BRC_RD: - case BRC_RZ: - case BRC_SAE: + if ( value->value == BRC_RN || value->value == BRC_RU + || value->value == BRC_RD || value->value == BRC_RZ + || value->value == BRC_SAE) { op->decoflags |= (value->value == BRC_SAE ? SAE : ER); result->evex_rm = value->value; - break; - default: + } else { nasm_error(ERR_NONFATAL, "invalid decorator"); - break; } } else { /* it's a register */ opflags_t rs; -- 2.6.2.windows.1 |
From: Knut S. O. <bir...@an...> - 2016-04-14 21:59:09
|
Hi! Since I had to fix the broken mkfiles/msvc.mak to fix and build me a new nasm here, I thought I share the patch. msvc.mak: Build fixes, updates and improvements. * Added missing rules for creating a library out of LIBOBJ and using it when linking. * Updated the clean rule and PRELREQ list. * Always build with debug info as it ends up in external PDB files anyway and doesn't really impact binary size. * Added /RELEASE to the LDFLAGS so the linker checksums the headers and the binary can be signed. .gitignore: Ignore above libraries, debuginfo. Kind Regards, bird. Signed-off-by: Knut St. Osmundsen<bir...@an...> --- .gitignore | 3 +++ Mkfiles/msvc.mak | 34 +++++++++++++++++++++++++++------- 2 files changed, 30 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index b75eaa8..570bfc0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,8 @@ +*.a *.bin *.dbg *.exe +*.lib *.lst *.o *.o64 @@ -8,6 +10,7 @@ *.obj64 *.orig *.out +*.pdb *.rej *.xml *.swp diff --git a/Mkfiles/msvc.mak b/Mkfiles/msvc.mak index df7df39..f088f10 100644 --- a/Mkfiles/msvc.mak +++ b/Mkfiles/msvc.mak @@ -21,22 +21,26 @@ mandir = $(prefix)/man CFLAGS = /Od /Zi LDFLAGS = /DEBUG !ELSE -CFLAGS = /O2 +CFLAGS = /O2 /Zi +LDFLAGS = /DEBUG /OPT:REF /OPT:ICF # (latter two undoes /DEBUG harm) !ENDIF CC = cl LD = link +AR = lib CFLAGS = $(CFLAGS) /W2 BUILD_CFLAGS = $(CFLAGS) /I$(srcdir)/inttypes INTERNAL_CFLAGS = /I$(srcdir) /I. \ /DHAVE__SNPRINTF /DHAVE__VSNPRINTF /DHAVE__FULLPATH ALL_CFLAGS = $(BUILD_CFLAGS) $(INTERNAL_CFLAGS) -LDFLAGS = $(LDFLAGS) /SUBSYSTEM:CONSOLE +LDFLAGS = $(LDFLAGS) /SUBSYSTEM:CONSOLE /RELEASE LIBS = +ARFLAGS = /NOLOGO PERL = perl -I$(srcdir)/perllib # Binary suffixes O = obj +L = lib X = .exe .SUFFIXES: .c .i .s .$(O) .1 .man @@ -79,11 +83,14 @@ LIBOBJ = stdlib/snprintf.$(O) stdlib/vsnprintf.$(O) stdlib/strlcpy.$(O) \ all: nasm$(X) ndisasm$(X) rem cd rdoff && $(MAKE) all -nasm$(X): $(NASM) - $(LD) $(LDFLAGS) /OUT:nasm$(X) $(NASM) $(LIBS) +nasm$(X): $(NASM) nasm.$(L) + $(LD) $(LDFLAGS) /OUT:nasm$(X) $(NASM) $(LIBS) nasm.$(L) -ndisasm$(X): $(NDISASM) - $(LD) $(LDFLAGS) /OUT:ndisasm$(X) $(NDISASM) $(LIBS) +ndisasm$(X): $(NDISASM) nasm.$(L) + $(LD) $(LDFLAGS) /OUT:ndisasm$(X) $(NDISASM) $(LIBS) nasm.$(L) + +nasm.$(L): $(LIBOBJ) + $(AR) $(ARFLAGS) /OUT:$@ $** # These source files are automagically generated from a single # instruction-table file by a Perl script. They're distributed, @@ -169,19 +176,32 @@ directiv.c: directiv.dat directiv.pl perllib/phash.ph # This allows easier generation of distribution (see dist target). PERLREQ = macros.c insnsb.c insnsa.c insnsd.c insnsi.h insnsn.c \ regs.c regs.h regflags.c regdis.c regvals.c tokhash.c tokens.h \ - version.h version.mac pptok.h pptok.c iflag.c iflag.h + version.h version.mac pptok.h pptok.c iflag.c iflaggen.h \ + directiv.c directiv.h pptok.ph regdis.h perlreq: $(PERLREQ) clean: -del /f *.$(O) + -del /f *.pdb -del /f *.s -del /f *.i -del /f lib\*.$(O) + -del /f lib\*.pdb -del /f lib\*.s -del /f lib\*.i -del /f output\*.$(O) + -del /f output\*.pdb -del /f output\*.s -del /f output\*.i + -del /f nasmlib\*.$(O) + -del /f nasmlib\*.pdb + -del /f nasmlib\*.s + -del /f nasmlib\*.i + -del /f stdlib\*.$(O) + -del /f stdlib\*.pdb + -del /f stdlib\*.s + -del /f stdlib\*.i + -del /f nasm.$(L) -del /f nasm$(X) -del /f ndisasm$(X) rem cd rdoff && $(MAKE) clean -- 2.6.2.windows.1 |
From: Knut S. O. <bir...@an...> - 2016-04-14 11:08:21
|
Hi! Found the problem. You dropped a '!' when merging error and error_preproc. Kind Regards, bird. Signed-off-by: Knut St. Osmundsen<bir...@an...> --- preproc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/preproc.c b/preproc.c index 343a77d..255ccae 100644 --- a/preproc.c +++ b/preproc.c @@ -4795,7 +4795,7 @@ static void pp_verror(int severity, const char *fmt, va_list arg) istk && istk->conds && ((severity & ERR_PP_PRECOND) ? istk->conds->state == COND_NEVER : - emitting(istk->conds->state))) + !emitting(istk->conds->state))) return; /* get %macro name */ -- 2.6.2.windows.1 On 2016-03-31 11:44 PM, H. Peter Anvin wrote: > On 03/31/16 07:18, Knut St. Osmundsen wrote: >> Hi! >> >> Just built current git and found that an annoying regression had crept >> in since 2.12. The following code does not yield any warnings or errors: >> >> %ifndef NO_SUCH_DEFINE >> %warning "Warnings work!" >> %error "Errors works!" >> %endif >> >> Bisecting indicates that 215186fe82c461bc1ccef7bed5c1a1a0253bfcc9 is the >> first bad commit. > Thanks for the alert!! > >> PS. Visual C++ 2010 still isn't happy with output/codeview.c, there are >> two for loops in register_reloc() that declare variables inside the for >> statement. > Thanks. This should be easy to fix. I'm surprised that the new warning > options don't trigger. > > -hpa > > > > ------------------------------------------------------------------------------ > Transform Data into Opportunity. > Accelerate data analysis in your applications with > Intel Data Analytics Acceleration Library. > Click to learn more. > http://pubads.g.doubleclick.net/gampad/clk?id=278785471&iu=/4140 > _______________________________________________ > Nasm-devel mailing list > Nas...@li... > https://lists.sourceforge.net/lists/listinfo/nasm-devel > |
From: Knut S. O. <bir...@an...> - 2016-04-13 00:05:13
|
Hi! Ran into a little problem with the OMF output backend and relocations of RIP relative addresses followed by an immediate. For example this: and byte [rel g_bBs3CurrentMode wrt BS3FLAT], ~0x0f ended up 2 bytes after the g_bBs3CurrentMode symbol. Problem was that the adjusting was done the wrong way, instead of subtracting the size of the immediate value, it was added. The patch below explains it in (too much?) details and fixes the problem for me. Unless nasm has some way of defining data with a relative reference as value (along the lines of "dd rel somesymbol" or "this: dd (somesymbol - this - 4)") that I don't know about, AFAIK the size != realsize() problem should never happen with 16-bit and 32-bit x86 instruction, only when encoding RIP relative addresses in 64-bit mode. Kind Regards, bird. Signed-off-by: Knut St. Osmundsen <bir...@an...> --- output/outobj.c | 40 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/output/outobj.c b/output/outobj.c index 71fbb9c..a9e16f0 100644 --- a/output/outobj.c +++ b/output/outobj.c @@ -1101,9 +1101,43 @@ static void obj_out(int32_t segto, const void *data, ldata = *(int64_t *)data; if (type != OUT_ADDRESS) { - ldata += size; - size = realsize(type, size); + /* + * For 16-bit and 32-bit x86 code, the size and realsize() always + * matches as only jumps, calls and loops uses PC relative + * addressing and the address isn't followed by any other opcode + * bytes. In 64-bit mode there is RIP relative addressing which + * means the fixup location can be followed by an immediate value, + * meaning that size > realsize(). + * + * When the CPU is calculating the effective address, it takes the + * RIP at the end of the instruction and adds the fixed up relative + * address value to it. + * + * The linker's point of reference is the end of the fixup location + * (which is the end of the instruction for Jcc, CALL, LOOP[cc]). + * It is calculating distance between the target symbol and the end + * of the fixup location, and add this to the displacement value we + * are calculating here and storing at the fixup location. + * + * To get the right effect, we need to _reduce_ the displacement + * value by the number of bytes following the fixup. + * + * Example: + * data at address 0x100; REL4ADR at 0x050, 4 byte immediate, + * end of fixup at 0x054, end of instruction at 0x058. + * => size = 8. + * => realsize() -> 4 + * => CPU needs a value of: 0x100 - 0x058 = 0x0a8 + * => linker/loader will add: 0x100 - 0x054 = 0x0ac + * => We must add an addend of -4. + * => realsize() - size = -4. + * + * The code used to do size - realsize() at least since v0.90, + * probably because it wasn't needed... + */ ldata -= size; + size = realsize(type, size); + ldata += size; } if (size > UINT_MAX) @@ -1111,6 +1145,8 @@ static void obj_out(int32_t segto, const void *data, switch ((unsigned int)size) { default: + /* FIXME: size=1 could be realized using 'Location' value 0. Both + link386 and wlink supports it (TIS/OMF PDF, wlink sources). */ nasm_error(ERR_NONFATAL, "OBJ format can only handle 16- or " "32-byte relocations"); segment = NO_SEG; /* Don't actually generate a relocation */ -- 2.6.2.windows.1 |
From: Cyrill G. <gor...@gm...> - 2016-04-07 22:17:20
|
Signed-off-by: Cyrill Gorcunov <gor...@gm...> --- output/outelf32.c | 26 ++++++++++---------------- output/outelfx32.c | 2 +- 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/output/outelf32.c b/output/outelf32.c index ace4630..9ad4869 100644 --- a/output/outelf32.c +++ b/output/outelf32.c @@ -665,8 +665,7 @@ static void elf_out(int32_t segto, const void *data, int32_t segment, int32_t wrt) { struct elf_section *s; - int32_t addr; - uint8_t mydata[8], *p; + int64_t addr; int reltype, bytes; int i; static struct symlininfo sinfo; @@ -712,8 +711,6 @@ static void elf_out(int32_t segto, const void *data, return; } - memset(mydata, 0, sizeof(mydata)); - switch (type) { case OUT_RESERVE: if (s->type == SHT_PROGBITS) { @@ -734,6 +731,7 @@ static void elf_out(int32_t segto, const void *data, { bool gnu16 = false; int asize = abs((int)size); + addr = *(int64_t *)data; if (segment != NO_SEG) { if (segment % 2) { @@ -806,15 +804,14 @@ static void elf_out(int32_t segto, const void *data, } } } - p = mydata; + if (gnu16) { nasm_error(ERR_WARNING | ERR_WARN_GNUELF, "8- or 16-bit relocations in ELF32 is a GNU extension"); } else if (asize != 4 && segment != NO_SEG) { nasm_error(ERR_NONFATAL, "Unsupported non-32-bit ELF relocation"); } - WRITEADDR(p, addr, asize); - elf_sect_write(s, mydata, asize); + elf_sect_writeaddr(s, addr, asize); break; } @@ -828,6 +825,7 @@ static void elf_out(int32_t segto, const void *data, goto rel12adr; rel12adr: + addr = *(int64_t *)data - size; nasm_assert(segment != segto); if (segment != NO_SEG && segment % 2) { nasm_error(ERR_NONFATAL, "ELF format does not support" @@ -842,12 +840,11 @@ static void elf_out(int32_t segto, const void *data, "Unsupported non-32-bit ELF relocation"); } } - p = mydata; - WRITESHORT(p, *(int64_t *)data - size); - elf_sect_write(s, mydata, bytes); + elf_sect_writeaddr(s, addr, bytes); break; case OUT_REL4ADR: + addr = *(int64_t *)data - size; if (segment == segto) nasm_panic(0, "intra-segment OUT_REL4ADR"); if (segment != NO_SEG && segment % 2) { @@ -869,17 +866,14 @@ static void elf_out(int32_t segto, const void *data, wrt = NO_SEG; /* we can at least _try_ to continue */ } } - p = mydata; - WRITELONG(p, *(int64_t *)data - size); - elf_sect_write(s, mydata, 4L); + elf_sect_writeaddr(s, addr, 4); break; case OUT_REL8ADR: nasm_error(ERR_NONFATAL, "32-bit ELF format does not support 64-bit relocations"); - p = mydata; - WRITEDLONG(p, 0); - elf_sect_write(s, mydata, 8L); + addr = 0; + elf_sect_writeaddr(s, addr, 8); break; } } diff --git a/output/outelfx32.c b/output/outelfx32.c index 45a949b..5e16561 100644 --- a/output/outelfx32.c +++ b/output/outelfx32.c @@ -666,7 +666,7 @@ static void elf_out(int32_t segto, const void *data, int32_t segment, int32_t wrt) { struct elf_section *s; - int32_t addr; + int64_t addr; int reltype, bytes; int i; static struct symlininfo sinfo; -- 2.5.5 |