0
0
mirror of https://github.com/netwide-assembler/nasm.git synced 2025-11-08 23:27:15 -05:00

elf: fix "object" symbol keyword

The "object" symbol keyword would incorrectly generate STT_NOTYPE
instead of STT_OBJECT. Add test for weak object references; they are
different from plain weak references in that they are guaranteed to
resolve to zero if the symbol is not found.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
This commit is contained in:
H. Peter Anvin
2019-09-12 17:45:11 -07:00
parent 7ad25b2e18
commit e47f4b7ad5
2 changed files with 3 additions and 1 deletions

View File

@@ -872,7 +872,7 @@ static void elf_deflabel(char *name, int32_t segment, int64_t offset,
if (!nasm_strnicmp(spcword, "notype", wlen))
type = STT_NOTYPE;
else if (!nasm_strnicmp(spcword, "object", wlen))
type = STT_NOTYPE;
type = STT_OBJECT;
else if (!nasm_strnicmp(spcword, "hidden", wlen))
sym->other = STV_HIDDEN;
else if (!nasm_strnicmp(spcword, "strong", wlen))

View File

@@ -6,6 +6,7 @@ global foo_weak:function weak
global foo_hidden_weak:function hidden weak
extern strong_ref, weak_ref:weak, unused_ref
extern weak_object_ref:weak object
required required_ref
SECTION .text align=16
@@ -23,6 +24,7 @@ foo_weak:
foo_hidden_weak:
mov eax,weak_ref
mov eax,strong_ref
mov eax,weak_object_ref
foo_label:
ret
foo_end: