mirror of
https://github.com/netwide-assembler/nasm.git
synced 2025-04-18 18:50:23 +08:00
dwarf: don't emit a dummy .debug_loc section
It seems DWARF parsers get really snippy about a section which only contains an end token. Instead, leave unused sections empty. Already did that with .debug_frame, do it with .debug_loc too. Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
This commit is contained in:
parent
241697306c
commit
eb571a3ac3
@ -3438,29 +3438,31 @@ static void dwarf_generate(void)
|
||||
saa_rnbytes(plinesrel, pbuf, saalen);
|
||||
saa_free(plinesrel);
|
||||
|
||||
/* build frame section */
|
||||
/* build .debug_frame section */
|
||||
if (0) {
|
||||
/* This only applies if there is at least one frame defined */
|
||||
framelen = 4;
|
||||
framebuf = pbuf = nasm_malloc(framelen);
|
||||
WRITELONG(pbuf,framelen-4); /* initial length */
|
||||
} else {
|
||||
/* Leave .debug_frame empty if not used! */
|
||||
framelen = 0;
|
||||
}
|
||||
|
||||
/* build loc section */
|
||||
loclen = 16;
|
||||
locbuf = pbuf = nasm_malloc(loclen);
|
||||
if (is_elf32()) {
|
||||
WRITELONG(pbuf,0); /* null beginning offset */
|
||||
WRITELONG(pbuf,0); /* null ending offset */
|
||||
} else if (is_elfx32()) {
|
||||
WRITELONG(pbuf,0); /* null beginning offset */
|
||||
WRITELONG(pbuf,0); /* null ending offset */
|
||||
/* build .debug_loc section */
|
||||
if (0) {
|
||||
loclen = 16;
|
||||
locbuf = pbuf = nasm_malloc(loclen);
|
||||
if (is_elf32() || is_elfx32()) {
|
||||
WRITELONG(pbuf,0); /* null beginning offset */
|
||||
WRITELONG(pbuf,0); /* null ending offset */
|
||||
} else {
|
||||
nasm_assert(is_elf64());
|
||||
WRITEDLONG(pbuf,0); /* null beginning offset */
|
||||
WRITEDLONG(pbuf,0); /* null ending offset */
|
||||
}
|
||||
} else {
|
||||
nasm_assert(is_elf64());
|
||||
WRITEDLONG(pbuf,0); /* null beginning offset */
|
||||
WRITEDLONG(pbuf,0); /* null ending offset */
|
||||
/* Leave .debug_frame empty if not used! */
|
||||
loclen = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user