Thanks all, I seem to have figured out the problem

The ELF executable format is changed using a linker script which needs
to be provided at the linking time. It actually works on the ELF
generated to move the text and data sections in the executable and if
we dont give that script to the linker, it cribs

Thanks Wei


On Oct 25, 3:52 am, "Wei Dai" <[EMAIL PROTECTED]> wrote:
> GCC 3.2 should be ok, as far as I know.
>
> Sorry, but my knowledge of GCC cross compiling and the ELF executable format
> is minimal. I have no idea what is going on here. Maybe the people who
> maintain the MIPS simulator have a mailing list that you can post this
> question to?
>
> --------------------------------------------------
> From: "Cyptmon" <[EMAIL PROTECTED]>
> Sent: Wednesday, October 24, 2007 9:32 PM
> To: "Crypto++ Users" <[EMAIL PROTECTED]>
> Subject: Re: Build issues
>
>
>
> > Another thing is I am using mips cross compiler version 3.2 which is
> > based on gcc compiler version 3.2. Can this also affect the correct
> > working of the library?
>
> > On Oct 24, 11:30 pm, Cyptmon <[EMAIL PROTECTED]> wrote:
> >> A minor correction to my earlier post, the elf parsing code that i
> >> pasted, it fails in the data section not the code section, however,
> >> the checks that fail are the same except that Text is replaced with
> >> data
>
> >> Thanks and waiting for your reply
>
> >> On Oct 24, 11:09 pm, Cyptmon <[EMAIL PROTECTED]> wrote:
>
> >> > I tried running a simple program written in C++ and compiling using
> >> > the same command and ran it under the simulator, that works fine,
> >> > which tells me that there is something wrong that I am doing when
> >> > linking to the library. All other benchmarks compiled with this cross
> >> > compiler run fine as well.
>
> >> > Hope you can give me some insight into the problem
>
> >> > On Oct 24, 6:20 pm, Cyptmon <[EMAIL PROTECTED]> wrote:
>
> >> > > Hi,
>
> >> > > I was just wondering if the compiler options that I use for compiling
> >> > > the library are fine with the way the  library should be compiled,
> >> > > some compliance issues or something
>
> >> > > I am pasting the options that I use here again for your quick
> >> > > reference, in particular the -Wa,-non_shared and -static options.
>
> >> > > The error is actually on the simulator, it parses the ELF executable
> >> > > generated
>
> >> > > stores the address where the executable is loaded in a variable named
> >> > > "addr"
>
> >> > > It then parses the headers of the executable, in the header called
> >> > > "__libc_freeres_fn"
>
> >> > > It checks for the following there
>
> >> > > if (strcmp(name, "__libc_freeres_fn") == 0) {
> >> > >       if (Text_start == 0) {
> >> > >         Text_seek = offset;
> >> > >         Text_start = addr;
> >> > >         Text_size = size;
> >> > >       } else if (addr != Text_start + Text_size){
>
> >> > >  if( (addr - ( Text_start + Text_size)) < 256 ){
> >> > > #ifdef DEBUG
> >> > >           fprintf(stderr,"__libc_freeres_fn Minor header aligment
> >> > > correction (%x vs %x)\n"
> >> > >                   ,addr,( Text_start + Text_size));
> >> > > #endif
> >> > >           Text_size += size + addr - ( Text_start + Text_size);
> >> > >         }else
> >> > >           fatal("__libc_freeres_fn section not contiguous with .text
> >> > > section\n");
>
> >> > > //The above line is the error that i get
>
> >> > > Here are the flags that I use for compilation
>
> >> > > LDFLAGS
> >> > > = -mips2 -mno-abicalls -mabi=32 -mtune=r6000 -msplit-addresses
> >> > > -lm -Wa,--start-group -lc -lnss_files -lnss_dns -lresolv -Wa,--end-
> >> > > group
> >> > > #MLDOPTS    +=-mips2 -Wa,-non_shared
> >> > > AR = /usr/local/bin/mipseb-linux-ar
> >> > > ARFLAGS = -rv
> >> > > RANLIB = /usr/local/bin/mipseb-linux-ranlib
> >> > > CP = cp
> >> > > MKDIR = mkdir
> >> > > EGREP = egrep
> >> > > UNAME = $(shell uname)
> >> > > ISX86 = $(shell uname -m | $(EGREP) -c "i.86|x86|i86")
> >> > > ISMINGW = $(shell uname | $(EGREP) -c "MINGW32")
>
> >> > > CXX = /usr/local/bin/mipseb-linux-g++
> >> > > CXXFLAGS =  -mips2 -mno-abicalls  -mabi=32 -mtune=r6000 -msplit-
> >> > > addresses  -I. -static -Wa,-non_shared -I. -I/usr/local/mipseb-linux/
> >> > > include/c++/3.2 -I/usr/local/mipseb-linux/include/c++/3.2/backward -I/
> >> > > usr/local/mipseb-linux/include/c++/3.2/mips-linux-gnu
>
> >> > > #-I. -I/usr/local/mipseb-linux/include/c++/3.2 -I/usr/local/mipseb-
> >> > > linux/include/c++/3.2/backward -I/usr/local/mipseb-linux/include/c++/
> >> > > 3.2/mips-linux-gnu -static -Wa,-non_shared -mips2 -mno-abicalls -
> >> > > mabi=32 -mtune=r6000 -msplit-addresses  -mips2 -Wa,-non_shared
>
> >> > > On Oct 24, 5:38 pm, "Wei Dai" <[EMAIL PROTECTED]> wrote:
>
> >> > > > Sorry, I have no idea what that means. Google doesn't even have one
> >> > > > hit for
> >> > > > "data sections not contiguous", which doesn't make any sense... Did
> >> > > > you copy
> >> > > > the exact error message?
>
> >> > > > --------------------------------------------------
> >> > > > From: "Cyptmon" <[EMAIL PROTECTED]>
> >> > > > Sent: Tuesday, October 23, 2007 10:57 PM
> >> > > > To: "Crypto++ Users" <[EMAIL PROTECTED]>
> >> > > > Subject: Re: Build issues
>
> >> > > > > Hi,
>
> >> > > > > I removed some of the socket related #defines as you suggested
> >> > > > > from
> >> > > > > config.h
>
> >> > > > > Now the library builds fine
>
> >> > > > > However, when I try to run it on the simulator
>
> >> > > > > It gives the following error for cryptest.exe
>
> >> > > > > ERROR: __libc_subfreeres data sections not contiguous
>
> >> > > > > Would you know anything why this can happen, some compiler/linker
> >> > > > > option causing this behavior, some ordering problem ?
>
> >> > > > > Thanks
>
> >> > > > > On Oct 24, 12:18 am, Cyptmon <[EMAIL PROTECTED]> wrote:
> >> > > > >> I will recompile the cross compiler in the night and post on the
> >> > > > >> list
> >> > > > >> if it worked, thanks for the pointers though
>
> >> > > > >> On Oct 23, 11:56 pm, "Wei Dai" <[EMAIL PROTECTED]> wrote:
>
> >> > > > >> > I have a couple of ideas:
>
> >> > > > >> > 1. Edit config.h and comment out the line "#define
> >> > > > >> > SOCKETS_AVAILABLE"
> >> > > > >> > 2. Recompile your mips glibc with --enable-static-nss
>
> >> > > > >> > --------------------------------------------------
> >> > > > >> > From: "Cyptmon" <[EMAIL PROTECTED]>
> >> > > > >> > Sent: Tuesday, October 23, 2007 2:09 PM
> >> > > > >> > To: "Crypto++ Users" <[EMAIL PROTECTED]>
> >> > > > >> > Subject: Build issues
>
> >> > > > >> > > I am trying to build the library for MIPS, I have changed
> >> > > > >> > > the make
> >> > > > >> > > file and I am putting the changes to the makefile towards
> >> > > > >> > > the end.
> >> > > > >> > > Now
> >> > > > >> > > things compile fine but there is a linker error, it builds
> >> > > > >> > > the
> >> > > > >> > > library, however, when I try to link it to another program,
> >> > > > >> > > it says,
> >> > > > >> > > linking not done...
>
> >> > > > >> > > Here are the changes to the Makefile
>
> >> > > > >> > > LDFLAGS
> >> > > > >> > > = -mips2 -mno-abicalls -mabi=32 -mtune=r6000 -msplit-addresses
> >> > > > >> > > -lm -Wa,--start-group -lc -lnss_files -lnss_dns -lresolv 
> >> > > > >> > > -Wa,--end-
> >> > > > >> > > group
> >> > > > >> > > #MLDOPTS    +=-mips2 -Wa,-non_shared
> >> > > > >> > > AR = /usr/local/bin/mipseb-linux-ar
> >> > > > >> > > ARFLAGS = -rv
> >> > > > >> > > RANLIB = /usr/local/bin/mipseb-linux-ranlib
> >> > > > >> > > CP = cp
> >> > > > >> > > MKDIR = mkdir
> >> > > > >> > > EGREP = egrep
> >> > > > >> > > UNAME = $(shell uname)
> >> > > > >> > > ISX86 = $(shell uname -m | $(EGREP) -c "i.86|x86|i86")
> >> > > > >> > > ISMINGW = $(shell uname | $(EGREP) -c "MINGW32")
>
> >> > > > >> > > CXX = /usr/local/bin/mipseb-linux-g++
> >> > > > >> > > CXXFLAGS
> >> > > > >> > > =  -mips2 -mno-abicalls  -mabi=32 -mtune=r6000 -msplit-
> >> > > > >> > > addresses  -I. -static -Wa,-non_shared -I. 
> >> > > > >> > > -I/usr/local/mipseb-linux/
> >> > > > >> > > include/c++/3.2 
> >> > > > >> > > -I/usr/local/mipseb-linux/include/c++/3.2/backward -I/
> >> > > > >> > > usr/local/mipseb-linux/include/c++/3.2/mips-linux-gnu
>
> >> > > > >> > > #-I. -I/usr/local/mipseb-linux/include/c++/3.2 
> >> > > > >> > > -I/usr/local/mipseb-
> >> > > > >> > > linux/include/c++/3.2/backward 
> >> > > > >> > > -I/usr/local/mipseb-linux/include/c++/
> >> > > > >> > > 3.2/mips-linux-gnu -static -Wa,-non_shared -mips2 
> >> > > > >> > > -mno-abicalls -
> >> > > > >> > > mabi=32 -mtune=r6000 -msplit-addresses  -mips2 -Wa,-non_shared
>
> >> > > > >> > > SRCS = $(wildcard *.cpp)
> >> > > > >> > > ifeq ($(SRCS),)                         # workaround
> >> > > > >> > > wildcard
> >> > > > >> > > function
> >> > > > >> > > bug in GNU Make 3.77
> >> > > > >> > > SRCS = $(shell echo *.cpp)
> >> > > > >> > > endif
> >> > > > >> > > OBJS = $(SRCS:.cpp=.o)
> >> > > > >> > > # test.o needs to be after bench.o for cygwin 1.1.4
> >> > > > >> > > (possible ld
> >> > > > >> > > bug?)
> >> > > > >> > > TESTOBJS = bench.o bench2.o test.o validat1.o validat2.o
> >> > > > >> > > validat3.o
> >> > > > >> > > adhoc.o datatest.o regtest.o fipsalgt.o dlltest.o
> >> > > > >> > > LIBOBJS = $(filter-out $(TESTOBJS),$(OBJS))
>
> >> > > > >> > > Here is the linker errors that I get
>
> >> > > > >> > > /usr/local/bin/mipseb-linux-g++  -o
> >> > > > >> > > cryptest.exe -mips2 -mno-abicalls
> >> > > > >> > > -mabi=32 -mtune=r6000 -msplit-addresses  -I. -static 
> >> > > > >> > > -Wa,-non_shared -
> >> > > > >> > > I. -I/usr/local/mipseb-linux/include/c++/3.2 
> >> > > > >> > > -I/usr/local/mipseb-linux/
> >> > > > >> > > include/c++/3.2/backward 
> >> > > > >> > > -I/usr/local/mipseb-linux/include/c++/3.2/
> >> > > > >> > > mips-linux-gnu bench.o bench2.o test.o validat1.o validat2.o
> >> > > > >> > > validat3.o adhoc.o datatest.o regtest.o fipsalgt.o
> >> > > > >> > > dlltest.o -L. -
> >> > > > >> > > lcryptopp -mips2 -mno-abicalls -mabi=32 -mtune=r6000 
> >> > > > >> > > -msplit-addresses
> >> > > > >> > > -lm -Wa,--start-group -lc -lnss_files -lnss_dns -lresolv 
> >> > > > >> > > -Wa,--end-
> >> > > > >> > > group
> >> > > > >> > > /usr/local/lib/gcc-lib/mipseb-linux/3.2.1/../../../../mipseb-linux/lib/
> >> > > > >> > > libc.a(nsswitch.o)(.data+0x64): undefined reference to
> >> > > > >> > > `_nss_files_getaliasent_r'
> >> > > > >> > > /usr/local/lib/gcc-lib/mipseb-linux/3.2.1/../../../../mipseb-linux/lib/
> >> > > > >> > > libc.a(nsswitch.o)(.data+0x6c): undefined reference to
> >> > > > >> > > `_nss_files_endaliasent'
> >> > > > >> > > /usr/local/lib/gcc-lib/mipseb-linux/3.2.1/../../../../mipseb-linux/lib/
> >> > > > >> > > libc.a(nsswitch.o)(.data+0x74): undefined reference to
> >> > > > >> > > `_nss_files_setaliasent'
>
> ...
>
> read more ยป


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the "Crypto++ Users" 
Google Group.
To unsubscribe, send an email to [EMAIL PROTECTED]
More information about Crypto++ and this group is available at 
http://www.cryptopp.com.
-~----------~----~----~----~------~----~------~--~---

Reply via email to