Warnings: move zeroing reserved space to a separate warning class

Zeroing reserved space in a progbits section really should be a
separate warning class, so it can be controlled independently.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
This commit is contained in:
H. Peter Anvin (Intel) 2019-01-11 12:27:02 -08:00
parent ef4f23d76a
commit 38ddb19977
9 changed files with 21 additions and 11 deletions

View File

@ -1,6 +1,6 @@
/* ----------------------------------------------------------------------- *
*
* Copyright 1996-2018 The NASM Authors - All Rights Reserved
* Copyright 1996-2019 The NASM Authors - All Rights Reserved
* See the file AUTHORS included with the NASM distribution for
* the specific copyright holders.
*
@ -329,6 +329,16 @@ static void warn_overflow_out(int64_t data, int size, enum out_sign sign)
* generator at the same time, flatten unnecessary relocations,
* and verify backend compatibility.
*/
/*
* This warning is currently issued by backends, but in the future
* this code should be centralized.
*
*!zeroing [on] RESx in initialized section becomes zero
*! a \c{RESx} directive was used in a section which contains
*! initialized data, and the output format does not support
*! this. Instead, this will be replaced with explicit zero
*! content, which may produce a large output file.
*/
static void out(struct out_data *data)
{
static int32_t lineno = 0; /* static!!! */

View File

@ -603,7 +603,7 @@ static void aout_out(int32_t segto, const void *data,
if (type == OUT_RESERVE) {
if (s) {
nasm_warn(WARN_OTHER, "uninitialized space declared in"
nasm_warn(WARN_ZEROING, "uninitialized space declared in"
" %s section: zeroing",
(segto == stext.index ? "code" : "data"));
aout_sect_write(s, NULL, size);

View File

@ -314,7 +314,7 @@ static void as86_out(int32_t segto, const void *data,
if (type == OUT_RESERVE) {
if (s) {
nasm_warn(WARN_OTHER, "uninitialized space declared in"
nasm_warn(WARN_ZEROING, "uninitialized space declared in"
" %s section: zeroing",
(segto == stext.index ? "code" : "data"));
as86_sect_write(s, NULL, size);

View File

@ -783,7 +783,7 @@ static void bin_out(int32_t segto, const void *data,
case OUT_RESERVE:
if (s->flags & TYPE_PROGBITS) {
nasm_warn(WARN_OTHER, "uninitialized space declared in"
nasm_warn(WARN_ZEROING, "uninitialized space declared in"
" %s section: zeroing", s->name);
saa_wbytes(s->contents, NULL, size);
}

View File

@ -606,7 +606,7 @@ static void coff_out(int32_t segto, const void *data,
if (type == OUT_RESERVE) {
if (s->data) {
nasm_warn(WARN_OTHER, "uninitialised space declared in"
nasm_warn(WARN_ZEROING, "uninitialised space declared in"
" non-BSS section `%s': zeroing", s->name);
coff_sect_write(s, NULL, size);
} else

View File

@ -828,7 +828,7 @@ static void elf32_out(int32_t segto, const void *data,
switch (type) {
case OUT_RESERVE:
if (s->type == SHT_PROGBITS) {
nasm_warn(WARN_OTHER, "uninitialized space declared in"
nasm_warn(WARN_ZEROING, "uninitialized space declared in"
" non-BSS section `%s': zeroing", s->name);
elf_sect_write(s, NULL, size);
} else
@ -1039,7 +1039,7 @@ static void elf64_out(int32_t segto, const void *data,
switch (type) {
case OUT_RESERVE:
if (s->type == SHT_PROGBITS) {
nasm_warn(WARN_OTHER, "uninitialized space declared in"
nasm_warn(WARN_ZEROING, "uninitialized space declared in"
" non-BSS section `%s': zeroing", s->name);
elf_sect_write(s, NULL, size);
} else
@ -1317,7 +1317,7 @@ static void elfx32_out(int32_t segto, const void *data,
switch (type) {
case OUT_RESERVE:
if (s->type == SHT_PROGBITS) {
nasm_warn(WARN_OTHER, "uninitialized space declared in"
nasm_warn(WARN_ZEROING, "uninitialized space declared in"
" non-BSS section `%s': zeroing", s->name);
elf_sect_write(s, NULL, size);
} else

View File

@ -1 +1 @@
./travis/test/multisection.asm:84: warning: uninitialized space declared in non-BSS section `.hmm': zeroing [-w+other]
./travis/test/multisection.asm:84: warning: uninitialized space declared in non-BSS section `.hmm': zeroing [-w+zeroing]

View File

@ -1 +1 @@
./travis/test/multisection.asm:84: warning: uninitialized space declared in non-BSS section `.hmm': zeroing [-w+other]
./travis/test/multisection.asm:84: warning: uninitialized space declared in non-BSS section `.hmm': zeroing [-w+zeroing]

View File

@ -1 +1 @@
./travis/test/multisection.asm:84: warning: uninitialized space declared in .hmm section: zeroing [-w+other]
./travis/test/multisection.asm:84: warning: uninitialized space declared in .hmm section: zeroing [-w+zeroing]