diff options
author | axis <qt-info@nokia.com> | 2010-06-24 12:07:49 (GMT) |
---|---|---|
committer | axis <qt-info@nokia.com> | 2010-06-24 12:38:53 (GMT) |
commit | 5b5ae51b22b57897dd61b9f8910e510757fa59c5 (patch) | |
tree | 5e9a4c8255060e26be926271777c636e36dec3a0 /mkspecs/features/symbian | |
parent | b53909cb5f7436c4ad10aecf37767ffd52fa9e92 (diff) | |
download | Qt-5b5ae51b22b57897dd61b9f8910e510757fa59c5.zip Qt-5b5ae51b22b57897dd61b9f8910e510757fa59c5.tar.gz Qt-5b5ae51b22b57897dd61b9f8910e510757fa59c5.tar.bz2 |
Fixed several problems with the postlinker for Symbian (elf2e32).
The fixes were too complicated for a profile and so a perl script was
introduced. These are the issues that were addressed:
- Made sure that we link correctly in all cases where there is a
mismatch between the DEF file and the ELF file. Specifically, these
two cases:
- If elf2e32 detects a symbols in the ELF file that is marked as
absent in the DEF file, an ordinal mapping will not be
generated in the dso file. This means that binaries linking to
the library will not find the symbol, even though it exists in
the code. Since this is completely useless behavior, this was
fixed to include the symbol regardless.
- If the DEF file contains a symbol that is not present in the
ELF file, an ordinal mapping will be created in the dso file
regardless, which means applications can link to a symbol that
does not exist. This is even worse than point one, since it is
not detected until runtime, when the dynamic link will fail.
Fixed by leaving the symbol out of the dso file if it does not
exist in the ELF file.
Both fixes require rerunning elf2e32 to fix the symbol mappings
that were broken in the first run, but it only happens if at least
one symbol is broken in the way described above. Also, freezing the
DEF files will "save" the symbols, so that it does not occur after
that.
Note that this does not remove the ability to get the postlinker to
tell you about mismatches. By doing
"QMAKE_ELF2E32_FLAGS -= --unfrozen", the symbol mismatches will be
considered errors instead of warnings, and they can be caught that
way.
- Code that was previously in the profile was moved to the perl
script:
- Detecting that there are errors in the postlink and return
nonzero. elf2e32 does not do this on its own (at least not when
using Wine).
- Only overwriting the old dso file if the new one is different.
This saves build time, since binaries that depend on the
library do not trigger relink if the dso has not changed.
These two points simplify the code, and they will also help the
porting to Windows, since the old shell script tricks would not
have worked there.
RevBy: Trust me
Diffstat (limited to 'mkspecs/features/symbian')
-rw-r--r-- | mkspecs/features/symbian/def_files.prf | 4 | ||||
-rw-r--r-- | mkspecs/features/symbian/symbian_building.prf | 13 |
2 files changed, 6 insertions, 11 deletions
diff --git a/mkspecs/features/symbian/def_files.prf b/mkspecs/features/symbian/def_files.prf index 1b8e551..bae9d2d 100644 --- a/mkspecs/features/symbian/def_files.prf +++ b/mkspecs/features/symbian/def_files.prf @@ -56,7 +56,7 @@ symbian-abld|symbian-sbsv2 { } else { elf2e32FileToAdd = $$_PRO_FILE_PWD_/$$defFile } - QMAKE_ELF2E32_FLAGS += "`test -e $$elf2e32FileToAdd && echo --definput=$$elf2e32FileToAdd`" + QMAKE_ELF2E32_FLAGS += "--definput=$$elf2e32FileToAdd" symbianObjdir = $$OBJECTS_DIR isEmpty(symbianObjdir):symbianObjdir = . @@ -64,7 +64,7 @@ symbian-abld|symbian-sbsv2 { freeze_target.target = freeze freeze_target.depends = first # The perl part is to convert to unix line endings and remove comments, which the s60 tools refuse to do. - freeze_target.commands = perl -n -e \'next if (/; NEW/); s/\\r//g; if (/MISSING:(.*)/x) { print(\"\$\$1 ABSENT\\n\"); } else { print; }\' < $$symbianObjdir/$${TARGET}.def > $$elf2e32FileToAdd + freeze_target.commands = $$QMAKE_COPY $$symbianObjdir/$${TARGET}.def $$elf2e32FileToAdd QMAKE_EXTRA_TARGETS += freeze_target } else:contains(TEMPLATE, subdirs) { freeze_target.target = freeze diff --git a/mkspecs/features/symbian/symbian_building.prf b/mkspecs/features/symbian/symbian_building.prf index 5861bb6..bdab8d5 100644 --- a/mkspecs/features/symbian/symbian_building.prf +++ b/mkspecs/features/symbian/symbian_building.prf @@ -106,7 +106,7 @@ contains(TEMPLATE, lib):!contains(CONFIG, static):!contains(CONFIG, staticlib) { # The comparison of dso files is to avoid extra building of modules that depend on this dso, in # case it has not changed. QMAKE_POST_LINK = $$QMAKE_MOVE $$symbianDestdir/$${TARGET}.dll $$symbianDestdir/$${TARGET}.sym \ - && elf2e32 --version=$$decVersion \ + && elf2e32_qtwrapper --version=$$decVersion \ --sid=$$TARGET.SID \ --uid1=0x10000079 \ --uid2=$$TARGET.UID2 \ @@ -114,7 +114,8 @@ contains(TEMPLATE, lib):!contains(CONFIG, static):!contains(CONFIG, staticlib) { --targettype=DLL \ --elfinput=$${symbianDestdir}/$${TARGET}.sym \ --output=$${symbianDestdir}/$${TARGET}.dll \ - --dso=$$symbianObjdir/$${TARGET}.dso \ + --tmpdso=$${symbianObjdir}/$${TARGET}.dso \ + --dso=$${symbianDestdir}/$${TARGET}.dso \ --defoutput=$$symbianObjdir/$${TARGET}.def \ --linkas=$${TARGET}\\{$${hexVersion}\\}\\[$${intUid3}\\].dll \ --heap=$$join(TARGET.EPOCHEAPSIZE, ",") \ @@ -122,11 +123,6 @@ contains(TEMPLATE, lib):!contains(CONFIG, static):!contains(CONFIG, staticlib) { $$elf2e32_LIBPATH \ $$capability \ $$QMAKE_ELF2E32_FLAGS \ - | tee elf2e32.log && test `grep -c 'Error:' elf2e32.log` = 0 && rm elf2e32.log \ - && if ! diff -q $${symbianObjdir}/$${TARGET}.dso $${symbianDestdir}/$${TARGET}.dso \ - > /dev/null 2>&1; then \ - $$QMAKE_COPY $${symbianObjdir}/$${TARGET}.dso $${symbianDestdir}/$${TARGET}.dso; \ - fi \ $$QMAKE_POST_LINK QMAKE_DISTCLEAN += $${symbianDestdir}/$${TARGET}.sym QMAKE_DISTCLEAN += $${symbianDestdir}/$${TARGET}.dso @@ -159,7 +155,7 @@ contains(TEMPLATE, app):!contains(QMAKE_LINK, "^@.*") { } # the tee and grep at the end work around the issue that elf2e32 doesn't return non-null on error QMAKE_POST_LINK = $$QMAKE_MOVE $$symbianDestdir/$${TARGET} $$symbianDestdir/$${TARGET}.sym \ - && elf2e32 --version $$decVersion \ + && elf2e32_qtwrapper --version $$decVersion \ --sid=$$TARGET.SID \ --uid1=0x1000007a \ --uid2=$$TARGET.UID2 \ @@ -173,7 +169,6 @@ contains(TEMPLATE, app):!contains(QMAKE_LINK, "^@.*") { $$elf2e32_LIBPATH \ $$capability \ $$QMAKE_ELF2E32_FLAGS \ - | tee elf2e32.log && test `grep -c 'Error:' elf2e32.log` = 0 && rm elf2e32.log \ && ln "$${symbianDestdir}/$${TARGET}.exe" "$${symbianDestdir}/$$TARGET" \ $$QMAKE_POST_LINK QMAKE_DISTCLEAN += $${symbianDestdir}/$${TARGET}.sym |