From e51026c1f0de8735d4814b9d93bb4574771bad76 Mon Sep 17 00:00:00 2001 From: John van Groningen Date: Wed, 31 Jul 2013 12:54:21 +0000 Subject: fix offsets in descriptors, for position independent code on linux --- cgcode.c | 14 ++++++++++++++ cginstructions.c | 5 +++++ 2 files changed, 19 insertions(+) diff --git a/cgcode.c b/cgcode.c index b756f63..513bd2f 100644 --- a/cgcode.c +++ b/cgcode.c @@ -8759,7 +8759,16 @@ static void write_descriptor_curry_table (int arity,LABEL *code_label) for (n=0; n<=arity; ++n){ #ifdef GEN_OBJ # ifdef NEW_DESCRIPTORS +# ifdef MACH_O64 + store_2_words_in_data_section (n,(arity-n)<<4); +# else +# if defined (G_A64) && defined (LINUX) + if (pic_flag) + store_2_words_in_data_section (n,(arity-n)<<4); + else +# endif store_2_words_in_data_section (n,(arity-n)<<3); +# endif # else store_2_words_in_data_section (n,n<<3); # endif @@ -8770,6 +8779,11 @@ static void write_descriptor_curry_table (int arity,LABEL *code_label) # ifdef MACH_O64 w_as_word_in_data_section ((arity-n)<<4); # else +# if defined (G_A64) && defined (LINUX) + if (pic_flag) + w_as_word_in_data_section ((arity-n)<<4); + else +# endif w_as_word_in_data_section ((arity-n)<<3); # endif #else diff --git a/cginstructions.c b/cginstructions.c index 45dab01..ebbbf8f 100644 --- a/cginstructions.c +++ b/cginstructions.c @@ -866,6 +866,11 @@ INSTRUCTION_GRAPH g_load_des_i (LABEL *descriptor_label,int arity) # ifdef MACH_O64 instruction->instruction_parameters[1].i=(arity<<4)+2; # else +# if defined (G_A64) && defined (LINUX) + if (pic_flag) + instruction->instruction_parameters[1].i=(arity<<4)+2; + else +# endif instruction->instruction_parameters[1].i=(arity<<3)+2; # endif #else -- cgit v1.2.3