diff options
author | Sami Lempinen <sami.lempinen@nokia.com> | 2011-04-28 08:10:57 (GMT) |
---|---|---|
committer | Sami Lempinen <sami.lempinen@nokia.com> | 2011-04-28 08:10:57 (GMT) |
commit | 95de3f34d9dba4cd95f1f3d32b35c4a4d97e70d9 (patch) | |
tree | 7be35a9028b5c83b792190fb954127e9f558baf5 /bin | |
parent | 9d6530b9774de482b0b3a29720f7f756e986f5c7 (diff) | |
parent | 8e615d9b07f6146b5cb6b56c4cd2e32376a8b429 (diff) | |
download | Qt-95de3f34d9dba4cd95f1f3d32b35c4a4d97e70d9.zip Qt-95de3f34d9dba4cd95f1f3d32b35c4a4d97e70d9.tar.gz Qt-95de3f34d9dba4cd95f1f3d32b35c4a4d97e70d9.tar.bz2 |
Merge remote-tracking branch 'qt/4.8'
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/elf2e32_qtwrapper.pl | 82 | ||||
-rwxr-xr-x | bin/syncqt | 4 |
2 files changed, 74 insertions, 12 deletions
diff --git a/bin/elf2e32_qtwrapper.pl b/bin/elf2e32_qtwrapper.pl index 02f4f0d..24b910b 100755 --- a/bin/elf2e32_qtwrapper.pl +++ b/bin/elf2e32_qtwrapper.pl @@ -81,8 +81,59 @@ my $fixupFile = ""; my $runCount = 0; my $returnCode = 0; +# For debugging. Make it nonzero to give verbose output. +my $debugScript = 1; +my @usedDefFiles; +sub recordDefFile { + return if (!$debugScript); + + my ($msg, $file) = @_; + my $content = "$msg, $file:\n"; + my $defFileFd; + if (!open($defFileFd, "< $file")) { + print("Warning: Could not open $file (for debug analysis)\n"); + return; + } + while (<$defFileFd>) { + $content .= $_; + } + + push(@usedDefFiles, $content); +} +sub printRecordedDefFiles { + return if (!$debugScript); + + foreach (@usedDefFiles) { + print ("$_\n"); + } +} + +sub missingSymbolMismatch +{ + my $missingSymbolSum = $_[0]; + + printRecordedDefFiles; + + print("Bug in the native elf2e32 tool: Number of missing symbols does not\n"); + print("match number of removed symbols in the output DEF file.\n\n"); + + print("Original elf2e32 output:\n"); + print(" $missingSymbolSum Frozen Export\(s\) missing from the ELF file\n\n"); + + print("However $defoutput[1] contains more missing entries than that.\n\n"); + + print("This needs to be fixed manually in the DEF file.\n"); + exit(2); +} + +if ($debugScript) { + print("PATH: $ENV{PATH}\n"); + print("EPOCROOT: $ENV{EPOCROOT}\n"); +} + while (1) { if (++$runCount > 2) { + printRecordedDefFiles if ($debugScript); print("Internal error in $0, link succeeded, but exports may be wrong.\n"); last; } @@ -96,6 +147,8 @@ while (1) { my %fixupSymbols; my $foundBrokenSymbols = 0; + my $missingSymbolSum = 0; + my $missingSymbolCount = 0; my $errors = 0; while (<$elf2e32Pipe>) { print; @@ -104,12 +157,18 @@ while (1) { } elsif (/symbol ([a-z0-9_]+) absent in the DEF file, but present in the ELF file/io) { $fixupSymbols{$1} = 1; $foundBrokenSymbols = 1; - } elsif (/[0-9]+ Frozen Export\(s\) missing from the ELF file/io) { + } elsif (/([0-9]+) Frozen Export\(s\) missing from the ELF file/io) { + $missingSymbolSum = $1; $foundBrokenSymbols = 1; } } close($elf2e32Pipe); + if ($debugScript) { + recordDefFile("Run no $runCount, elf2e32 DEF file input", "$definput[1]"); + recordDefFile("Run no $runCount, elf2e32 DEF file output", "$defoutput[1]"); + } + if ($errors) { $returnCode = 1; last; @@ -125,7 +184,7 @@ while (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"); + print($tmpDefFile "EXPORTS\n") or die("Could not write to temporary DEF file: $!"); $fixupFile = "$defoutput[1].tmp"; while (1) { my $origDefLine; @@ -209,24 +268,25 @@ while (1) { } elsif ($defLine =~ s/; MISSING://) { # Auto-absent symbols. $extraData .= " ABSENT"; + if (++$missingSymbolCount > $missingSymbolSum) { + missingSymbolMismatch($missingSymbolSum); + } } - print($tmpDefFile "\t$sym \@ $ordinal $extraData\n"); + print($tmpDefFile "\t$sym \@ $ordinal $extraData\n") or die("Could not write to temporary DEF file: $!"); } - print($tmpDefFile "\n"); + print($tmpDefFile "\n") or die("Could not write to temporary DEF file: $!"); close($origDefFile) if ($definput[1]); close($newDefFile); close($tmpDefFile); $definput[1] = "$defoutput[1].tmp"; - if (!$foundBrokenSymbols || $errors) { - last; - } - - print("Rerunning elf2e32 due to DEF file / ELF file mismatch\n"); - } else { + } + if (!$foundBrokenSymbols || $errors) { last; } + + print("Rerunning elf2e32 due to DEF file / ELF file mismatch\n"); }; if ($fixupFile) { @@ -260,6 +320,6 @@ if ($buildingLibrary) { } if ($differenceFound) { - copy($tmpdso[1], $dso[1]); + copy($tmpdso[1], $dso[1]) or die("Could not copy $tmpdso[1] to $dso[1]: $!"); } } @@ -335,7 +335,9 @@ sub syncHeader { open HEADER, ">$header" || die "Could not open $header for writing!\n"; print HEADER "#include \"$iheader_out\"\n"; close HEADER; - utime(time, $ts, $header) or die "$iheader, $header"; + if(defined($ts)) { + utime(time, $ts, $header) or die "$iheader, $header"; + } return 1; } return 0; |