Rob van Dam wrote: > Brian Cheeseman schreef: > >> Hi All, >> >> Below is the last lines of the output from my 'make tooldir=/usr'. I am >> a little perplexed as to why it is trying to write to the text section >> of this library after the lib has been created. I have also included a >> 'readelf -l' of the library taken from outside my jail. I am thinking >> that a patch to the Makefile is probably in order although I would >> rather understand the issue first. >> >> By my reading of the readelf output there is no way of using the >> standard tools to write into the .text section as it is in segment 00, >> which is flagged as read and execute. I must admit that I am not >> familiar with dealing with C issues of this depth so any insight or >> corrections to my reasoning would be appreciated. >> >> In short my belief is that we may need to patch the Makefile to move the >> .text section probably into either segment 01 or 02, but my knowledge >> here is rudimentary. >> >> Kind Regards, >> Brian. >> >> >> /sources/butterfly-build/./gcc/xgcc -B/sources/butterfly-build/./gcc/ >> -B/usr/i686-pc-linux-gnu/bin/ -B/usr/i686-pc-linux-gnu/lib/ -isystem >> /usr/i686-pc-linux-gnu/include -isystem >> /usr/i686-pc-linux-gnu/sys-include -L/sources/butterfly-build/./ld -O2 >> -O2 -g -O2 -DIN_GCC -W -Wall -Wwrite-strings -Wstrict-prototypes >> -Wmissing-prototypes -Wold-style-definition -isystem ./include -I. -I. >> -I../../butterfly-toolchain/gcc -I../../butterfly-toolchain/gcc/. >> -I../../butterfly-toolchain/gcc/../include -I./../intl >> -I../../butterfly-toolchain/gcc/../libcpp/include -g0 >> -finhibit-size-directive -fno-inline-functions -fno-exceptions >> -fno-stack-protector -fno-zero-initialized-in-bss -fno-unit-at-a-time >> -fno-PIE -fPIC -fno-omit-frame-pointer \ >> -c ../../butterfly-toolchain/gcc/crtstuff.c -DCRT_BEGIN \ >> -o crtbegin.o >> Can't modify /sources/butterfly-build/bfd/.libs/libbfd-2.17.so's text >> section. Use GCC option -fPIC for shared objects, please. >> make[2]: *** [crtbegin.o] Error 1 >> make[2]: Leaving directory `/sources/butterfly-build/gcc' >> make[1]: *** [all-gcc] Error 2 >> make[1]: Leaving directory `/sources/butterfly-build' >> make: *** [all] Error 2 >> >> >> # readelf -l /mnt/hlfs/sources/butterfly-build/bfd/.libs/libbfd-2.17.so >> >> Elf file type is DYN (Shared object file) >> Entry point 0x10970 >> There are 7 program headers, starting at offset 52 >> >> Program Headers: >> Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align >> LOAD 0x000000 0x00000000 0x00000000 0x857d4 0x857d4 R E 0x1000 >> LOAD 0x086664 0x00086664 0x00086664 0x05d60 0x09f6c RW 0x1000 >> DYNAMIC 0x08b85c 0x0008b85c 0x0008b85c 0x000e8 0x000e8 RW 0x4 >> GNU_EH_FRAME 0x08575c 0x0008575c 0x0008575c 0x0001c 0x0001c R 0x4 >> GNU_STACK 0x000000 0x00000000 0x00000000 0x00000 0x00000 RW 0x4 >> GNU_RELRO 0x086664 0x00086664 0x00086664 0x0599c 0x0599c R 0x1 >> LOOS+5041580 0x000000 0x00000000 0x00000000 0x00000 0x00000 0x4 >> >> Section to Segment mapping: >> Segment Sections... >> 00 .hash .dynsym .dynstr .gnu.version .gnu.version_r .rel.dyn >> .rel.plt .init .plt .text .fini .rodata .eh_frame_hdr .eh_frame >> 01 .ctors .dtors .jcr .data.rel.ro .dynamic .got .data .bss >> 02 .dynamic >> 03 .eh_frame_hdr >> 04 >> 05 .ctors .dtors .jcr .data.rel.ro .dynamic .got >> 06 >> >> >> > Brian, > Is this topic on any interest for you?: > > http://linuxfromscratch.org/pipermail/hlfs-dev/2005-May/002246.html > > > I found a copy of the hardened-specs.sh file here: > > http://www.linuxquestions.org/questions/showthread.php?t=360129 > > Rob > Rob,
Thanks for the email although I don't think that's my problem. I had already seen that post and discounted it as the command line to gcc is even telling it to use PIC. The part that concerns me is that the compiler is trying to write into a section of the lib file which is marked readonly (well read only and executable). Thanks, Brian. -- http://linuxfromscratch.org/mailman/listinfo/hlfs-dev FAQ: http://www.linuxfromscratch.org/faq/ Unsubscribe: See the above information page
