If uClibc's ld.so encounters text relocations in a shared library - one  containing an object built without -fpic/-fPIC - then:
If uClibc's ld.so encounters text relocations in a shared library - one 
containing an object built without -fpic/-fPIC - then:

* If __FORCE_SHAREABLE_TEXT_SEGMENTS__, then it gives an error "Can't 
modify %s's text section. Use GCC option -fPIC for shared objects, 
please.\n" and exits.

* Otherwise, it makes the library's pages writable and relocates it.

If it encounters text relocations in a position-independent executable - 
one containing an object built without -fpie/-fPIE/-fpic/-fPIC - then:

* If __FORCE_SHAREABLE_TEXT_SEGMENTS__, it does nothing about making the 
pages writable, leading to a crash.

* Otherwise, the loop to make the pages writable uses the same variable 
ppnt as used in an outer loop, messing up that outer loop and also causing 
a crash.

This patch fixes both cases, by giving an error if 
__FORCE_SHAREABLE_TEXT_SEGMENTS__ and saving and restoring ppnt otherwise.  
Tested in both cases on ARM EABI.

Joseph S. Myers
joseph@codesourcery.com

OpenInkpot-archive/iplinux-uclibc,waweber/uclibc-clang,ddcc/klee-uclibc-0.9.33.2,waweber/uclibc-clang,ffainelli/uClibc,kraj/uClibc,kraj/uclibc-ng,kraj/uclibc-ng,waweber/uclibc-clang,hjl-tools/uClibc,m-labs/uclibc-lm32,m-labs/uclibc-lm32,m-labs/uclibc-lm32,groundwater/uClibc,hwoarang/uClibc,groundwater/uClibc,ndmsystems/uClibc,hwoarang/uClibc,waweber/uclibc-clang,groundwater/uClibc,skristiansson/uClibc-or1k,kraj/uClibc,OpenInkpot-archive/iplinux-uclibc,foss-for-synopsys-dwc-arc-processors/uClibc,foss-xtensa/uClibc,mephi42/uClibc,atgreen/uClibc-moxie,kraj/uclibc-ng,atgreen/uClibc-moxie,czankel/xtensa-uclibc,ddcc/klee-uclibc-0.9.33.2,mephi42/uClibc,hwoarang/uClibc,ffainelli/uClibc,hjl-tools/uClibc,foss-xtensa/uClibc,ndmsystems/uClibc,ffainelli/uClibc,majek/uclibc-vx32,hjl-tools/uClibc,hjl-tools/uClibc,atgreen/uClibc-moxie,ddcc/klee-uclibc-0.9.33.2,mephi42/uClibc,kraj/uClibc,ffainelli/uClibc,czankel/xtensa-uclibc,groundwater/uClibc,wbx-github/uclibc-ng,brgl/uclibc-ng,majek/uclibc-vx32,majek/uclibc-vx32,brgl/uclibc-ng,czankel/xtensa-uclibc,wbx-github/uclibc-ng,ysat0/uClibc,czankel/xtensa-uclibc,ffainelli/uClibc,ddcc/klee-uclibc-0.9.33.2,foss-xtensa/uClibc,brgl/uclibc-ng,wbx-github/uclibc-ng,brgl/uclibc-ng,foss-for-synopsys-dwc-arc-processors/uClibc,hjl-tools/uClibc,ysat0/uClibc,OpenInkpot-archive/iplinux-uclibc,gittup/uClibc,foss-for-synopsys-dwc-arc-processors/uClibc,kraj/uclibc-ng,OpenInkpot-archive/iplinux-uclibc,skristiansson/uClibc-or1k,foss-for-synopsys-dwc-arc-processors/uClibc,groundwater/uClibc,foss-xtensa/uClibc,skristiansson/uClibc-or1k,ndmsystems/uClibc,atgreen/uClibc-moxie,ysat0/uClibc,ndmsystems/uClibc,gittup/uClibc,wbx-github/uclibc-ng,gittup/uClibc,mephi42/uClibc,m-labs/uclibc-lm32,gittup/uClibc,kraj/uClibc,hwoarang/uClibc,majek/uclibc-vx32,ysat0/uClibc,skristiansson/uClibc-or1k