aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2019-09-12 14:27:50 -0400
committerH. Peter Anvin <hpa@zytor.com>2019-09-12 14:27:50 -0400
commit495fda63418600229f36a3a7de62b75620be34b6 (patch)
tree3ca7b96fb4f9c73674228ea7cb3445b35ef4302c /test
parenta73ccfebcc9f60e6f2234cbf10cf7551279524d3 (diff)
downloadnasm-495fda63418600229f36a3a7de62b75620be34b6.tar.gz
nasm-495fda63418600229f36a3a7de62b75620be34b6.tar.xz
nasm-495fda63418600229f36a3a7de62b75620be34b6.zip
elf: support weak global and extern references
A global or extern definition can now contain the keyword "weak" (or "strong", although that is the default) to create a weak symbol or a weak external reference, respectively. Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
Diffstat (limited to 'test')
-rw-r--r--test/elf_visibility.asm23
1 files changed, 20 insertions, 3 deletions
diff --git a/test/elf_visibility.asm b/test/elf_visibility.asm
index 4874b62d..8098e227 100644
--- a/test/elf_visibility.asm
+++ b/test/elf_visibility.asm
@@ -1,10 +1,27 @@
-global foo
+global foo:(foo_end - foo)
global foo_hidden:function hidden
+global foo_protected:function protected
+global foo_internal:function internal
+global foo_weak:function weak
+global foo_hidden_weak:function hidden weak
+
+extern strong_ref, weak_ref:weak
SECTION .text align=16
foo:
+ nop
foo_hidden:
+ nop
+foo_protected:
+ nop
+foo_internal:
+ nop
+foo_weak:
+ ret
+foo_hidden_weak:
+ mov eax,weak_ref
+ mov eax,strong_ref
foo_label:
-ret
-
+ ret
+foo_end: