From f722cae67b412404d253b5794f638c271fb1eea8 Mon Sep 17 00:00:00 2001 From: axis Date: Fri, 11 Dec 2009 10:28:42 +0100 Subject: Switched to using ABIv2 format to generate Symbian binaries. This means using elf2e32 instead of elftran, and eliminates the need for generating exports manually. --- bin/makedeffile | 48 ------------------ bin/makeexpfile | 39 --------------- bin/makeordinalmap | 58 ---------------------- mkspecs/symbian/linux-armcc/features/qt.prf | 70 +++++++++++++-------------- mkspecs/symbian/linux-armcc/platformlibs.conf | 2 +- mkspecs/symbian/linux-armcc/qmake.conf | 4 +- qmake/generators/unix/unixmake.cpp | 6 +-- 7 files changed, 37 insertions(+), 190 deletions(-) delete mode 100755 bin/makedeffile delete mode 100755 bin/makeexpfile delete mode 100755 bin/makeordinalmap diff --git a/bin/makedeffile b/bin/makedeffile deleted file mode 100755 index e1534c4..0000000 --- a/bin/makedeffile +++ /dev/null @@ -1,48 +0,0 @@ -#!/usr/bin/perl -w - -my $deffile = $ARGV[0]; - -shift @ARGV; - -sub uniqueify { - # String must be sorted beforehand. - my $c; - my $last = $_[0]; - for ($c = 1; $c < scalar(@_); $c++) { - if ($_[$c] eq $last) { - splice(@_, $c, 1); - $c--; - } else { - $last = $_[$c]; - } - } - - return @_; -} - -my @exports; - -foreach (@ARGV) { - my $file; - open($file, "< $_") or die("Could not open $_"); - while (<$file>) { - s/[\r\n]//g; - push (@exports, $_); - } - close($file); -} - -@exports = sort(@exports); - -@exports = uniqueify(@exports); - -open(HANDLE, "> $deffile"); -print (HANDLE "EXPORTS\n; NEW:\n"); -for (my $c = 0; $c < scalar(@exports); $c++) { - if ($exports[$c] =~ /[ ]*([^ ]+)(.*)/) { - print (HANDLE "\t$1 \@ " . ($c + 1) . " NONAME$2\n"); - } -} -print(HANDLE "\n"); -close(HANDLE); - diff --git a/bin/makeexpfile b/bin/makeexpfile deleted file mode 100755 index 521791d..0000000 --- a/bin/makeexpfile +++ /dev/null @@ -1,39 +0,0 @@ -#!/usr/bin/perl -w - -my $deffile = $ARGV[0]; -my $target = $ARGV[1]; - -my @exports; -open (HANDLE, "< $deffile") or die ("Could not open $deffile"); -while () { - while (/(_Z[^ ]+)/xg) { - push (@exports, $1); - } -} -close(HANDLE); - -open(HANDLE, "> $target.s") or die("Could not open $target.s"); -print (HANDLE "\tEXPORT __DLL_Export_Table__\n\n"); -print (HANDLE "\tEXPORT |DLL##ExportTable|\n\n"); -print (HANDLE "\tEXPORT |DLL##ExportTableSize|\n\n"); -print (HANDLE "\tAREA ExportTable, CODE\n"); -print (HANDLE "__DLL_Export_Table__\n"); -print (HANDLE "\tBX lr\n"); -print (HANDLE "|DLL##ExportTableSize|\n"); -print (HANDLE "\tDCD " . scalar(@exports) . "\n"); -print (HANDLE "|DLL##ExportTable|\n"); -print (HANDLE "\tPRESERVE8\n\n"); -for (my $c = 0; $c < scalar(@exports); $c++) { - print (HANDLE "\tIMPORT $exports[$c]\n"); - print (HANDLE "\tDCD $exports[$c] ; \@ ". ($c + 1) . "\n"); -} -print (HANDLE "\n"); -print (HANDLE "\tAREA |.directive|, READONLY, NOALLOC\n"); -print (HANDLE "\tDCB \"##\\n\"\n"); -print (HANDLE "\tDCB \"EXPORT DLL##ExportTable\\n\"\n"); -print (HANDLE "\tDCB \"EXPORT DLL##ExportTableSize\\n\"\n"); -print (HANDLE "\tEND\n"); -close(HANDLE); - -my $result = system("armasm --apcs /inter -o $target $target.s"); -die("Could not execute armar") if ($result); diff --git a/bin/makeordinalmap b/bin/makeordinalmap deleted file mode 100755 index f81e1ee..0000000 --- a/bin/makeordinalmap +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/perl -w - -my $objects_dir = $ARGV[0]; -my $deffile = $ARGV[1]; -my $dllFile = $ARGV[2]; -my $target = $ARGV[3]; - -my @exports; -my @isData; -open (HANDLE, "< $deffile") or die ("Could not open $deffile"); -while () { - if (/([a-z0-9_]+)[ ]+\@/ixg) { - push (@exports, $1); - if (/\bDATA\b/x) { - push (@isData, 1); - } else { - push (@isData, 0); - } - } -} -close(HANDLE); - -my @ordinalfiles; -my $vtblExports; -open($vtblExports, "> $objects_dir/VtblExports.s") or die("Could not open $objects_dir/VtblExports.s"); -print($vtblExports "\tAREA |.directive|, NOALLOC, READONLY, ALIGN=2\n"); -print($vtblExports "\tDCB \"#\#\\n\"\n"); - -for (my $c = 1; $c < scalar(@exports) + 1; $c++) { - my $symbol = $exports[$c - 1]; - my $genstubs; - my $dllFileWithId = $dllFile; - $dllFileWithId =~ s/^(.*)(\.dll)$/$1\{00010000\}\[e001b2dc\]$2/x; - if ($isData[$c - 1]) { - printf ($vtblExports "\tDCB \"IMPORT #$dllFileWithId#<\\\\DLL>%x AS $symbol \\n\"\n", $c); - } else { - open ($genstubs, "| winewrapper genstubs.exe") or die ("Could not execute genstubs"); - printf ($genstubs "$objects_dir/ordinal-$c.o $symbol #$dllFileWithId#<\\DLL>%x\n", $c); - push (@ordinalfiles, "$objects_dir/ordinal-$c.o"); - close ($genstubs); - } -} - -print($vtblExports "\tEND\n"); -close($vtblExports); -my $result = system("armasm --apcs /inter -o $objects_dir/VtblExports.o $objects_dir/VtblExports.s"); -die("Could not execute armar") if ($result); - -my $via; -open ($via, "> $objects_dir/input.via") or die("Could not open $objects_dir/input.via"); -print ($via join("\n", @ordinalfiles)); -print ($via "\n$objects_dir/VtblExports.o\n"); -close($via); - -$result = system("armar --create $target --via $objects_dir/input.via"); -die("Could not execute armar") if ($result); - -exit 0 diff --git a/mkspecs/symbian/linux-armcc/features/qt.prf b/mkspecs/symbian/linux-armcc/features/qt.prf index acd56bf..efe7fbd 100644 --- a/mkspecs/symbian/linux-armcc/features/qt.prf +++ b/mkspecs/symbian/linux-armcc/features/qt.prf @@ -5,63 +5,59 @@ isEmpty(DESTDIR) { } for(libraries, LIBS) { - isLib = $$find(libraries, \.lib) - isEmpty(isLib) { - LIBS += $${libraries}.lib\\(VtblExports.o\\) + isFullName = $$find(libraries, \.) + isEmpty(isFullName) { + LIBS = $$replace(LIBS, "$$libraries", "$${libraries}.dso") } } for(libraries, QMAKE_LIBS) { - isLib = $$find(libraries, \.lib) - isEmpty(isLib) { - QMAKE_LIBS += $${libraries}.lib\\(VtblExports.o\\) + isFullName = $$find(libraries, \.) + isEmpty(isFullName) { + QMAKE_LIBS = $$replace(QMAKE_LIBS, "$$libraries", "$${libraries}.dso") } } # This needs to be done after the above LIBS mangling. include(../platformlibs.conf) -contains(TEMPLATE, lib):!contains(CONFIG, static):!contains(CONFIG, staticlib) { - exports.commands = winewrapper getexports.exe ${QMAKE_FILE_NAME} > ${OBJECTS_DIR}${QMAKE_FILE_BASE}.exports - exports.output = $$OBJECTS_DIR/${QMAKE_FILE_BASE}.exports - exports.input = OBJECTS - exports.variable_out = ORDINALMAP - exports.CONFIG = no_link - - deffile.input = ORDINALMAP - deffile.output = $$OBJECTS_DIR/$${TARGET}.def - deffile.commands = makedeffile $$OBJECTS_DIR/$${TARGET}.def ${QMAKE_FILE_NAME} - deffile.variable_out = DEFFILE - deffile.CONFIG = no_link combine - - expfile.input = DEFFILE - expfile.output = $$OBJECTS_DIR/$${TARGET}.exp - expfile.commands = makeexpfile ${QMAKE_FILE_NAME} $$OBJECTS_DIR/$${TARGET}.exp - expfile.variable_out = QMAKE_LIBS - expfile.CONFIG = target_predeps - - ordinalmap.input = DEFFILE - ordinalmap.output = $$DESTDIR/$${TARGET}.lib - ordinalmap.commands = makeordinalmap $$OBJECTS_DIR ${QMAKE_FILE_NAME} $${TARGET}.dll $$DESTDIR/$${TARGET}.lib - ordinalmap.variable_out = PRE_TARGETDEPS +elf2e32_LIBPATH = +for(libPath, QMAKE_LIBDIR) { + elf2e32_LIBPATH += "--libpath=$$libPath" +} + +splitVersion = $$split(VERSION, ".") +intVersion = "00" +for(verNumber, splitVersion) { + # Poor man's printf + !contains(verNumber, "[0-9][0-9]"):intVersion = "$${intVersion}0" + intVersion = "$${intVersion}$${verNumber}" +} + +intUid3 = $$lower($$replace(TARGET.UID3, "^0x", "")) +contains(TEMPLATE, lib):!contains(CONFIG, static):!contains(CONFIG, staticlib) { !isEmpty($$QMAKE_POST_LINK):QMAKE_POST_LINK += && QMAKE_POST_LINK += $$QMAKE_MOVE $$DESTDIR/$${TARGET}.dll $$DESTDIR/$${TARGET}.sym - QMAKE_POST_LINK += && winewrapper elftran.exe -version 4.1536 -sid 0xe001b2dc -allow -nocall -heap 0x00020000 0x00800000 -stack 0x00014000 -unpaged -uid1 0x10000079 -uid2 0x1000008d -uid3 0xe001b2dc -fpu softvfp -capability None $${DESTDIR}/$${TARGET}.sym $${DESTDIR}/$${TARGET}.dll + QMAKE_POST_LINK += && elf2e32 --version 4.1536 --sid 0xe001b2dc --uid1 0x10000079 --uid2 0x1000008d --uid3 0xe001b2dc --dlldata --heap=0x00020000,0x00800000 --stack=0x00014000 --capability=None --fpu=softvfp --targettype=DLL --elfinput=$${DESTDIR}/$${TARGET}.sym --output=$${DESTDIR}/$${TARGET}.dll --dso=$$DESTDIR/$${TARGET}.dso --defoutput=$$OBJECTS_DIR/$${TARGET}.def --unfrozen --linkas=$${TARGET}\\{$${intVersion}\\}\\[$${intUid3}\\].dll --compressionmethod bytepair $$elf2e32_LIBPATH --unpaged QMAKE_DISTCLEAN += $${DESTDIR}/$${TARGET}.sym + QMAKE_DISTCLEAN += $${DESTDIR}/$${TARGET}.dso + QMAKE_CLEAN += $${OBJECTS_DIR}/$${TARGET}.def - QMAKE_EXTRA_COMPILERS += exports - QMAKE_EXTRA_COMPILERS += deffile - QMAKE_EXTRA_COMPILERS += expfile - QMAKE_EXTRA_COMPILERS += ordinalmap + QMAKE_LIBS += -ledllstub.lib -ledll.lib\\(uc_dll_.o\\) - QMAKE_LIBS += -ledllstub -ledll.lib\\(uc_dll_.o\\) + QMAKE_LFLAGS += --symver_soname --soname $${TARGET}\\{$${intVersion}\\}\\[$${intUid3}\\].dll } contains(TEMPLATE, app) { - QMAKE_POST_LINK += winewrapper elftran.exe -version 10.0 -sid 0xe4d10fc9 -nocall -heap 0x00020000 0x00800000 -stack 0x00014000 -unpaged -uid1 0x1000007a -uid2 0x1000008d -uid3 0xe4d10fc9 -fpu softvfp -capability None $${DESTDIR}/$${TARGET} $${DESTDIR}/$${TARGET}.tran - QMAKE_DISTCLEAN += $${DESTDIR}/$${TARGET}.tran + !isEmpty($$QMAKE_POST_LINK):QMAKE_POST_LINK += && + + QMAKE_POST_LINK += $$QMAKE_MOVE $$DESTDIR/$${TARGET} $$DESTDIR/$${TARGET}.sym + QMAKE_POST_LINK += && elf2e32 --version 4.1536 --sid 0xe001b2dc --uid1 0x10000079 --uid2 0x1000008d --uid3 $$TARGET.UID3 --dlldata --heap=0x00020000,0x00800000 --stack=0x00014000 --capability=None --fpu=softvfp --targettype=EXE --elfinput=$${DESTDIR}/$${TARGET}.sym --output=$${DESTDIR}/$${TARGET}.exe --unfrozen --linkas=$${TARGET}\\{$${intVersion}\\}\\[$${intUid3}\\].exe --compressionmethod bytepair $$elf2e32_LIBPATH --unpaged + QMAKE_DISTCLEAN += $${DESTDIR}/$${TARGET}.exe QMAKE_LIBS += -leexe.lib\\(uc_exe_.o\\) + + QMAKE_LFLAGS += --symver_soname --soname $${TARGET}\\{$${intVersion}\\}\\[$${intUid3}\\].dll } # Symbian resource files diff --git a/mkspecs/symbian/linux-armcc/platformlibs.conf b/mkspecs/symbian/linux-armcc/platformlibs.conf index 9ef31dc..ac57790 100644 --- a/mkspecs/symbian/linux-armcc/platformlibs.conf +++ b/mkspecs/symbian/linux-armcc/platformlibs.conf @@ -1 +1 @@ -QMAKE_LIBS += -lusrt2_2 -ldfpaeabi -ldfprvct2_2.lib -ldrtaeabi -ldrtaeabi.lib\\(VtblExports.o\\) -lscppnwdl -ldrtrvct2_2 +QMAKE_LIBS += -lusrt2_2.lib -ldfpaeabi.dso -ldfprvct2_2.dso -ldrtaeabi.dso -lscppnwdl.dso -ldrtrvct2_2.dso -lh_t__uf.l\\(switch8.o\\) diff --git a/mkspecs/symbian/linux-armcc/qmake.conf b/mkspecs/symbian/linux-armcc/qmake.conf index c28acb8..780ff29 100644 --- a/mkspecs/symbian/linux-armcc/qmake.conf +++ b/mkspecs/symbian/linux-armcc/qmake.conf @@ -26,9 +26,9 @@ QMAKE_DEL_DIR = rmdir QMAKE_CHK_DIR_EXISTS = test -d QMAKE_MKDIR = mkdir -p -QMAKE_CFLAGS += --preinclude rvct2_2.h --diag_suppress 186,654,1300 --thumb --fpu softvfp --cpu 5T --enum_is_int -Ono_known_library --fpmode ieee_no_fenv --export_all_vtbl --no_vfe --apcs /inter --dllimport_runtime --gnu +QMAKE_CFLAGS += --dllimport_runtime --preinclude rvct2_2.h --diag_suppress 186,654,1300 --thumb --fpu softvfp --cpu 5T --enum_is_int -Ono_known_library --fpmode ieee_no_fenv --export_all_vtbl --no_vfe --apcs /inter --visibility_inlines_hidden QMAKE_CXXFLAGS += $$QMAKE_CFLAGS --no_parse_templates -QMAKE_LFLAGS += --diag_suppress 6331,6780 --shl --reloc --split --rw-base 0x400000 --noscanlib +QMAKE_LFLAGS += --diag_suppress 6331,6780 --bpabi --reloc --datacompressor=off --split --rw-base 0x400000 --dll --no_scanlib QMAKE_LFLAGS_APP += --entry _E32Startup QMAKE_LFLAGS_SHLIB += --entry _E32Dll diff --git a/qmake/generators/unix/unixmake.cpp b/qmake/generators/unix/unixmake.cpp index 62eee19..7c8e173 100644 --- a/qmake/generators/unix/unixmake.cpp +++ b/qmake/generators/unix/unixmake.cpp @@ -456,11 +456,7 @@ UnixMakefileGenerator::findLibraries() libdirs.append(f); } else if(opt.startsWith("-l")) { if (!project->isEmpty("QMAKE_SYMBIAN_SHLIB")) { - if (opt.indexOf(".lib") == -1) { - (*it) = opt.mid(2) + ".lib"; - } else { - (*it) = opt.mid(2); - } + (*it) = opt.mid(2); } else if (project->isActiveConfig("rvct_linker")) { (*it) = "lib" + opt.mid(2) + ".so"; } else { -- cgit v0.12