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 @@ ...@@ -92,11 +92,11 @@
#ifdef __clang__ #ifdef __clang__
#define CLANG_VERSION (__clang_major__ * 10000 + __clang_minor__ * 100) #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 #else
#define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100) #define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100)
#define COMPILER_VERSION_STRING " GCC: (GNU) " STR(__GNUC__) "." STR(__GNUC_MINOR__) GCC_PATCHLEVEL_STRING
#endif #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"))) = \ static const char titan_[] __attribute__ ((section (".titan"))) = \
......
...@@ -14,7 +14,11 @@ if [ -z "${perlexe}" ] ; then ...@@ -14,7 +14,11 @@ if [ -z "${perlexe}" ] ; then
GCCVER=`strings -a -10 ${1+"$@"} | sed -n ' GCCVER=`strings -a -10 ${1+"$@"} | sed -n '
s/.*TITAN: [0-9][0-9]* PLATFORM: [A-Z0-9][A-Z0-9]* // 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 p
} }
/Sun C++/ { /Sun C++/ {
...@@ -43,7 +47,7 @@ if 0; ...@@ -43,7 +47,7 @@ if 0;
use strict; use strict;
use vars qw($r $v); use vars qw($r $v);
my $compiler = 'GCC'; my $compiler = 'Compiler';
my %versions; my %versions;
...@@ -62,28 +66,30 @@ open (PIPE, $cmdline = "$objdump -s -j " . join(' -j ', @sections) . " @ARGV |") ...@@ -62,28 +66,30 @@ open (PIPE, $cmdline = "$objdump -s -j " . join(' -j ', @sections) . " @ARGV |")
my $obj = '?'; my $obj = '?';
while (<PIPE>) sub match_comment() {
{
chomp;
next unless length;
if (/^([^:]+):\s+file format/) {
if (length($comment)) { if (length($comment)) {
($found_ver) = $comment =~ /GCC: \([^)]*\) (\d\.\d+(?:\.\d+)?)/; ($found_ver) = $comment =~ /((GCC|Clang): \([^)]*\) \d\.\d+(?:\.\d+)?)/;
$found_ver ||= 'unknown!'; 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 if (!$v) { # found version was not written, do it now
warn "$compiler was $found_ver for $obj\n"; 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; $obj = $1;
$comment = ''; $comment = '';
} }
...@@ -101,11 +107,12 @@ while (<PIPE>) ...@@ -101,11 +107,12 @@ while (<PIPE>)
\s\s \s\s
(.+) # up to 16 characters of "plain" text (.+) # up to 16 characters of "plain" text
$/x) { $/x) {
$comment .= $text; $comment .= $text;
} }
} }
match_comment();
close (PIPE) or die "close failed: $!"; close (PIPE) or die "close failed: $!";
if ( scalar keys %versions > 1 ) { 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