On 12/11/13 06:59, Joey Ye wrote: > For RTOS who need to relocate executable, PC relative and GOTOFF cannot be > used as the offset between any sections won't be fixed. Only GOT can be > used, just as VxWorks RTP does. > > This patch introduces a new option enable user to choose between fixed > offset or not. Enabled for VxWorks RTP to keep its behavior unchanged. > > Tested with arm-none-eabi make and VxWorks RTP small case > > OK to trunk? > > ChangeLog: > 2013-11-12 Joey Ye <joey...@arm.com> > > * config/arm/arm.c (arm_option_override): Error if > -mpic-offset-unfixed without -fpic, and set for > VxWorks RTP. > (legitimize_pic_address): Use arm_pic_offset_unfixed. > (arm_assemble_integer): Likewise. > * config/arm/arm.h > (TARGET_DEFAULT_PIC_OFFSET_UNFIXED): New macro. > * config/arm/arm.opt (mpic-offset-unfixed): New option. > * doc/invoke.texi (-mpic-offset-unfixed): Doc for new option. > >
The name of the option and the documentation highlights that the option's concept is confusing. I think what you really need to do is to reverse the sense of the option name and have -mpic-data-is-text-relative with the inverse (-mno-pic-data-is-text-relative) being the active value that triggers for vxworks. That is, PIC data being text-relative is the default for all targets except vxworks. R. Oh, and at run time, we should be talking about segments, not sections!