summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraxis <qt-info@nokia.com>2010-10-27 12:48:25 (GMT)
committeraxis <qt-info@nokia.com>2011-02-21 15:18:41 (GMT)
commit92afb21fb194a1bfa2d0529307d329b6ca941281 (patch)
tree38fb35aa13e6c9aae79ef02fced9b9286c7920e9
parentd2f833db2323a1ca13b4f293b169a8401cd30ace (diff)
downloadQt-92afb21fb194a1bfa2d0529307d329b6ca941281.zip
Qt-92afb21fb194a1bfa2d0529307d329b6ca941281.tar.gz
Qt-92afb21fb194a1bfa2d0529307d329b6ca941281.tar.bz2
Fixed a bug in the elf2e32_qtwrapper script.
It did not handle missing symbols in all cases, most notably when elf2e32 decides to omit it from the produced def file. This required us to start reading the original def file as well, to find out what the original symbols was. Task: QTBUG-11839 RevBy: Thomas Zander
-rwxr-xr-x[-rw-r--r--]bin/elf2e32_qtwrapper.pl104
1 files changed, 90 insertions, 14 deletions
diff --git a/bin/elf2e32_qtwrapper.pl b/bin/elf2e32_qtwrapper.pl
index 694d54a..c51c409 100644..100755
--- a/bin/elf2e32_qtwrapper.pl
+++ b/bin/elf2e32_qtwrapper.pl
@@ -75,26 +75,102 @@ while (1) {
last;
}
- if ($buildingLibrary) {
+ if ($buildingLibrary && $runCount == 1) {
my $tmpDefFile;
- my $defFile;
- open($defFile, "< $defoutput[1]") or die("Could not open $defoutput[1]");
+ my $newDefFile;
+ my $origDefFile;
+ my $savedNewDefFileLine = "";
+ open($origDefFile, "< $definput[1]") or die("Could not open $definput[1]");
+ open($newDefFile, "< $defoutput[1]") or die("Could not open $defoutput[1]");
open($tmpDefFile, "> $defoutput[1].tmp") or die("Could not open $defoutput[1].tmp");
+ print($tmpDefFile "EXPORTS\n");
$fixupFile = "$defoutput[1].tmp";
- while (<$defFile>) {
- s/\r//;
- s/\n//;
- next if (/; NEW:/);
- if (/([a-z0-9_]+) @/i) {
- if (exists($fixupSymbols{$1})) {
- s/ ABSENT//;
- } elsif (s/; MISSING://) {
- s/$/ ABSENT/;
+ while (1) {
+ my $origDefLine;
+ my $origSym;
+ my $origOrdinal;
+ my $origExtraData;
+ my $newDefLine;
+ my $newSym;
+ my $newOrdinal;
+ my $newExtraData;
+ my $defLine;
+ my $sym;
+ my $ordinal;
+ my $extraData;
+ # Read from original def file, and skip non-symbol lines
+ while (1) {
+ $origDefLine = <$origDefFile>;
+ if (defined($origDefLine)) {
+ $origDefLine =~ s/[\n\r]//;
+ if ($origDefLine =~ /([a-z0-9_]+) +\@ ([0-9]+) (.*)/i) {
+ $origSym = $1;
+ $origOrdinal = $2;
+ $origExtraData = $3;
+ last;
+ }
+ } else {
+ last;
}
}
- print($tmpDefFile "$_\n");
+
+ if ($savedNewDefFileLine) {
+ # This happens if the new def file was missing an entry.
+ $newDefLine = $savedNewDefFileLine;
+ $newDefLine =~ /([a-z0-9_]+) +\@ ([0-9]+) (.*)/i or die("$0: Shouldn't happen");
+ $newSym = $1;
+ $newOrdinal = $2;
+ $newExtraData = $3;
+ } else {
+ # Read from new def file, and skip non-symbol lines
+ while (1) {
+ $newDefLine = <$newDefFile>;
+ if (defined($newDefLine)) {
+ $newDefLine =~ s/[\n\r]//;
+ if ($newDefLine =~ /([a-z0-9_]+) +\@ ([0-9]+) (.*)/i) {
+ $newSym = $1;
+ $newOrdinal = $2;
+ $newExtraData = $3;
+ last;
+ }
+ } else {
+ last;
+ }
+ }
+ }
+ $savedNewDefFileLine = "";
+ last if (!defined($origDefLine) && !defined($newDefLine));
+
+ if (defined($origOrdinal) && (!defined($newOrdinal) || $origOrdinal != $newOrdinal)) {
+ # If the symbol is missing from the new def file, use the original symbol.
+ $savedNewDefFileLine = $newDefLine;
+ $defLine = $origDefLine;
+ $sym = $origSym;
+ $ordinal = $origOrdinal;
+ $extraData = $origExtraData;
+ } else {
+ $defLine = $newDefLine;
+ $sym = $newSym;
+ $ordinal = $newOrdinal;
+ if ($newExtraData =~ /ABSENT/) {
+ # Special case to keep "DATA [0-9]+" data in absent entries.
+ $extraData = $origExtraData;
+ } else {
+ $extraData = $newExtraData;
+ }
+ }
+ if (exists($fixupSymbols{$sym})) {
+ # Fix symbols that have returned after first being marked ABSENT.
+ $extraData =~ s/ ABSENT//;
+ } elsif ($defLine =~ s/; MISSING://) {
+ # Auto-absent symbols.
+ $extraData .= " ABSENT";
+ }
+ print($tmpDefFile "\t$sym \@ $ordinal $extraData\n");
}
- close($defFile);
+ print($tmpDefFile "\n");
+ close($origDefFile);
+ close($newDefFile);
close($tmpDefFile);
$definput[1] = "$defoutput[1].tmp";