Page 1 of 1

ET_DYN and gcc 3.2.2

PostPosted: Thu Mar 13, 2003 4:47 pm
by meekrob
I modified my specs file according to directions, now gcc doesn't compile anything. I suppose I have made a mistake, heres my modified spec file (or at least the releveant sections):




Code: Select all
*link:
%{shared: %{<et_dyn} }
%{!static:--eh-frame-hdr} -m elf_i386 %{shared:-shared}   %{!shared:     %{!ibcs:       %{!static:    %{rdynamic:-export-dynamic}    %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}}    %{static:-static}}}

*lib:
%{pthread:-lpthread}    %{shared:-lc}    %{!shared:%{mieee-fp:-lieee} %{profile:-lc_p}%{!profile:-lc}}

*libgcc:
%{static|static-libgcc:-lgcc -lgcc_eh}%{!static:%{!static-libgcc:%{!shared:%{!shared-libgcc:-lgcc -lgcc_eh}%{shared-libgcc:-lgcc_s%M -lgcc}}%{shared:%{shared-libgcc:-lgcc_s%M}%{!shared-libgcc:-lgcc}}}}

*startfile:
%{shared: %{et_dyn:crt1S.o%s interp.o%s} }
%{!shared:      %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s}              %{!p:%{profile:gcrt1.o%s}           %{!profile:crt1.o%s}}}}    crti.o%s %{static:crtbeginT.o%s}   %{!static:%{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}}



Where am I going wrong?

Thanks,

-meekrob

Re: ET_DYN and gcc 3.2.2

PostPosted: Thu Mar 13, 2003 8:46 pm
by PaX Team
meekrob wrote:I modified my specs file according to directions, now gcc doesn't compile anything.
1. where did you put the crt1S.o and interp.o files?
2. what does 'gcc -shared -et_dyn some.c' do/say?

PostPosted: Fri Mar 14, 2003 3:53 pm
by meekrob
I put crt1S.o and interp.o in /usr/lib ... that's the location of crt1.o.
Code: Select all
laptop lib $ ls -l crt* interp.o
-rw-r--r--    1 root     root         1136 Jan  8 13:01 crt1.o
-rw-r--r--    1 root     root         1064 Mar 13 05:15 crt1S.o
-rw-r--r--    1 root     root         1888 Jan  8 13:01 crti.o
-rw-r--r--    1 root     root         1456 Jan  8 13:01 crtn.o
-rw-r--r--    1 root     root          807 Mar 13 05:15 interp.o


Here is the result when I run gcc against the hello world a.c that comes with the et_dyn.zip:

Code: Select all
laptop linux $ gcc -shared -et_dyn a.c
a.c:9:2: warning: no newline at end of file
collect2: no arguments
laptop linux $ gcc a.c
a.c:9:2: warning: no newline at end of file
collect2: no arguments
laptop linux $ ls
Makefile  README  a.c  crt1S.S  crt1S.o  interp.c  interp.o



Here it is with the old specs file:

Code: Select all
laptop linux $ gcc -shared -et_dyn a.c
a.c:9:2: warning: no newline at end of file
laptop linux $ ./a.out
Segmentation fault
laptop linux $ gcc a.c
a.c:9:2: warning: no newline at end of file
laptop linux $ ./a.out
hello world


Here is gcc -v:

Code: Select all
laptop linux $ gcc -v
Reading specs from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.2.2/specs
Configured with: /var/tmp/portage/gcc-3.2.2/work/gcc-3.2.2/configure --prefix=/usr --bindir=/usr/i686-pc-linux-gnu/gcc-bin/3.2 --includedir=/usr/lib/gcc-lib/i686-pc-linux-gnu/3.2.2/include --datadir=/usr/share/gcc-data/i686-pc-linux-gnu/3.2 --mandir=/usr/share/gcc-data/i686-pc-linux-gnu/3.2/man --infodir=/usr/share/gcc-data/i686-pc-linux-gnu/3.2/info --enable-shared --host=i686-pc-linux-gnu --target=i686-pc-linux-gnu --with-system-zlib --enable-languages=c,c++,ada,f77,objc,java --enable-threads=posix --enable-long-long --disable-checking --enable-cstdio=stdio --enable-clocale=generic --enable-__cxa_atexit --enable-version-specific-runtime-libs --with-gxx-include-dir=/usr/lib/gcc-lib/i686-pc-linux-gnu/3.2.2/include/g++-v3 --with-local-prefix=/usr/local --enable-shared --enable-nls --without-included-gettext
Thread model: posix
gcc version 3.2.2


What does --enable-shared do? It's strange that it is in there twice.

Thanks,

meekrob

PostPosted: Fri Mar 14, 2003 4:57 pm
by PaX Team
meekrob wrote:Here is the result when I run gcc against the hello world a.c that comes with the et_dyn.zip:

Code: Select all
laptop linux $ gcc -shared -et_dyn a.c
a.c:9:2: warning: no newline at end of file
collect2: no arguments
i think what happened here is that when you changed the specs file, you introduced line breaks which you were not supposed to ;-).
What does --enable-shared do? It's strange that it is in there twice.
that must be an artifact from gentoo but it's harmless. it enables the creation of shared libraries of libgcc and others, more i don't know either.