summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCyrill Gorcunov <gorcunov@gmail.com>2010-01-02 15:53:11 +0300
committerCyrill Gorcunov <gorcunov@gmail.com>2010-01-03 15:04:46 +0300
commita135658e83e4917b9a79c5e1337847c2a2bbdf90 (patch)
tree2bcb07c27772efeb4876dbed25cee1a646d8cdf2
parentde623f267918a316e1c8c9fa63ccee67922470cf (diff)
downloadnasm-a135658e83e4917b9a79c5e1337847c2a2bbdf90.tar.gz
nasm-a135658e83e4917b9a79c5e1337847c2a2bbdf90.tar.bz2
nasm-a135658e83e4917b9a79c5e1337847c2a2bbdf90.zip
ELF: Explicitly point out SYM_GLOBAL, SYM_LOCAL binding
Instead of implicit declaration of global symbols obtained by STB_GLOBAL << 4, and local symbols by STB_LOCAL << 4 use ELF32_ST_MKBIND helpers. Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
-rw-r--r--output/outelf.h6
-rw-r--r--output/outelf32.c3
-rw-r--r--output/outelf64.c3
3 files changed, 7 insertions, 5 deletions
diff --git a/output/outelf.h b/output/outelf.h
index 850f8fe..93a620c 100644
--- a/output/outelf.h
+++ b/output/outelf.h
@@ -37,7 +37,11 @@
#ifndef OUTPUT_OUTELF_H
#define OUTPUT_OUTELF_H
-#define SYM_GLOBAL 0x10
+#include "output/elf.h"
+
+/* symbol binding */
+#define SYM_GLOBAL ELF32_ST_MKBIND(STB_GLOBAL)
+#define SYM_LOCAL ELF32_ST_MKBIND(STB_LOCAL)
#define GLOBAL_TEMP_BASE 0x40000000 /* bigger than any sane symbol index */
diff --git a/output/outelf32.c b/output/outelf32.c
index 52fb91c..0ce2113 100644
--- a/output/outelf32.c
+++ b/output/outelf32.c
@@ -56,7 +56,6 @@
#include "output/dwarf.h"
#include "output/stabs.h"
-#include "output/elf.h"
#include "output/outelf.h"
#ifdef OF_ELF32
@@ -516,7 +515,7 @@ static void elf_deflabel(char *name, int32_t segment, int64_t offset,
memset(&sym->symv, 0, sizeof(struct rbtree));
sym->strpos = pos;
- sym->type = is_global ? SYM_GLOBAL : 0;
+ sym->type = is_global ? SYM_GLOBAL : SYM_LOCAL;
sym->other = STV_DEFAULT;
sym->size = 0;
if (segment == NO_SEG)
diff --git a/output/outelf64.c b/output/outelf64.c
index acd79d4..fb373b7 100644
--- a/output/outelf64.c
+++ b/output/outelf64.c
@@ -56,7 +56,6 @@
#include "output/dwarf.h"
#include "output/stabs.h"
-#include "output/elf.h"
#include "output/outelf.h"
#ifdef OF_ELF64
@@ -514,7 +513,7 @@ static void elf_deflabel(char *name, int32_t segment, int64_t offset,
memset(&sym->symv, 0, sizeof(struct rbtree));
sym->strpos = pos;
- sym->type = is_global ? SYM_GLOBAL : 0;
+ sym->type = is_global ? SYM_GLOBAL : SYM_LOCAL;
sym->other = STV_DEFAULT;
sym->size = 0;
if (segment == NO_SEG)