summaryrefslogtreecommitdiff
path: root/cgaas.c
diff options
context:
space:
mode:
authorJohn van Groningen2013-07-17 11:54:59 +0000
committerJohn van Groningen2013-07-17 11:54:59 +0000
commit4cbb339b7d664b96121044f90a25e69a0be4532a (patch)
treefaf327811e4689c2ef84794c60ea5e5fdcd637fb /cgaas.c
parentstore pc relative offset instead of descriptor in code section for (diff)
make global labels protected for position independent code on linux
Diffstat (limited to 'cgaas.c')
-rw-r--r--cgaas.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/cgaas.c b/cgaas.c
index 9d8b7ca..d379345 100644
--- a/cgaas.c
+++ b/cgaas.c
@@ -6861,8 +6861,16 @@ static void write_object_labels (void)
label=object_label->object_label_label;
#ifdef ELF
write_l (object_label->object_label_string_offset);
+# ifdef LINUX
+ if (pic_flag){
+ write_c (ELF32_ST_INFO (STB_GLOBAL,STT_OBJECT));
+ write_c (STV_PROTECTED);
+ } else
+# endif
+ {
write_c (ELF32_ST_INFO (STB_GLOBAL,STT_FUNC));
write_c (0);
+ }
# ifdef FUNCTION_LEVEL_LINKING
write_w (2+label->label_object_label->object_label_section_n);
write_q (label->label_offset - label->label_object_label->object_label_offset);
@@ -6900,6 +6908,11 @@ static void write_object_labels (void)
#ifdef ELF
write_l (object_label->object_label_string_offset);
write_c (ELF32_ST_INFO (STB_GLOBAL,STT_OBJECT));
+# ifdef LINUX
+ if (pic_flag)
+ write_c (STV_PROTECTED);
+ else
+# endif
write_c (0);
# ifdef FUNCTION_LEVEL_LINKING
write_w (2+n_code_sections+label->label_object_label->object_label_section_n);