User Tools

Site Tools


blog:pushbx:2023:0723_blog_42_-_nasm_leaks_ldebug_check_sections_various

Blog 42 - NASM leaks, lDebug check sections, various

2023-07-23

This file is blog42.txt!

This week several developments on the debugger happened, as well as two bug reports to the Netwide Assembler.

webecm change

During use of the NASM bug reports link on the website, I found that the link did not specify an order for the search results in case the user is not logged in. I fixed this.

NASM reports

The second, less important report concerns empty %rep loops in mmacro expansions. This is unlikely to really affect anything, so it is more of a trash report than usual for me. I marked it as "annoyance" accordingly.

The first report I marked as a "blocker". It is a major memory leak that easily blows up the memory requirements of the assembler when using many %rep loops. There are probably more leaks than this one, but this one had a significant impact on memory use.

For instance, assembling the debugger normally (no DPMI support, not debuggable) takes less than 50 MiB with this bug fixed, as opposed to more than 500 MiB before the fix. Assembling the conditionally debuggable, DPMI, imm asm, symbolic debugger with the _CHECKSECTION build option enabled takes some 100 MiB with the bugfix and gets killed by the kernel at about 2.5 GiB memory use without it.

lDebug changes

Check sections options

The big change is the macros for the _CHECKSECTION build options. These macros can check for cross-section near direct branches on every call, jmp, or jcc. This expands each such instruction to dozens of preprocessor directives, including three %rep loops.

The performance of these macros is bad. The assembly time may take as much as five times as long as it does without these options. The memory use of the assembler, even with the bugfix described above, may as much as triple.

The options are only useful when building with dual code segments enabled.

This feature already helped uncover some incorrect branches, including one I was completely unaware of. Success!

You could leave a comment if you were logged in.
blog/pushbx/2023/0723_blog_42_-_nasm_leaks_ldebug_check_sections_various.txt · Last modified: 2023-07-23 20:46:28 +0200 Jul Sun by ecm