This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Patch for arm-uclinux to operate without GOT


>This patch allows the arm-uclinux target to generate
>Position Independent Code operating without GLOBAL_OFFSET_TABLE

Richard has already pointed out a variety of areas where this patch needs to 
be cleaned up before it can be applied.  I have a few additional concerns.

>+ #undef  SUBTARGET_EXTRA_LINK_SPEC	
>+ #  define SUBTARGET_EXTRA_LINK_SPEC	\
>+ " %{mapcs-26:-m armelf_linux26} %{!mapcs-26:-m armelf_linux} -p" \
>+ " %{mdisable-got:-m armelf_uclinux}"

This suggests that you have some binutils patches as well to add a new 
emulation.  I don't think that `armelf_uclinux' is a very good name for that - 
this would imply that it was the default ucLinux/ARM ABI, which doesn't seem 
to be the case from your patch.  I'd like those patches to be approved 
for binutils before this change is made to GCC.

>! 	  /*
>! 	    When doing PIC without GOT (ucLinux/ARM) we don't need to add pic regiser
>! 		to the symbols in the .text section.
>! 		When doing PIC with GOT we alway add pic register in.
>! 	  */
>! 	  if (NEED_GOT_RELOC  || !SYMBOL_REF_FLAG(orig))
>! 	    {
>! 		  pic_ref = gen_rtx_PLUS (Pmode, pic_offset_table_rtx,
>! 							  address);
>! 
>! 		  if (NEED_GOT_RELOC)

This change will break PIC code on NetBSD.  The NEED_GOT_RELOC flag only says 
whether or not the assembler expects explicit `(GOT)' and `(GOTOFF)' markers 
to trigger GOT-based relocs; it shouldn't play this kind of role in code 
generation.  For Linux PIC the behaviour before and after your change seems 
equivalent, so there is no problem.  

Before resubmitting your patch, please build cross-compilers targeting 
arm-linux and arm-netbsd, compile a trivial code fragment like this with 
-fPIC, and check that you get identical output with and without your patch:

 int a = 1;

 foo()
 {
   return a;
 }

 bar()
 {
  l1:
   return &&l1;
 }

As far as I understand it, what you're trying to achieve here is to have the 
"PIC register" contain the run-time offset between the address the data 
segment had during linking and the place it has actually landed in memory.
I don't think "-mdisable-got" is a very descriptive name for this mode; I 
would prefer something like "-mstatic-base".

>+ #define ARM_FLAG_NO_GOT  (1 << (ARM_FLAG_LAST_USED_BIT+1))

Just add this directly to arm.h.  Flag bits are not such a scarce resource 
that we need to allocate them on a per-subtarget basis.

p.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]