ELF: Explicitly point out SYM_GLOBAL, SYM_LOCAL binding
authorCyrill Gorcunov <gorcunov@gmail.com>
Sat, 2 Jan 2010 12:53:11 +0000 (15:53 +0300)
committerCyrill Gorcunov <gorcunov@gmail.com>
Sun, 3 Jan 2010 12:04:46 +0000 (15:04 +0300)
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>
output/outelf.h
output/outelf32.c
output/outelf64.c

index 850f8fe2b45842b3f7c3e41f06b16918cd170317..93a620c35b71b26f8ab893072388d683fae918ed 100644 (file)
 #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 */
 
index 52fb91c2d65ef4e079cd484c89634179ae87eda0..0ce21135818304beb842a2822880dca86315aeea 100644 (file)
@@ -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)
index acd79d4093bbee3e06c8ac729605490c74b956b7..fb373b782daf0c9e7c63a077000d20018bab4445 100644 (file)
@@ -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)