diff options
author | Lukas Larsson <lukas@erlang-solutions.com> | 2013-08-15 17:04:52 +0200 |
---|---|---|
committer | Lukas Larsson <lukas@erlang-solutions.com> | 2013-08-21 15:20:04 +0200 |
commit | 94d174949635cd4e641daaac0a7df98ea35f2c55 (patch) | |
tree | 1c7f6848a3ac2b2d5559c97fe1b8ac2225f1b4a0 /erts/emulator/utils | |
parent | 20e0509d4e04fada3019639bc82d78b89f06b0fc (diff) | |
download | otp-94d174949635cd4e641daaac0a7df98ea35f2c55.tar.gz otp-94d174949635cd4e641daaac0a7df98ea35f2c55.tar.bz2 otp-94d174949635cd4e641daaac0a7df98ea35f2c55.zip |
erts: Add support for static linked-in drivers
None of the OTP linked-in driver are supported
Diffstat (limited to 'erts/emulator/utils')
-rwxr-xr-x | erts/emulator/utils/make_driver_tab | 42 |
1 files changed, 37 insertions, 5 deletions
diff --git a/erts/emulator/utils/make_driver_tab b/erts/emulator/utils/make_driver_tab index 06928a3a4a..3eedef21a7 100755 --- a/erts/emulator/utils/make_driver_tab +++ b/erts/emulator/utils/make_driver_tab @@ -28,8 +28,10 @@ use File::Basename; my $file = ""; my $nif = ""; -my @drivers = (); +my @emu_drivers = (); +my @static_drivers = (); my @nifs = (); +my $mode = 1; while (@ARGV) { my $d = shift; @@ -37,15 +39,28 @@ while (@ARGV) { $file = shift or die("-o requires argument"); next; } + if ( $d =~ /^-nifs$/ ) { + $mode = 2; + next; + } + if ( $d =~ /^-drivers$/ ) { + $mode = 1; + next; + } if ( $d =~ /^.*\.a$/ ) { $d = basename $d; $d =~ s/\.a$//; # strip .a - push(@nifs, $d); + if ($mode == 1) { + push(@static_drivers, $d); + } + if ($mode == 2) { + push(@nifs, $d); + } next; } $d = basename $d; $d =~ s/drv(\..*|)$//; # strip drv.* or just drv - push(@drivers, $d); + push(@emu_drivers, $d); } # Did we want output to a file? @@ -64,19 +79,36 @@ print <<EOF; EOF # "extern" declarations -foreach (@drivers) { +foreach (@emu_drivers) { print "extern ErlDrvEntry ${_}driver_entry;\n"; } +foreach (@static_drivers) { + print "ErlDrvEntry *${_}_driver_init(void);\n"; +} + # The array itself print "\nErlDrvEntry *driver_tab[DRIVER_TAB_SIZE] =\n{\n"; -foreach (@drivers) { +foreach (@emu_drivers) { print " &${_}driver_entry,\n"; } +foreach (@static_drivers) { + print " NULL, /* ${_} */\n"; +} print " NULL\n};\n"; +print "void erts_init_static_drivers() {\n"; + +my $index = 0; +foreach (@static_drivers) { + print " driver_tab[".(scalar @emu_drivers+$index)."] = ${_}_driver_init();\n"; + $index++; +} + +print "}\n"; + print <<EOF; typedef struct ErtsStaticNifEntry_ { |