Applied vxWorks 6.x patches, cleanup.

This commit is contained in:
Andrew Johnson
2010-07-29 15:02:34 -05:00
13 changed files with 135 additions and 44 deletions

View File

@@ -292,7 +292,7 @@ ARCMD = $(AR) $(ARFLAGS) $(USR_ARFLAGS) $@ $(LIBRARY_LD_OBJS)
#--------------------------------------------------
# 'Munch' link-edit
MUNCH_CMD = $(LD) -o $@ $^
MUNCH_CMD = $(LD) $(MUNCH_LDFLAGS) -o $@ $^
#--------------------------------------------------
# LEX default options

View File

@@ -302,7 +302,7 @@ $(LOADABLE_SHRLIBNAME):$(LOADABLE_SHRLIB_PREFIX)%$(LOADABLE_SHRLIB_SUFFIX):
%_ctdt.c : %.nm
@$(RM) $@
$(PERL) $(TOOLS)/munch.pl < $< > $@
$(PERL) $(TOOLS)/munch.pl -o $@ $<
$(MUNCHNAME):%$(MUNCH_SUFFIX) : $(MUNCH_DEPENDS) %$(EXE)
@$(RM) $@

View File

@@ -92,6 +92,7 @@ VX_GNU_VERSION_6.4 = 3.4.4
VX_GNU_VERSION_6.5 = 3.4.4
VX_GNU_VERSION_6.6 = 4.1.2
VX_GNU_VERSION_6.7 = 4.1.2
VX_GNU_VERSION_6.8 = 4.1.2
VX_GNU_VERSION = $(VX_GNU_VERSION_$(VXWORKS_VERSION))
VX_GNU_MAJOR_VERSION = $(basename $(basename $(VX_GNU_VERSION)))
@@ -123,17 +124,28 @@ GNU_DIR_6 = $(WIND_BASE)/gnu/$(VX_GNU_VERSION)-vxworks-$(VXWORKS_VERSION)/$(WIND
GNU_DIR = $(GNU_DIR_$(VXWORKS_MAJOR_VERSION))
#--------------------------------------------------
# Wind River moved nm out of GNU_DIR in some versions
# Wind River moved nm out of GNU_BIN in some versions
WORKBENCH_BIN = $(WIND_BASE)/workbench-$(WORKBENCH_VERSION)/$(WIND_HOST_TYPE)/bin
UTILITIES_BIN = $(WIND_BASE)/utilities-$(UTILITIES_VERSION)/$(WIND_HOST_TYPE)/bin
NM_DIR_6.4 = $(WORKBENCH_BIN)
NM_DIR_6.5 = $(WORKBENCH_BIN)
NM_DIR_6.6 = $(WORKBENCH_BIN)
NM_DIR_6.7 = $(GNU_BIN)
NM_DIR_6.8 = $(UTILITIES_BIN)
NM_DIR = $(firstword $(NM_DIR_$(VXWORKS_VERSION)) $(GNU_BIN))
NM = $(NM_DIR)/$(CMPLR_PREFIX)nm$(CMPLR_SUFFIX)$(HOSTEXE)
#--------------------------------------------------
# A linker script is essential for munching from vxWorks 6.6 onwards
# (i.e. with versions that use gcc 4.1.2 or later). It can be used
# with any vxWorks 5 or 6 version, but apparently should not be used
# when compiling for 68K (which isn't supported in vxWorks 6 anyway)
MUNCH_LDFLAGS_6 = -T $(VX_DIR)/target/h/tool/gnu/ldscripts/link.OUT
MUNCH_LDFLAGS = $(MUNCH_LDFLAGS_$(VXWORKS_MAJOR_VERSION))
#--------------------------------------------------
# The follow 2 exports prevent gnu cross-compiler
# from finding wrong assembler (as).
@@ -147,12 +159,10 @@ export TOOL_FAMILY = GNU
#--------------------------------------------------
# Operating system flags
BSD_DEFINE_VERSION_6.7 = -DBSD=44
OP_BSD_DEFINE = $(BSD_DEFINE_VERSION_$(VXWORKS_VERSION))
OP_SYS_CPPFLAGS += -DvxWorks $(OP_BSD_DEFINE)
OP_SYS_CFLAGS += -fno-builtin $(OP_BSD_DEFINE)
OP_SYS_CPPFLAGS += -DvxWorks
OP_SYS_CFLAGS += -fno-builtin
# Fix for vxWorks headers that use macros defined in vxWorks.h but
# Fix for vxWorks 5 headers that use macros defined in vxWorks.h but
# which don't actually include vxWorks.h themselves, for example the
# target/h/sys/stat.h file which uses ULONG
OP_SYS_INCLUDE_CPPFLAGS_5 += -include $(VX_DIR)/target/h/vxWorks.h

View File

@@ -18,6 +18,8 @@ VXWORKS_VERSION = 5.5
#VXWORKS_VERSION = 6.4
#VXWORKS_VERSION = 6.5
#VXWORKS_VERSION = 6.6
#VXWORKS_VERSION = 6.7
#VXWORKS_VERSION = 6.8
# Sites may override the following path for a particular host
@@ -37,3 +39,9 @@ WIND_BASE = /usr/local/vw/tornado22-$(ARCH_CLASS)
#WORKBENCH_VERSION = 2.6
#WORKBENCH_VERSION = 3.0
#WORKBENCH_VERSION = 3.2
# Utilities Version number, required from vxWorks 6.8 and later
#UTILITIES_VERSION = 1.0

View File

@@ -15,6 +15,8 @@
#error this is a vxWorks specific source code
#endif
/* This is needed for vxWorks 6.8 to prevent an obnoxious compiler warning */
#define _VSB_CONFIG_FILE <../lib/h/config/vsbConfig.h>
#include <hostLib.h>
#include <inetLib.h>

View File

@@ -26,6 +26,8 @@ extern "C" {
#include <sockLib.h>
#include <ioLib.h>
#include <sys/ioctl.h>
/* This is needed for vxWorks 6.8 to prevent an obnoxious compiler warning */
#define _VSB_CONFIG_FILE <../lib/h/config/vsbConfig.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <arpa/inet.h>
@@ -89,7 +91,9 @@ typedef int osiSocklen_t;
# define INADDR_NONE (0xffffffff)
#endif
#if ( defined (BSD) && ( BSD >= 44 ) )
#if defined(_SIZEOF_ADDR_IFREQ)
# define ifreq_size(pifreq) _SIZEOF_ADDR_IFREQ(*pifreq)
#elif ( defined (BSD) && ( BSD >= 44 ) )
# define ifreq_size(pifreq) (pifreq->ifr_addr.sa_len + sizeof(pifreq->ifr_name))
#else
# define ifreq_size(pifreq) sizeof(*pifreq)

0
src/tools/convertRelease.pl Executable file → Normal file
View File

0
src/tools/cvsclean.pl Executable file → Normal file
View File

0
src/tools/filterWarnings.pl Executable file → Normal file
View File

0
src/tools/fullPathName.pl Executable file → Normal file
View File

0
src/tools/mkmf.pl Executable file → Normal file
View File

137
src/tools/munch.pl Executable file → Normal file
View File

@@ -1,7 +1,6 @@
eval 'exec perl -S $0 ${1+"$@"}' # -*- Mode: perl -*-
if $running_under_some_shell;
#!/usr/bin/perl
#*************************************************************************
# Copyright (c) 2006 UChicago Argonne LLC, as Operator of Argonne
# Copyright (c) 2010 UChicago Argonne LLC, as Operator of Argonne
# National Laboratory.
# Copyright (c) 2002 The Regents of the University of California, as
# Operator of Los Alamos National Laboratory.
@@ -13,41 +12,104 @@ eval 'exec perl -S $0 ${1+"$@"}' # -*- Mode: perl -*-
# Creates a ctdt.c file of C++ static constructors and destructors,
# as required for all vxWorks binaries containing C++ code.
@ctors = (); %ctors = ();
@dtors = (); %dtors = ();
use strict;
use warnings;
use Getopt::Std;
while (my $line = <STDIN>)
our ($opt_o);
$Getopt::Std::OUTPUT_HELP_VERSION = 1;
&HELP_MESSAGE if !getopts('o:') || @ARGV != 1;
# Is exception handler frame info required?
my $need_eh_frame = 0;
# Constructor and destructor names:
# Array contains names from input file.
# Hash is used to skip duplicate names.
my (@ctors, %ctors);
my (@dtors, %dtors);
while (<>)
{
chomp $line;
next if ($line =~ m/__?GLOBAL_.F.+/);
next if ($line =~ m/__?GLOBAL_.I._GLOBAL_.D.+/);
if ($line =~ m/__?GLOBAL_.D.+/) {
($adr,$type,$name) = split ' ', $line, 3;
push @dtors, $name unless exists $dtors{$name};
$dtors{$name} = 1;
chomp;
$need_eh_frame++ if m/__? gxx_personality_v [0-9]/x;
next if m/__? GLOBAL_. (F | I._GLOBAL_.D) .+/x;
if (m/__? GLOBAL_ . D .+/x) {
my ($addr, $type, $name) = split ' ', $_, 3;
push @dtors, $name unless exists $dtors{$name};
$dtors{$name} = 1;
}
if ($line =~ m/__?GLOBAL_.I.+/) {
($adr,$type,$name) = split ' ', $line, 3;
push @ctors, $name unless exists $ctors{$name};
$ctors{$name} = 1;
if (m/__? GLOBAL_ . I .+/x) {
my ($addr, $type, $name) = split ' ', $_, 3;
push @ctors, $name unless exists $ctors{$name};
$ctors{$name} = 1;
}
}
print join "\n",
"/* C++ static constructor and destructor lists */",
"/* This is a generated file, do not edit! */",
"#include <vxWorks.h>",
"\n/* Declarations */",
(map cDecl($_), @ctors, @dtors),
"\n/* Constructors */",
"void (*_ctors[])() = {",
(join ",\n", (map " " . cName($_), @ctors), " NULL"),
"};",
"\n/* Destructors */",
"void (*_dtors[])() = {",
(join ",\n", (map " " . cName($_), reverse @dtors), " NULL"),
"};",
"\n";
push my @out,
'/* C++ static constructor and destructor lists */',
'/* This is generated by munch.pl, do not edit! */',
'',
'#include <vxWorks.h>',
'',
'/* Declarations */',
(map {cDecl($_)} @ctors, @dtors),
'';
exceptionHandlerFrame() if $need_eh_frame;
push @out,
'/* List of Constructors */',
'void (*_ctors[])(void) = {',
(join ",\n", (map {' ' . cName($_)} @ctors), ' NULL'),
'};',
'',
'/* List of Destructors */',
'void (*_dtors[])(void) = {',
(join ",\n", (map {' ' . cName($_)} @dtors), ' NULL'),
'};',
'';
if ($opt_o) {
open(my $OUT, '>', $opt_o)
or die "Can't create $opt_o: $!\n";
print $OUT join "\n", @out;
close $OUT
or die "Can't close $opt_o: $!\n";
} else {
print join "\n", @out;
}
# Outputs the C code for registering exception handler frame info
sub exceptionHandlerFrame {
my $eh_ctor = 'eh_ctor';
my $eh_dtor = 'eh_dtor';
# Add EH ctor/dtor to _start_ of arrays
unshift @ctors, $eh_ctor;
unshift @dtors, $eh_dtor;
push @out,
'/* Exception handler frame */',
'extern const unsigned __EH_FRAME_BEGIN__[];',
'',
"static void $eh_ctor(void) {",
' extern void __register_frame_info (const void *, void *);',
' static struct { unsigned pad[8]; } object;',
'',
' __register_frame_info(__EH_FRAME_BEGIN__, &object);',
'}',
'',
"static void $eh_dtor(void) {",
' extern void *__deregister_frame_info (const void *);',
'',
' __deregister_frame_info(__EH_FRAME_BEGIN__);',
'}',
'';
return;
}
sub cName {
my ($name) = @_;
@@ -58,13 +120,18 @@ sub cName {
sub cDecl {
my ($name) = @_;
my $decl = 'void ' . cName($name) . '()';
my $decl = 'extern void ' . cName($name) . '(void)';
# 68k and MIPS targets allow periods in symbol names, which
# can only be reached using an assembler string.
if (m/\./) {
$decl .= "\n __asm__ (\"" . $name . "\");";
$decl .= "\n __asm__ (\"" . $name . "\");";
} else {
$decl .= ';';
$decl .= ';';
}
return $decl;
}
sub HELP_MESSAGE {
print STDERR "Usage: munch.pl [-o file_ctdt.c] file.nm\n";
exit 2;
}

0
src/tools/replaceVAR.pl Executable file → Normal file
View File