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-10-22 16:03:13
|
Commit-ID: 7524cfd91492e6e3719b959498be584a9ced13af Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=7524cfd91492e6e3719b959498be584a9ced13af Author: Cyrill Gorcunov <gor...@gm...> AuthorDate: Sun, 22 Oct 2017 19:01:16 +0300 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Sun, 22 Oct 2017 19:01:16 +0300 preproc: Fix sigsegv in find_cc For specially formed code we can have skip_white_ to end up with nil pointer which should be taken into account. https://bugzilla.nasm.us/show_bug.cgi?id=3392435 Signed-off-by: Cyrill Gorcunov <gor...@gm...> --- asm/preproc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/asm/preproc.c b/asm/preproc.c index cd4a949..43b62aa 100644 --- a/asm/preproc.c +++ b/asm/preproc.c @@ -3714,6 +3714,8 @@ static int find_cc(Token * t) return -1; /* Probably a %+ without a space */ skip_white_(t); + if (!t) + return -1; if (t->type != TOK_ID) return -1; tt = t->next; |
From: nasm-bot f. C. G. <gor...@gm...> - 2017-10-22 15:57:33
|
Commit-ID: 59ce1c67b16967c652765e62aa130b7e43f21dd4 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=59ce1c67b16967c652765e62aa130b7e43f21dd4 Author: Cyrill Gorcunov <gor...@gm...> AuthorDate: Sun, 22 Oct 2017 18:42:07 +0300 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Sun, 22 Oct 2017 18:54:20 +0300 peproc: Fix sigsevg in smacro expansion In case if smacro is called with inapropriate number of arguments exit early. Actually we have to handle this situation more gracefully but this requires a way more efforts than two line patches (need to refactor macro expansion). https://bugzilla.nasm.us/show_bug.cgi?id=3392431 Signed-off-by: Cyrill Gorcunov <gor...@gm...> --- asm/preproc.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/asm/preproc.c b/asm/preproc.c index 404d3ec..cd4a949 100644 --- a/asm/preproc.c +++ b/asm/preproc.c @@ -4430,6 +4430,16 @@ again: ttt->text, 0); ptail = &pt->next; ttt = ttt->next; + if (!ttt && i > 0) { + /* + * FIXME: Need to handle more gracefully, + * exiting early on agruments analysis. + */ + nasm_error(ERR_FATAL, + "macro `%s' expects %d args", + mstart->text, + (int)paramsize[t->type - TOK_SMAC_PARAM]); + } } tline = pcopy; } else if (t->type == TOK_PREPROC_Q) { |
From: nasm-bot f. C. G. <gor...@gm...> - 2017-10-22 12:27:35
|
Commit-ID: c9244eaadd05b27637cde06021bac3fa1d920aa3 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=c9244eaadd05b27637cde06021bac3fa1d920aa3 Author: Cyrill Gorcunov <gor...@gm...> AuthorDate: Sun, 22 Oct 2017 15:25:48 +0300 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Sun, 22 Oct 2017 15:25:48 +0300 prepoc: mmacro -- Don't left nparam_max less than nparam_min Otherwise we hit nil dereference in best case. https://bugzilla.nasm.us/show_bug.cgi?id=3392436 Signed-off-by: Cyrill Gorcunov <gor...@gm...> --- asm/preproc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/asm/preproc.c b/asm/preproc.c index 7b1e2bf..404d3ec 100644 --- a/asm/preproc.c +++ b/asm/preproc.c @@ -1938,9 +1938,11 @@ static bool if_condition(Token * tline, enum preproc_token ct) nasm_error(ERR_NONFATAL, "unable to parse parameter count `%s'", tline->text); - if (searching.nparam_min > searching.nparam_max) + if (searching.nparam_min > searching.nparam_max) { nasm_error(ERR_NONFATAL, "minimum parameter count exceeds maximum"); + searching.nparam_max = searching.nparam_min; + } } } if (tline && tok_is_(tline->next, "+")) { @@ -2169,6 +2171,7 @@ static bool parse_mmacro_spec(Token *tline, MMacro *def, const char *directive) } if (def->nparam_min > def->nparam_max) { nasm_error(ERR_NONFATAL, "minimum parameter count exceeds maximum"); + def->nparam_max = def->nparam_min; } } } |
From: nasm-bot f. C. G. <gor...@gm...> - 2017-10-22 07:54:28
|
Commit-ID: 3144e84add8b152cc7a71e44617ce6f21daa4ba3 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=3144e84add8b152cc7a71e44617ce6f21daa4ba3 Author: Cyrill Gorcunov <gor...@gm...> AuthorDate: Sun, 22 Oct 2017 10:50:55 +0300 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Sun, 22 Oct 2017 10:50:55 +0300 preproc: Don't access offsting byte on unterminated strings https://bugzilla.nasm.us/show_bug.cgi?id=3392446 Signed-off-by: Cyrill Gorcunov <gor...@gm...> --- asm/preproc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/asm/preproc.c b/asm/preproc.c index a8388bc..7b1e2bf 100644 --- a/asm/preproc.c +++ b/asm/preproc.c @@ -948,7 +948,9 @@ static Token *tokenize(char *line) case '\'': case '\"': case '`': - p = nasm_skip_string(p - 1) + 1; + p = nasm_skip_string(p - 1); + if (*p) + p++; break; default: break; |
From: nasm-bot f. C. G. <gor...@gm...> - 2017-08-16 22:03:24
|
Commit-ID: d7a547336865b688e50278f24cc598c358d5d577 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=d7a547336865b688e50278f24cc598c358d5d577 Author: Cyrill Gorcunov <gor...@gm...> AuthorDate: Sat, 29 Jul 2017 16:05:36 +0300 Committer: H. Peter Anvin <hp...@zy...> CommitDate: Wed, 16 Aug 2017 14:59:25 -0700 configure: Add --enable-gdb option When one needs to run nasm under GDB Signed-off-by: Cyrill Gorcunov <gor...@gm...> Signed-off-by: H. Peter Anvin <hp...@zy...> --- configure.ac | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/configure.ac b/configure.ac index bc8a1a2..37f51af 100644 --- a/configure.ac +++ b/configure.ac @@ -32,6 +32,12 @@ PA_ARG_DISABLED([optimization], AS_IF([test x"$pa_init_cflags" = x], [CFLAGS=`echo "$CFLAGS" | sed -e "s/-O2/$pa_optimize/"`]) +dnl Compile and link with dwarf debug +PA_ARG_ENABLED([gdb], + [disable optimization and compile with extra debug information for GDB debugger], + [CFLAGS=`echo "$CFLAGS" | sed -e "s/\(-O2\|-O3\)/-O0/"` + PA_ADD_CLDFLAGS([-ggdb3])]) + dnl Check for library extension PA_LIBEXT |
From: nasm-bot f. C. G. <gor...@gm...> - 2017-08-16 22:03:17
|
Commit-ID: 750048723eb837b663828ff25e872b6054bebb38 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=750048723eb837b663828ff25e872b6054bebb38 Author: Cyrill Gorcunov <gor...@gm...> AuthorDate: Wed, 26 Jul 2017 01:21:16 +0300 Committer: H. Peter Anvin <hp...@zy...> CommitDate: Wed, 16 Aug 2017 14:59:15 -0700 preproc: Free token's text if only it has been modified https://bugzilla.nasm.us/show_bug.cgi?id=3392414 Signed-off-by: Cyrill Gorcunov <gor...@gm...> Signed-off-by: H. Peter Anvin <hp...@zy...> --- asm/preproc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/asm/preproc.c b/asm/preproc.c index f6e296b..0d0e104 100644 --- a/asm/preproc.c +++ b/asm/preproc.c @@ -1280,8 +1280,8 @@ static char *detoken(Token * tlist, bool expand_locals) t->text = nasm_zalloc(2); } else t->text = nasm_strdup(p); + nasm_free(q); } - nasm_free(q); } /* Expand local macros here and not during preprocessing */ |
From: nasm-bot f. C. G. <gor...@gm...> - 2017-07-29 13:09:35
|
Commit-ID: fdbf7012ba371cd7eb7f22e7aedc32511b0867e4 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=fdbf7012ba371cd7eb7f22e7aedc32511b0867e4 Author: Cyrill Gorcunov <gor...@gm...> AuthorDate: Sat, 29 Jul 2017 16:05:36 +0300 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Sat, 29 Jul 2017 16:07:40 +0300 configure: Add --enable-gdb option When one needs to run nasm under GDB Signed-off-by: Cyrill Gorcunov <gor...@gm...> --- configure.ac | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/configure.ac b/configure.ac index 8db7c72..8ac4994 100644 --- a/configure.ac +++ b/configure.ac @@ -32,6 +32,12 @@ PA_ARG_DISABLED([optimization], AS_IF([test x"$pa_init_cflags" = x], [CFLAGS=`echo "$CFLAGS" | sed -e "s/-O2/$pa_optimize/"`]) +dnl Compile and link with dwarf debug +PA_ARG_ENABLED([gdb], + [disable optimization and compile with extra debug information for GDB debugger], + [CFLAGS=`echo "$CFLAGS" | sed -e "s/\(-O2\|-O3\)/-O0/"` + PA_ADD_CLDFLAGS([-ggdb3])]) + dnl Check for library extension PA_LIBEXT |
From: nasm-bot f. C. G. <gor...@gm...> - 2017-07-25 22:24:28
|
Commit-ID: b6a173fad54f25f6e1cb0c3eaf230ac11fb6a070 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=b6a173fad54f25f6e1cb0c3eaf230ac11fb6a070 Author: Cyrill Gorcunov <gor...@gm...> AuthorDate: Wed, 26 Jul 2017 01:21:16 +0300 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Wed, 26 Jul 2017 01:21:16 +0300 preproc: Free token's text if only it has been modified https://bugzilla.nasm.us/show_bug.cgi?id=3392414 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 f6e296b..0d0e104 100644 --- a/asm/preproc.c +++ b/asm/preproc.c @@ -1280,8 +1280,8 @@ static char *detoken(Token * tlist, bool expand_locals) t->text = nasm_zalloc(2); } else t->text = nasm_strdup(p); + nasm_free(q); } - nasm_free(q); } /* Expand local macros here and not during preprocessing */ |
From: nasm-bot f. C. G. <gor...@gm...> - 2017-07-05 22:39:34
|
Commit-ID: 20d9c86eb1e088efe0093b31f6fb0952971566f1 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=20d9c86eb1e088efe0093b31f6fb0952971566f1 Author: Cyrill Gorcunov <gor...@gm...> AuthorDate: Thu, 6 Jul 2017 01:36:06 +0300 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Thu, 6 Jul 2017 01:36:06 +0300 build: Merge CPPFLAGS into ALL_CFLAGS This is a fix for a4f6ca5a33d - We should not use sole CPPFLAGS when compiling, but rather merge it into ALL_CFLAGS - nasm.spec.in should use DESTDIR since INSTALLROOT now renamed to it Signed-off-by: Cyrill Gorcunov <gor...@gm...> --- Makefile.in | 8 ++++---- nasm.spec.in | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Makefile.in b/Makefile.in index e7f01e4..5024974 100644 --- a/Makefile.in +++ b/Makefile.in @@ -21,7 +21,7 @@ datarootdir = @datarootdir@ CC = @CC@ CFLAGS = @CFLAGS@ CPPFLAGS = @CPPFLAGS@ -BUILD_CFLAGS = $(CFLAGS) @DEFS@ +BUILD_CFLAGS = $(CPPFLAGS) $(CFLAGS) @DEFS@ INTERNAL_CFLAGS = -I$(srcdir) -I$(objdir) \ -I$(srcdir)/include -I$(objdir)/include \ -I$(srcdir)/x86 -I$(objdir)/x86 \ @@ -73,13 +73,13 @@ endif .PHONY: manpages nsis .c.$(O): - $(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) -o $@ $< + $(CC) -c $(ALL_CFLAGS) $(ALL_CFLAGS) -o $@ $< .c.s: - $(CC) -S $(CPPFLAGS) $(ALL_CFLAGS) -o $@ $< + $(CC) -S $(ALL_CFLAGS) $(ALL_CFLAGS) -o $@ $< .c.i: - $(CC) -E $(CPPFLAGS) $(ALL_CFLAGS) -o $@ $< + $(CC) -E $(ALL_CFLAGS) $(ALL_CFLAGS) -o $@ $< .txt.xml: $(ASCIIDOC) -b docbook -d manpage -o $@ $< diff --git a/nasm.spec.in b/nasm.spec.in index d610284..317e2d8 100644 --- a/nasm.spec.in +++ b/nasm.spec.in @@ -54,7 +54,7 @@ xz -9ef doc/nasmdoc.pdf rm -rf "%{buildroot}" mkdir -p "%{buildroot}"/%{_bindir} mkdir -p "%{buildroot}"/%{_mandir}/man1 -make INSTALLROOT="%{buildroot}" install install_rdf +make DESTDIR="%{buildroot}" install install_rdf %files %doc AUTHORS CHANGES README TODO |
From: nasm-bot f. C. G. <gor...@gm...> - 2017-06-26 02:36:13
|
Commit-ID: f7e39739c39571bfb4a28b15159521349b1504a5 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=f7e39739c39571bfb4a28b15159521349b1504a5 Author: Cyrill Gorcunov <gor...@gm...> AuthorDate: Sat, 24 Jun 2017 14:32:05 +0300 Committer: H. Peter Anvin <hp...@zy...> CommitDate: Sun, 25 Jun 2017 19:33:14 -0700 nasmlib/md5c: Fix typo in WORDS_LITTLEENDIAN https://bugzilla.nasm.us/show_bug.cgi?id=3392416 Signed-off-by: Cyrill Gorcunov <gor...@gm...> --- nasmlib/md5c.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nasmlib/md5c.c b/nasmlib/md5c.c index 5d580f0..9b06136 100644 --- a/nasmlib/md5c.c +++ b/nasmlib/md5c.c @@ -18,7 +18,7 @@ #include "md5.h" #include <string.h> /* for memcpy() */ -#ifdef WORDS_LITTEENDIAN +#ifdef WORDS_LITTLEENDIAN #define byteReverse(buf, len) /* Nothing */ #else static void byteReverse(unsigned char *buf, unsigned longs); |
From: nasm-bot f. C. G. <gor...@gm...> - 2017-06-24 11:36:35
|
Commit-ID: 6e5318008503909f5728e4ad2c715f327c073f86 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=6e5318008503909f5728e4ad2c715f327c073f86 Author: Cyrill Gorcunov <gor...@gm...> AuthorDate: Sat, 24 Jun 2017 14:32:05 +0300 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Sat, 24 Jun 2017 14:32:05 +0300 nasmlib/md5c: Fix typo in WORDS_LITTLEENDIAN https://bugzilla.nasm.us/show_bug.cgi?id=3392416 Signed-off-by: Cyrill Gorcunov <gor...@gm...> --- nasmlib/md5c.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nasmlib/md5c.c b/nasmlib/md5c.c index 5d580f0..9b06136 100644 --- a/nasmlib/md5c.c +++ b/nasmlib/md5c.c @@ -18,7 +18,7 @@ #include "md5.h" #include <string.h> /* for memcpy() */ -#ifdef WORDS_LITTEENDIAN +#ifdef WORDS_LITTLEENDIAN #define byteReverse(buf, len) /* Nothing */ #else static void byteReverse(unsigned char *buf, unsigned longs); |
From: nasm-bot f. C. S. B. <cha...@in...> - 2017-04-28 03:06:25
|
Commit-ID: 375f452813194026108762fddfefbe9157c7fa11 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=375f452813194026108762fddfefbe9157c7fa11 Author: Chang S. Bae <cha...@in...> AuthorDate: Wed, 26 Apr 2017 12:31:41 -0700 Committer: H. Peter Anvin <hp...@zy...> CommitDate: Thu, 27 Apr 2017 20:04:15 -0700 outmacho: fix dwarf line number information (debug_line section) Create directory table in prologue and file name indicates index of the table for its directory Now bring back included file names Signedoff-by: Chang S. Bae <cha...@in...> Signed-off-by: H. Peter Anvin <hp...@zy...> --- output/outmacho.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/output/outmacho.c b/output/outmacho.c index 5577cc3..c9a931d 100644 --- a/output/outmacho.c +++ b/output/outmacho.c @@ -1830,6 +1830,8 @@ static void macho_dbg_generate(void) struct dw_sect_list *p_sect; size_t linep_off, buf_size; struct SAA *p_lines = saa_init(1L); + struct dir_list *p_dir; + struct file_list *p_file; p_section = get_section_by_name("__DWARF", "__debug_line"); nasm_assert(p_section != NULL); @@ -1851,12 +1853,17 @@ static void macho_dbg_generate(void) saa_write8(p_lines, 0); /* std opcode 10 length */ saa_write8(p_lines, 0); /* std opcode 11 length */ saa_write8(p_lines, 1); /* std opcode 12 length */ + list_for_each(p_dir, dw_head_dir) { + saa_wcstring(p_lines, p_dir->dir_name); + } saa_write8(p_lines, 0); /* end of table */ - saa_wcstring(p_lines, module_name); - saa_write8(p_lines, 0); /* directory */ - saa_write8(p_lines, 0); /* time */ - saa_write8(p_lines, 0); /* size */ + list_for_each(p_file, dw_head_file) { + saa_wcstring(p_lines, p_file->file_name); + saa_write8(p_lines, p_file->dir->dir); /* directory id */ + saa_write8(p_lines, 0); /* time */ + saa_write8(p_lines, 0); /* size */ + } saa_write8(p_lines, 0); /* end of table */ linep_off = p_lines->datalen; |
From: nasm-bot f. C. S. B. <cha...@in...> - 2017-04-28 03:06:22
|
Commit-ID: 961d8670bf99b627255c2c3111535bd319981cf9 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=961d8670bf99b627255c2c3111535bd319981cf9 Author: Chang S. Bae <cha...@in...> AuthorDate: Wed, 26 Apr 2017 12:13:08 -0700 Committer: H. Peter Anvin <hp...@zy...> CommitDate: Thu, 27 Apr 2017 20:03:53 -0700 outmacho: add dir list Separate dir info from the file list to align with dwarf format in debug_line section Signedoff-by: Chang S. Bae <cha...@in...> Signed-off-by: H. Peter Anvin <hp...@zy...> --- output/outmacho.c | 85 ++++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 65 insertions(+), 20 deletions(-) diff --git a/output/outmacho.c b/output/outmacho.c index c6774d1..5577cc3 100644 --- a/output/outmacho.c +++ b/output/outmacho.c @@ -323,11 +323,19 @@ static struct section *get_section_by_index(const int32_t index) return s; } +struct dir_list { + struct dir_list *next; + struct dir_list *last; + const char *dir_name; + uint32_t dir; +}; + struct file_list { struct file_list *next; struct file_list *last; - char *file_name; + const char *file_name; uint32_t file; + struct dir_list *dir; }; struct dw_sect_list { @@ -351,9 +359,10 @@ struct section_info { #define DW_MAX_LN (DW_LN_BASE + DW_LN_RANGE) #define DW_MAX_SP_OPCODE 256 -static struct file_list *dw_head_list = 0, *dw_cur_list = 0, *dw_last_list = 0; +static struct file_list *dw_head_file = 0, *dw_cur_file = 0, **dw_last_file_next = NULL; +static struct dir_list *dw_head_dir = 0, **dw_last_dir_next = NULL; static struct dw_sect_list *dw_head_sect = 0, *dw_cur_sect = 0, *dw_last_sect = 0; -static uint32_t cur_line = 0, dw_num_files = 0, dw_num_sects = 0; +static uint32_t cur_line = 0, dw_num_files = 0, dw_num_dirs = 0, dw_num_sects = 0; static bool dbg_immcall = false; static const char *module_name = NULL; @@ -2015,6 +2024,46 @@ static void macho_dbg_generate(void) } } +static void new_file_list (const char *file_name, const char *dir_name) +{ + struct dir_list *dir_list; + bool need_new_dir_list = true; + + nasm_new(dw_cur_file); + dw_cur_file->file = ++dw_num_files; + dw_cur_file->file_name = file_name; + if(!dw_head_file) { + dw_head_file = dw_cur_file; + } else { + *dw_last_file_next = dw_cur_file; + } + dw_last_file_next = &(dw_cur_file->next); + + if(dw_head_dir) { + list_for_each(dir_list, dw_head_dir) { + if(!(strcmp(dir_name, dir_list->dir_name))) { + dw_cur_file->dir = dir_list; + need_new_dir_list = false; + break; + } + } + } + + if(need_new_dir_list) + { + nasm_new(dir_list); + dir_list->dir = dw_num_dirs++; + dir_list->dir_name = dir_name; + if(!dw_head_dir) { + dw_head_dir = dir_list; + } else { + *dw_last_dir_next = dir_list; + } + dw_last_dir_next = &(dir_list->next); + dw_cur_file->dir = dir_list; + } +} + static void macho_dbg_init(void) { } @@ -2022,15 +2071,20 @@ static void macho_dbg_init(void) static void macho_dbg_linenum(const char *file_name, int32_t line_num, int32_t segto) { bool need_new_list = true; + const char *cur_file = nasm_basename(file_name); + const char *cur_dir = nasm_dirname(file_name); (void)segto; - if(!dw_cur_list || strcmp(file_name, dw_cur_list->file_name)) { - if(dw_head_list) { + if(!dw_cur_file || strcmp(cur_file, dw_cur_file->file_name) || + strcmp(cur_dir, dw_cur_file->dir->dir_name)) { + if(dw_head_file) { struct file_list *match; - list_for_each(match, dw_head_list) { - if(!(strcmp(file_name, match->file_name))) { - dw_cur_list = match; + list_for_each(match, dw_head_file) { + if(!(strcmp(cur_file, match->file_name)) && + !(strcmp(cur_dir, match->dir->dir_name))) { + dw_cur_file = match; + dw_cur_file->dir = match->dir; need_new_list = false; break; } @@ -2038,16 +2092,7 @@ static void macho_dbg_linenum(const char *file_name, int32_t line_num, int32_t s } if(need_new_list) { - nasm_new(dw_cur_list); - dw_cur_list->file = ++dw_num_files; - dw_cur_list->file_name = (char*) file_name; - - if(!dw_head_list) { - dw_head_list = dw_last_list = dw_cur_list; - } else { - dw_last_list->next = dw_cur_list; - dw_last_list = dw_cur_list; - } + new_file_list(cur_file, cur_dir); } } @@ -2109,7 +2154,7 @@ static void macho_dbg_output(int type, void *param) if(dbg_immcall == true) { int32_t line_delta = cur_line - dw_cur_sect->line; int32_t offset_delta = sinfo_param->size - dw_cur_sect->offset; - uint32_t cur_file = dw_cur_list->file; + uint32_t cur_file = dw_cur_file->file; p_linep = dw_cur_sect->psaa; if(cur_file != dw_cur_sect->file) { @@ -2150,7 +2195,7 @@ static void macho_dbg_cleanup(void) { struct dw_sect_list *p_sect = dw_head_sect; - struct file_list *p_file = dw_head_list; + struct file_list *p_file = dw_head_file; uint32_t idx = 0; for(; idx < dw_num_sects; idx++) { |
From: nasm-bot f. C. S. B. <cha...@in...> - 2017-04-25 19:55:58
|
Commit-ID: 1d73d14eb039fb67112570d55658f41bc606ae1d Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=1d73d14eb039fb67112570d55658f41bc606ae1d Author: Chang S. Bae <cha...@in...> AuthorDate: Mon, 24 Apr 2017 21:08:23 -0700 Committer: H. Peter Anvin <hp...@zy...> CommitDate: Tue, 25 Apr 2017 12:54:25 -0700 outmatch: fix file info and cleanup in dwarf generation In debug info and line, only main source is showed up. Header files will be laid out via TAG_subprogram Included missing memory cleanups Removed unnecessary null assertions Signed-off-by: Chang S. Bae <cha...@in...> Signed-off-by: H. Peter Anvin <hp...@zy...> --- output/outmacho.c | 63 +++++++++++++++++++++---------------------------------- 1 file changed, 24 insertions(+), 39 deletions(-) diff --git a/output/outmacho.c b/output/outmacho.c index d10c60c..c6774d1 100644 --- a/output/outmacho.c +++ b/output/outmacho.c @@ -355,6 +355,7 @@ static struct file_list *dw_head_list = 0, *dw_cur_list = 0, *dw_last_list = 0; static struct dw_sect_list *dw_head_sect = 0, *dw_cur_sect = 0, *dw_last_sect = 0; static uint32_t cur_line = 0, dw_num_files = 0, dw_num_sects = 0; static bool dbg_immcall = false; +static const char *module_name = NULL; /* * Special section numbers which are used to define Mach-O special @@ -1071,6 +1072,7 @@ static int32_t macho_segbase(int32_t section) static void macho_filename(char *inname, char *outname) { standard_extension(inname, outname, ".o"); + module_name = inname; } extern macros_t macho_stdmac[]; @@ -1784,7 +1786,7 @@ static void macho_dbg_generate(void) size_t saa_len = 0, high_addr = 0, total_len = 0; struct section *p_section = NULL; /* calculated at debug_str and referenced at debug_info */ - uint32_t producer_str_offset = 0, module_str_offset = 0, path_str_offset = 0; + uint32_t producer_str_offset = 0, module_str_offset = 0, dir_str_offset = 0; /* debug section defines */ { @@ -1816,11 +1818,9 @@ static void macho_dbg_generate(void) /* debug line */ { - struct file_list *p_file; struct dw_sect_list *p_sect; size_t linep_off, buf_size; struct SAA *p_lines = saa_init(1L); - nasm_assert(p_lines != NULL); p_section = get_section_by_name("__DWARF", "__debug_line"); nasm_assert(p_section != NULL); @@ -1844,12 +1844,10 @@ static void macho_dbg_generate(void) saa_write8(p_lines, 1); /* std opcode 12 length */ saa_write8(p_lines, 0); /* end of table */ - list_for_each(p_file, dw_head_list) { - saa_wcstring(p_lines, p_file->file_name); - saa_write8(p_lines, 0); /* directory */ - saa_write8(p_lines, 0); /* time */ - saa_write8(p_lines, 0); /* size */ - } + saa_wcstring(p_lines, module_name); + saa_write8(p_lines, 0); /* directory */ + saa_write8(p_lines, 0); /* time */ + saa_write8(p_lines, 0); /* size */ saa_write8(p_lines, 0); /* end of table */ linep_off = p_lines->datalen; @@ -1867,63 +1865,49 @@ static void macho_dbg_generate(void) list_for_each(p_sect, dw_head_sect) { struct SAA *p_linep = p_sect->psaa; + saa_len = p_linep->datalen; saa_rnbytes(p_linep, p_buf, saa_len); p_buf += saa_len; + saa_free(p_linep); - p_sect = p_sect->next; } macho_output(p_section->index, p_buf_base, OUT_RAWDATA, buf_size, NO_SEG, 0); + nasm_free(p_buf_base); } /* string section */ { - struct file_list *p_file = dw_head_list; struct SAA *p_str = saa_init(1L); - struct SAA *p_path_str = saa_init(1L); - nasm_assert((p_str != NULL) && (p_path_str != NULL)); + char *cur_path = nasm_realpath(module_name); + char *cur_file = nasm_basename(cur_path); + char *cur_dir = nasm_dirname(cur_path); p_section = get_section_by_name("__DWARF", "__debug_str"); nasm_assert(p_section != NULL); producer_str_offset = 0; - saa_wbytes(p_str, nasm_signature, strlen(nasm_signature) + 1); - - module_str_offset = path_str_offset = producer_str_offset + strlen(nasm_signature) + 1; - - list_for_each(p_file, dw_head_list) { - char *cur_path = nasm_realpath(p_file->file_name); - char *cur_file = nasm_basename(cur_path); - char *cur_dir = nasm_dirname(cur_path); - - saa_wcstring(p_str, cur_file); - saa_wcstring(p_path_str, cur_dir); - - nasm_free(cur_path); - nasm_free(cur_file); - nasm_free(cur_dir); - } + module_str_offset = dir_str_offset = saa_wcstring(p_str, nasm_signature); + dir_str_offset += saa_wcstring(p_str, cur_file); + saa_wcstring(p_str, cur_dir); saa_len = p_str->datalen; - path_str_offset += saa_len; p_buf = nasm_malloc(saa_len); saa_rnbytes(p_str, p_buf, saa_len); macho_output(p_section->index, p_buf, OUT_RAWDATA, saa_len, NO_SEG, 0); - saa_free(p_str); - saa_len = p_path_str->datalen; - p_buf = nasm_malloc(saa_len); - saa_rnbytes(p_path_str, p_buf, saa_len); - macho_output(p_section->index, p_buf, OUT_RAWDATA, saa_len, NO_SEG, 0); - saa_free(p_path_str); + nasm_free(cur_path); + nasm_free(cur_file); + nasm_free(cur_dir); + saa_free(p_str); + nasm_free(p_buf); } /* debug info */ { struct SAA *p_info = saa_init(1L); - nasm_assert(p_info != NULL); p_section = get_section_by_name("__DWARF", "__debug_info"); nasm_assert(p_section != NULL); @@ -1938,7 +1922,7 @@ static void macho_dbg_generate(void) saa_write32(p_info, producer_str_offset); /* offset from string table for DW_AT_producer */ saa_write16(p_info, DW_LANG_Mips_Assembler); /* DW_AT_language */ saa_write32(p_info, module_str_offset); /* offset from string table for DW_AT_name */ - saa_write32(p_info, path_str_offset); /* offset from string table for DW_AT_comp_dir */ + saa_write32(p_info, dir_str_offset); /* offset from string table for DW_AT_comp_dir */ saa_write32(p_info, 0); /* DW_AT_stmt_list */ if (ofmt == &of_macho64) { @@ -1968,12 +1952,12 @@ static void macho_dbg_generate(void) macho_output(p_section->index, p_buf_base, OUT_RAWDATA, saa_len + 4, NO_SEG, 0); saa_free(p_info); + nasm_free(p_buf_base); } /* abbrev section */ { struct SAA *p_abbrev = saa_init(1L); - nasm_assert(p_abbrev != NULL); p_section = get_section_by_name("__DWARF", "__debug_abbrev"); nasm_assert(p_section != NULL); @@ -2027,6 +2011,7 @@ static void macho_dbg_generate(void) macho_output(p_section->index, p_buf, OUT_RAWDATA, saa_len, NO_SEG, 0); saa_free(p_abbrev); + nasm_free(p_buf); } } |
From: nasm-bot f. C. S. B. <cha...@in...> - 2017-04-25 19:55:57
|
Commit-ID: 64dd380f1e0b9298d086cdbf0ecdbda0756fb557 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=64dd380f1e0b9298d086cdbf0ecdbda0756fb557 Author: Chang S. Bae <cha...@in...> AuthorDate: Mon, 24 Apr 2017 21:03:33 -0700 Committer: H. Peter Anvin <hp...@zy...> CommitDate: Tue, 25 Apr 2017 12:53:52 -0700 nasmlib: include macro for Mach system and fix on filename extraction Add __MACH__ as a Unix-like system (e.g. MacOS X defines __MACH__ but no variant of __unix__.) Fix a reversed test in first_filename_char(). Signed-off-by: Chang S. Bae <cha...@in...> Signed-off-by: H. Peter Anvin <hp...@zy...> --- nasmlib/path.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nasmlib/path.c b/nasmlib/path.c index fd7ea13..0cb9713 100644 --- a/nasmlib/path.c +++ b/nasmlib/path.c @@ -39,7 +39,7 @@ #include "nasmlib.h" #include "error.h" -#if defined(unix) || defined(__unix) || defined(__unix__) +#if defined(unix) || defined(__unix) || defined(__unix__) || defined(__MACH__) # define separators "/" # define cleandirend "/" # define catsep '/' @@ -93,7 +93,7 @@ static const char *first_filename_char(const char *path) const char *p = path + strlen(path); while (p > path) { - if (!ismatch(separators, p[-1])) + if (ismatch(separators, p[-1])) return p; p--; } |
From: nasm-bot f. C. S. B. <cha...@in...> - 2017-04-23 23:48:21
|
Commit-ID: 4dfbd9aec56577d7e0dc9398781ea9918dbdcbf6 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=4dfbd9aec56577d7e0dc9398781ea9918dbdcbf6 Author: Chang S. Bae <cha...@in...> AuthorDate: Sat, 22 Apr 2017 06:40:43 -0700 Committer: H. Peter Anvin <hp...@zy...> CommitDate: Sun, 23 Apr 2017 16:46:45 -0700 macho: add file path to the dwarf debugging output Apple's linker requires file path along with file name to produce debug notes. Signed-off-by: Chang S. Bae <cha...@in...> Signed-off-by: H. Peter Anvin <hp...@li...> --- output/outmacho.c | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/output/outmacho.c b/output/outmacho.c index 173706b..5c259e2 100644 --- a/output/outmacho.c +++ b/output/outmacho.c @@ -1784,7 +1784,7 @@ static void macho_dbg_generate(void) size_t saa_len = 0, high_addr = 0, total_len = 0; struct section *p_section = NULL; /* calculated at debug_str and referenced at debug_info */ - uint32_t producer_str_offset = 0, module_str_offset = 0; + uint32_t producer_str_offset = 0, module_str_offset = 0, path_str_offset = 0; /* debug section defines */ { @@ -1886,7 +1886,8 @@ static void macho_dbg_generate(void) struct file_list *p_file = dw_head_list; uint32_t idx = 0; struct SAA *p_str = saa_init(1L); - nasm_assert(p_str != NULL); + struct SAA *p_path_str = saa_init(1L); + nasm_assert((p_str != NULL) && (p_path_str != NULL)); p_section = get_section_by_name("__DWARF", "__debug_str"); nasm_assert(p_section != NULL); @@ -1894,19 +1895,33 @@ static void macho_dbg_generate(void) producer_str_offset = 0; saa_wbytes(p_str, nasm_signature, strlen(nasm_signature) + 1); - module_str_offset = producer_str_offset + strlen(nasm_signature) + 1; + module_str_offset = path_str_offset = producer_str_offset + strlen(nasm_signature) + 1; + for(; idx < dw_num_files; idx++) { - saa_wbytes(p_str, p_file->file_name, (int32_t)(strlen(p_file->file_name) + 1)); + size_t cur_file_strlen = strlen(p_file->file_name) + 1; + char *cur_path = nasm_realpath(p_file->file_name); + size_t cur_path_strlen = strlen(cur_path); + + nasm_assert(cur_path_strlen > cur_file_strlen); + cur_path_strlen -= cur_file_strlen; + cur_path[cur_path_strlen] = '\0'; + saa_wbytes(p_str, p_file->file_name, cur_file_strlen); + saa_wbytes(p_path_str, cur_path, cur_path_strlen); + path_str_offset += cur_file_strlen; p_file = p_file->next; } saa_len = p_str->datalen; - p_buf = nasm_malloc(saa_len); saa_rnbytes(p_str, p_buf, saa_len); macho_output(p_section->index, p_buf, OUT_RAWDATA, saa_len, NO_SEG, 0); - saa_free(p_str); + + saa_len = p_path_str->datalen; + p_buf = nasm_malloc(saa_len); + saa_rnbytes(p_path_str, p_buf, saa_len); + macho_output(p_section->index, p_buf, OUT_RAWDATA, saa_len, NO_SEG, 0); + saa_free(p_path_str); } /* debug info */ @@ -1927,6 +1942,7 @@ static void macho_dbg_generate(void) saa_write32(p_info, producer_str_offset); /* offset from string table for DW_AT_producer */ saa_write16(p_info, DW_LANG_Mips_Assembler); /* DW_AT_language */ saa_write32(p_info, module_str_offset); /* offset from string table for DW_AT_name */ + saa_write32(p_info, path_str_offset); /* offset from string table for DW_AT_comp_dir */ saa_write32(p_info, 0); /* DW_AT_stmt_list */ if (ofmt == &of_macho64) { @@ -1980,6 +1996,9 @@ static void macho_dbg_generate(void) saa_write8(p_abbrev, DW_AT_name); saa_write8(p_abbrev, DW_FORM_strp); + saa_write8(p_abbrev, DW_AT_comp_dir); + saa_write8(p_abbrev, DW_FORM_strp); + saa_write8(p_abbrev, DW_AT_stmt_list); saa_write8(p_abbrev, DW_FORM_data4); |
From: nasm-bot f. C. G. <gor...@gm...> - 2017-03-25 22:12:30
|
Commit-ID: ee1fc45ee1672938ae1b8152d52883633182b3eb Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=ee1fc45ee1672938ae1b8152d52883633182b3eb Author: Cyrill Gorcunov <gor...@gm...> AuthorDate: Sat, 25 Mar 2017 13:53:29 +0300 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Sat, 25 Mar 2017 22:15:04 +0300 dwarf: Update dwarf_line_number_extended Signed-off-by: Cyrill Gorcunov <gor...@gm...> --- output/dwarf.h | 1 + 1 file changed, 1 insertion(+) diff --git a/output/dwarf.h b/output/dwarf.h index 4d6ea1e..e672819 100644 --- a/output/dwarf.h +++ b/output/dwarf.h @@ -544,6 +544,7 @@ enum dwarf_line_number_extended { DW_LNE_end_sequence = 0x01, DW_LNE_set_address = 0x02, DW_LNE_define_file = 0x03, + DW_LNE_set_discriminator= 0x04, DW_LNE_lo_user = 0x80, DW_LNE_hi_user = 0xff }; |
From: nasm-bot f. C. G. <gor...@gm...> - 2017-03-25 22:12:30
|
Commit-ID: c95c2536b4de46584750fd1ac197464c305297f4 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=c95c2536b4de46584750fd1ac197464c305297f4 Author: Cyrill Gorcunov <gor...@gm...> AuthorDate: Sat, 25 Mar 2017 11:47:36 +0300 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Sat, 25 Mar 2017 20:55:48 +0300 dwarf: Update dwarf_language Signed-off-by: Cyrill Gorcunov <gor...@gm...> --- output/dwarf.h | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/output/dwarf.h b/output/dwarf.h index cc3c530..dc425a6 100644 --- a/output/dwarf.h +++ b/output/dwarf.h @@ -460,11 +460,30 @@ enum dwarf_language { DW_LANG_ObjC_plus_plus = 0x0011, DW_LANG_UPC = 0x0012, DW_LANG_D = 0x0013, + DW_LANG_Python = 0x0014, + DW_LANG_OpenCL = 0x0015, + DW_LANG_Go = 0x0016, + DW_LANG_Modula3 = 0x0017, + DW_LANG_Haskell = 0x0018, + DW_LANG_C_plus_plus_03 = 0x0019, + DW_LANG_C_plus_plus_11 = 0x001a, + DW_LANG_OCaml = 0x001b, + DW_LANG_Rust = 0x001c, + DW_LANG_C11 = 0x001d, + DW_LANG_Swift = 0x001e, + DW_LANG_Julia = 0x001f, + DW_LANG_Dylan = 0x0020, + DW_LANG_C_plus_plus_14 = 0x0021, + DW_LANG_Fortran03 = 0x0022, + DW_LANG_Fortran08 = 0x0023, + DW_LANG_RenderScript = 0x0024, DW_LANG_Mips_Assembler = 0x8001, DW_LANG_lo_user = 0x8000, - DW_LANG_hi_user = 0xffff + DW_LANG_hi_user = 0xffff, + + DW_LANG_Rust_old = 0x9000 }; enum dwarf_identifier_case { |
From: nasm-bot f. C. G. <gor...@gm...> - 2017-03-25 22:12:29
|
Commit-ID: de03b2b8311297ba126dba47f593366e34c95e87 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=de03b2b8311297ba126dba47f593366e34c95e87 Author: Cyrill Gorcunov <gor...@gm...> AuthorDate: Sat, 25 Mar 2017 13:51:28 +0300 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Sat, 25 Mar 2017 22:15:04 +0300 dwarf: Update dwarf_calling_conversion Signed-off-by: Cyrill Gorcunov <gor...@gm...> --- output/dwarf.h | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/output/dwarf.h b/output/dwarf.h index dc425a6..4d6ea1e 100644 --- a/output/dwarf.h +++ b/output/dwarf.h @@ -494,12 +494,17 @@ enum dwarf_identifier_case { }; enum dwarf_calling_conversion { - DW_CC_normal = 0x01, - DW_CC_program = 0x02, - DW_CC_nocall = 0x03, + DW_CC_normal = 0x01, + DW_CC_program = 0x02, + DW_CC_nocall = 0x03, + DW_CC_pass_by_reference = 0x4, + DW_CC_pass_by_value = 0x5, - DW_CC_lo_user = 0x40, - DW_CC_hi_user = 0xff + DW_CC_lo_user = 0x40, + DW_CC_hi_user = 0xff, + + DW_CC_GNU_renesas_sh = 0x40, + DW_CC_GNU_borland_fastcall_i386 = 0x41 }; enum dwarf_inline { |
From: nasm-bot f. C. G. <gor...@gm...> - 2017-03-25 22:12:29
|
Commit-ID: 5fe4eff8c40c50bfbd2de230286d20a378522a25 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=5fe4eff8c40c50bfbd2de230286d20a378522a25 Author: Cyrill Gorcunov <gor...@gm...> AuthorDate: Sat, 25 Mar 2017 20:55:11 +0300 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Sat, 25 Mar 2017 22:15:04 +0300 output: elf -- Make elf_section_attrib static After elf files have been merged into one no need to keep it global. Signed-off-by: Cyrill Gorcunov <gor...@gm...> --- output/outelf.c | 6 +++--- output/outelf.h | 4 ---- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/output/outelf.c b/output/outelf.c index 9932ff6..ebff4d4 100644 --- a/output/outelf.c +++ b/output/outelf.c @@ -209,9 +209,9 @@ const struct elf_known_section elf_known_sections[] = { }; /* parse section attributes */ -void elf_section_attrib(char *name, char *attr, int pass, - uint32_t *flags_and, uint32_t *flags_or, - uint64_t *align, int *type) +static void elf_section_attrib(char *name, char *attr, int pass, + uint32_t *flags_and, uint32_t *flags_or, + uint64_t *align, int *type) { char *opt, *val, *next; diff --git a/output/outelf.h b/output/outelf.h index 0f718d9..8eef73a 100644 --- a/output/outelf.h +++ b/output/outelf.h @@ -103,10 +103,6 @@ struct stabentry { extern uint8_t elf_osabi; extern uint8_t elf_abiver; -void elf_section_attrib(char *name, char *attr, int pass, - uint32_t *flags_and, uint32_t *flags_or, - uint64_t *align, int *type); - #define WRITE_STAB(p,n_strx,n_type,n_other,n_desc,n_value) \ do { \ WRITELONG(p, n_strx); \ |
From: nasm-bot f. C. G. <gor...@gm...> - 2017-03-25 22:12:28
|
Commit-ID: 8f1d6b0ed8f4d446eb02bcfe21b86537cd90570f Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=8f1d6b0ed8f4d446eb02bcfe21b86537cd90570f Author: Cyrill Gorcunov <gor...@gm...> AuthorDate: Sat, 18 Mar 2017 16:25:49 +0300 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Sat, 18 Mar 2017 16:25:49 +0300 output: elf -- Use Elf64_Ehdr into section offset Same as we do in e_shoff. Signed-off-by: Cyrill Gorcunov <gor...@gm...> --- output/outelf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/output/outelf.c b/output/outelf.c index fce71a9..9932ff6 100644 --- a/output/outelf.c +++ b/output/outelf.c @@ -1679,7 +1679,7 @@ static void elf_write(void) * Now output the section header table. */ - elf_foffs = 0x40 + (is_elf64() ? sizeof(Elf64_Shdr): sizeof(Elf32_Shdr)) * nsections; + elf_foffs = sizeof(Elf64_Ehdr) + (is_elf64() ? sizeof(Elf64_Shdr): sizeof(Elf32_Shdr)) * nsections; align = ALIGN(elf_foffs, SEC_FILEALIGN) - elf_foffs; elf_foffs += align; elf_nsect = 0; |
From: nasm-bot f. C. G. <gor...@gm...> - 2017-03-23 16:21:28
|
Commit-ID: 495b6352d871381c21d65a403124658f3d34dd35 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=495b6352d871381c21d65a403124658f3d34dd35 Author: Cyrill Gorcunov <gor...@gm...> AuthorDate: Thu, 23 Mar 2017 19:19:38 +0300 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Thu, 23 Mar 2017 19:19:38 +0300 output: elf,dwarf -- Fix lookup over existing files We are missing @next access here so in result we might allocate same name several times. Reported-by: "Bae, Chang Seok" <cha...@in...> Signed-off-by: Cyrill Gorcunov <gor...@gm...> --- output/outelf.c | 1 + 1 file changed, 1 insertion(+) diff --git a/output/outelf.c b/output/outelf.c index d99a49b..e1cba76 100644 --- a/output/outelf.c +++ b/output/outelf.c @@ -3298,6 +3298,7 @@ static void dwarf_findfile(const char * fname) dwarf_clist = match; return; } + match = match->next; } } |
From: nasm-bot f. C. G. <gor...@gm...> - 2017-03-18 12:18:30
|
Commit-ID: bb6daa408ec162e7f2867d5805c08a73a2ea99e6 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=bb6daa408ec162e7f2867d5805c08a73a2ea99e6 Author: Cyrill Gorcunov <gor...@gm...> AuthorDate: Sun, 12 Mar 2017 17:24:28 +0300 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Sat, 18 Mar 2017 15:16:10 +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 01c8601..744822c 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-18 12:18:27
|
Commit-ID: c2df71b3ae550f47605327b0dc168f6db9445aff Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=c2df71b3ae550f47605327b0dc168f6db9445aff Author: Cyrill Gorcunov <gor...@gm...> AuthorDate: Wed, 8 Mar 2017 21:32:54 +0300 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Sat, 18 Mar 2017 15:16:10 +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 3c90ac3..01c8601 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-18 12:18:26
|
Commit-ID: b074501887a0f5c57152fba6b36dcde92ec433bb Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=b074501887a0f5c57152fba6b36dcde92ec433bb Author: Cyrill Gorcunov <gor...@gm...> AuthorDate: Sun, 12 Mar 2017 17:42:09 +0300 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Sat, 18 Mar 2017 15:16:10 +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 744822c..fce71a9 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; } |