Changes openssl/build.sh to create its own target
This should ensure we build everything for i386 and only link the lib files we mean to. Also no longer builds any of the superfluous openssl executables since all we need are the .so files. See #6268unstable
parent
dd50d98b19
commit
10237f7c12
|
@ -1,15 +1,34 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
OSSL=openssl-0.9.8o
|
set -e
|
||||||
|
|
||||||
pushd $OSSL
|
#OSSL=openssl-0.9.8o
|
||||||
./Configure threads no-zlib no-krb5 386 --prefix=/tmp/out linux-msf no-dlfcn shared
|
OSSL=openssl-0.9.8n
|
||||||
popd
|
|
||||||
|
|
||||||
export LIBC=../../bionic/libc
|
cd $OSSL
|
||||||
export LIBM=../../bionic/libm
|
|
||||||
export COMPILED=../../bionic/compiled
|
cat Configure | grep -v 'linux-msf' | sed -e 's#my %table=(#my %table=(\
|
||||||
|
"linux-msf", "gcc:\\$\\${MSF_CFLAGS} -DL_ENDIAN -DTERMIO -Wall::\\$\\${MSF_CFLAGS} -D_REENTRANT::\\$\\${MSF_CFLAGS} -ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:\\$\\${MSF_CFLAGS} -fPIC::.so.\\$(SHLIB_MAJOR).\\$(SHLIB_MINOR)",\
|
||||||
|
#;' > Configure-msf
|
||||||
|
mv Configure-msf Configure
|
||||||
|
chmod +x Configure
|
||||||
|
|
||||||
|
./Configure --prefix=/tmp/out threads shared no-hw no-dlfcn no-zlib no-krb5 no-idea 386 linux-msf
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
|
||||||
|
# These have to be relative to PWD because the OpenSSL make system builds in
|
||||||
|
# multiple different levels of subdirs, so we can't just use ../../
|
||||||
|
export LIBC=${PWD}/../bionic/libc
|
||||||
|
export LIBM=${PWD}/../bionic/libm
|
||||||
|
export COMPILED=${PWD}/../bionic/compiled
|
||||||
|
|
||||||
|
export MSF_CFLAGS="-Os -Wl,--hash-style=sysv -march=i386 -nostdinc -nostdlib -fno-builtin -fpic -I ${LIBC}/include -I ${LIBC}/kernel/common/linux/ -I ${LIBC}/kernel/common/ -I ${LIBC}/arch-x86/include/ -I ${LIBC}/kernel/arch-x86/ -I${LIBC}/private -I${LIBM}/include -DPIC -Dwchar_t='char' -D_SIZE_T_DECLARED -DElf_Size='u_int32_t' -D_BYTE_ORDER=_LITTLE_ENDIAN -L${COMPILED} -lc"
|
||||||
|
|
||||||
|
# We don't need all the random executable utilities that 'all' builds, just the
|
||||||
|
# important .so files
|
||||||
|
#make -C $OSSL depend clean all
|
||||||
|
|
||||||
|
make -C $OSSL depend clean build_libs
|
||||||
|
|
||||||
export CFLAGS="-I ${LIBC}/include -I ${LIBC}/kernel/common/linux/ -I ${LIBC}/kernel/common/ -I ${LIBC}/arch-x86/include/ -I ${LIBC}/kernel/arch-x86/ -I${LIBC}/private -fPIC -DPIC -nostdinc -nostdlib -Dwchar_t='char' -fno-builtin -D_SIZE_T_DECLARED -DElf_Size='u_int32_t' -I${LIBM}/include -L${COMPILED} -D_BYTE_ORDER=_LITTLE_ENDIAN -lc"
|
|
||||||
|
|
||||||
make -C $OSSL depend clean all
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ CFLAGS=-I${PWD}/hack
|
||||||
CFLAGS+= -I ../../bionic/libc/include -I ../../bionic/libc/kernel/common/linux/ -I ../../bionic/libc/kernel/common/ -I ../../bionic/libc/arch-x86/include/
|
CFLAGS+= -I ../../bionic/libc/include -I ../../bionic/libc/kernel/common/linux/ -I ../../bionic/libc/kernel/common/ -I ../../bionic/libc/arch-x86/include/
|
||||||
CFLAGS+= -I ../../bionic/libc/kernel/arch-x86/ -I../../source/server/elf/headers -I../../bionic/libc/private -fPIC -DPIC
|
CFLAGS+= -I ../../bionic/libc/kernel/arch-x86/ -I../../source/server/elf/headers -I../../bionic/libc/private -fPIC -DPIC
|
||||||
CFLAGS+= -nostdinc -nostdlib -Dwchar_t="char" -fno-builtin -D_SIZE_T_DECLARED -DElf_Size="u_int32_t" -DANDROID_X86_LINKER
|
CFLAGS+= -nostdinc -nostdlib -Dwchar_t="char" -fno-builtin -D_SIZE_T_DECLARED -DElf_Size="u_int32_t" -DANDROID_X86_LINKER
|
||||||
CFLAGS+= -ggdb
|
#CFLAGS+= -ggdb
|
||||||
CFLAGS+= -DMETSRV_RTLD -D_BYTE_ORDER=_LITTLE_ENDIAN
|
CFLAGS+= -DMETSRV_RTLD -D_BYTE_ORDER=_LITTLE_ENDIAN
|
||||||
|
|
||||||
CFLAGS+= -march=i386
|
CFLAGS+= -march=i386
|
||||||
|
@ -14,6 +14,7 @@ all: msflinker msflinker.bin rtldtest
|
||||||
|
|
||||||
msflinker: $(OBJ)
|
msflinker: $(OBJ)
|
||||||
gcc -Wl,-script=script -Wl,--hash-style=sysv $(CFLAGS) -o msflinker $(OBJ) -lgcc
|
gcc -Wl,-script=script -Wl,--hash-style=sysv $(CFLAGS) -o msflinker $(OBJ) -lgcc
|
||||||
|
strip msflinker
|
||||||
|
|
||||||
msflinker.bin: msflinker elf2bin.c
|
msflinker.bin: msflinker elf2bin.c
|
||||||
gcc -o elf2bin elf2bin.c
|
gcc -o elf2bin elf2bin.c
|
||||||
|
@ -61,5 +62,5 @@ rtldtest: rtldtest.c msflinker
|
||||||
clean:
|
clean:
|
||||||
rm -f libmetsrv_main.h libssl.h libcrypto.h libm.h libc.h libsupport.h
|
rm -f libmetsrv_main.h libssl.h libcrypto.h libm.h libc.h libsupport.h
|
||||||
rm -f *.o
|
rm -f *.o
|
||||||
rm -f msflinker msflinker.so
|
rm -f msflinker msflinker.bin msflinker.so
|
||||||
rm -f rtldtest elf2bin
|
rm -f rtldtest elf2bin
|
||||||
|
|
|
@ -60,7 +60,7 @@ int main(int argc, char **argv)
|
||||||
ehdr = (Elf32_Ehdr *)data;
|
ehdr = (Elf32_Ehdr *)data;
|
||||||
phdr = (Elf32_Phdr *)(data + ehdr->e_phoff);
|
phdr = (Elf32_Phdr *)(data + ehdr->e_phoff);
|
||||||
|
|
||||||
printf("data @ %08x, mapping @ %08x\n", data, mapping);
|
printf("data @ %p, mapping @ %p\n", data, mapping);
|
||||||
|
|
||||||
for(i = 0; i < ehdr->e_phnum; i++, phdr++) {
|
for(i = 0; i < ehdr->e_phnum; i++, phdr++) {
|
||||||
if(phdr->p_type == PT_LOAD) {
|
if(phdr->p_type == PT_LOAD) {
|
||||||
|
@ -71,7 +71,7 @@ int main(int argc, char **argv)
|
||||||
source = data + (phdr->p_offset & ~4095);
|
source = data + (phdr->p_offset & ~4095);
|
||||||
dest = mapping + ((phdr->p_vaddr - base) & ~4095);
|
dest = mapping + ((phdr->p_vaddr - base) & ~4095);
|
||||||
len = phdr->p_filesz + (phdr->p_vaddr & 4095);
|
len = phdr->p_filesz + (phdr->p_vaddr & 4095);
|
||||||
printf("memcpy(%08x, %08x, %08x)\n", dest, source, len);
|
printf("memcpy(%p, %p, %08x)\n", dest, source, len);
|
||||||
memcpy(dest, source, len);
|
memcpy(dest, source, len);
|
||||||
|
|
||||||
used += (phdr->p_memsz + (phdr->p_vaddr & 4095) + 4095) & ~4095 ;
|
used += (phdr->p_memsz + (phdr->p_vaddr & 4095) + 4095) & ~4095 ;
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
#ifndef _LINKER_DEBUG_H_
|
#ifndef _LINKER_DEBUG_H_
|
||||||
#define _LINKER_DEBUG_H_
|
#define _LINKER_DEBUG_H_
|
||||||
|
|
||||||
#define LINKER_DEBUG 1
|
#define LINKER_DEBUG 0
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
@ -41,9 +41,9 @@
|
||||||
* or 0 to use stdout instead.
|
* or 0 to use stdout instead.
|
||||||
*/
|
*/
|
||||||
#define LINKER_DEBUG_TO_LOG 0
|
#define LINKER_DEBUG_TO_LOG 0
|
||||||
#define TRACE_DEBUG 1
|
#define TRACE_DEBUG 0
|
||||||
#define DO_TRACE_LOOKUP 1
|
#define DO_TRACE_LOOKUP 0
|
||||||
#define DO_TRACE_RELO 1
|
#define DO_TRACE_RELO 0
|
||||||
|
|
||||||
/*********************************************************************
|
/*********************************************************************
|
||||||
* You shouldn't need to modify anything below unless you are adding
|
* You shouldn't need to modify anything below unless you are adding
|
||||||
|
|
Loading…
Reference in New Issue