Commit 803970f8 authored by BenceJanosSzabo's avatar BenceJanosSzabo
Browse files

titanver script works with clang (Bug 515229)



Change-Id: I7c1a7919ca50b1ea8c345be26aa76153464acd6c
Signed-off-by: default avatarBenceJanosSzabo <bence.janos.szabo@ericsson.com>
parent 2f0c4642
......@@ -92,11 +92,11 @@
#ifdef __clang__
#define CLANG_VERSION (__clang_major__ * 10000 + __clang_minor__ * 100)
#define COMPILER_VERSION_STRING " Clang: (GNU) " STR(__clang_major__) "." STR(__clang_minor__) "." STR(__clang_patchlevel__)
#else
#define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100)
#define COMPILER_VERSION_STRING " GCC: (GNU) " STR(__GNUC__) "." STR(__GNUC_MINOR__) GCC_PATCHLEVEL_STRING
#endif
/* Ignore __GNUC_PATCHLEVEL__ */
#define COMPILER_VERSION_STRING " GCC: (GNU) " STR(__GNUC__) "." STR(__GNUC_MINOR__) GCC_PATCHLEVEL_STRING
static const char titan_[] __attribute__ ((section (".titan"))) = \
......
......@@ -14,7 +14,11 @@ if [ -z "${perlexe}" ] ; then
GCCVER=`strings -a -10 ${1+"$@"} | sed -n '
s/.*TITAN: [0-9][0-9]* PLATFORM: [A-Z0-9][A-Z0-9]* //
/GCC/ {
/GCC: (GNU)/ {
p
}
s/.*TITAN: [0-9][0-9]* PLATFORM: [A-Z0-9][A-Z0-9]* //
/Clang: (GNU)/ {
p
}
/Sun C++/ {
......@@ -43,7 +47,7 @@ if 0;
use strict;
use vars qw($r $v);
my $compiler = 'GCC';
my $compiler = 'Compiler';
my %versions;
......@@ -62,28 +66,30 @@ open (PIPE, $cmdline = "$objdump -s -j " . join(' -j ', @sections) . " @ARGV |")
my $obj = '?';
while (<PIPE>)
{
chomp;
next unless length;
if (/^([^:]+):\s+file format/) {
sub match_comment() {
if (length($comment)) {
($found_ver) = $comment =~ /GCC: \([^)]*\) (\d\.\d+(?:\.\d+)?)/;
$found_ver ||= 'unknown!';
($found_ver) = $comment =~ /((GCC|Clang): \([^)]*\) \d\.\d+(?:\.\d+)?)/;
if ($found_ver) {
print "$compiler version was $found_ver for $obj\n" if $v;
print "$compiler version was $found_ver for $obj\n" if $v;
push @{$versions{$found_ver}}, $obj;
push @{$versions{$found_ver}}, $obj;
if (defined $r and $r ne $found_ver)
{
if (defined $r and $r ne $found_ver) {
if (!$v) { # found version was not written, do it now
warn "$compiler was $found_ver for $obj\n";
}
die " $r was expected\n";
die " $r was expected\n";
}
}
}
}
while (<PIPE>)
{
chomp;
next unless length;
if (/^([^:]+):\s+file format/) {
match_comment();
$obj = $1;
$comment = '';
}
......@@ -101,11 +107,12 @@ while (<PIPE>)
\s\s
(.+) # up to 16 characters of "plain" text
$/x) {
$comment .= $text;
}
}
match_comment();
close (PIPE) or die "close failed: $!";
if ( scalar keys %versions > 1 ) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment