Cced maintainer like David Edelsohn and Segher Boessenkool .
Any suggestions/comments for the below query ? Thank you ~Umesh On Thu, Oct 25, 2018 at 9:23 PM Umesh Kalappa <umesh.kalap...@gmail.com> wrote: > > Hi All, > > For the below code (test.c) > > int foo() > { > printf("Hello World"); > } > > On linux : > ccpc -mcpu=e6500 -mno-altivec -mabi=no-altivec -D_WRS_HARDWARE_FP > -mabi=elfv2 -mcmodel=med -mhard-float -S test.c > > linux asm : > the constant string fetched like > > addis 3,2,.LC0@toc@ha > addi 3,3,.LC0@toc@l > > where offset signed 32 bit used relatively to toc base on linux as > expected for the medium code model . > and the relocation entry will be generated by gas : > R_PPC64_TOC16_HA and R_PPC64_TOC16_LO > > For Windows : > > same command and windows asm looks like > > la 3,.LC0@toc(2) > > where offset used signed 16 bit used relatively to toc base why it so ?. > and the relocation entry will be : > R_PPC64_TOC16 (signed 16 bit offset ) > > why this difference and when we greping the .md file and we found > patterns (rs6000.md ) like > > ;; Largetoc support > (define_insn "*largetoc_high" > [(set (match_operand:DI 0 "gpc_reg_operand" "=b*r") > (high:DI > (unspec [(match_operand:DI 1 "" "") > (match_operand:DI 2 "gpc_reg_operand" "b")] > UNSPEC_TOCREL)))] > "TARGET_ELF && TARGET_CMODEL != CMODEL_SMALL" > "addis %0,%2,%1@toc@ha") > > (define_insn "*largetoc_high_aix<mode>" > [(set (match_operand:P 0 "gpc_reg_operand" "=b*r") > (high:P > (unspec [(match_operand:P 1 "" "") > (match_operand:P 2 "gpc_reg_operand" "b")] > UNSPEC_TOCREL)))] > "TARGET_XCOFF && TARGET_CMODEL != CMODEL_SMALL" > "addis %0,%1@u(%2)") > > the above patterns answered the difference b/w windows and linux . > > Questions to the expert is that using the medium code model ,how we > can get the same linux semantics on windows (without source code > changes) ? > > or above distinguish patterns for a reason and which we are missing here ? > > Thank you and awaiting for any comments > ~Umesh