vlib: add cgo-friendly plugin registration support
Allows us to declare plugin registrations in a non-disgusting way:
var plugin_reg = vpp.PluginRegistration{
Description: "The CGO plugin",
Version: "My Version",
Overrides: "sample_plugin.so",
}
It turns out that the specific compiler setup generates (.data section
offset, length) pairs in the .vlib_plugin_r2 section:
Contents of section .vlib_plugin_r2:
1ba9d0
00000000 00000000 50a81800 00000000 ........P.......
1ba9e0
0a000000 00000000 00000000 00000000 ................
1ba9f0
00000000 00000000 00000000 00000000 ................
1baa00
00000000 00000000 00000000 00000000 ................
1baa10
00000000 00000000 70a81800 00000000 ........p.......
1baa20
0e000000 00000000 ........
Contents of section .data:
18a800
00a81800 00000000 00000000 00000000 ................
18a810
00000000 00000000 00000000 00000000 ................
18a820
00000000 00000000 00000000 00000000 ................
18a830
00000000 00000000 00000000 00000000 ................
18a840
00000000 00000000 14000000 00000000 ................
18a850
4d792056 65727369 6f6e0000 00000000 My Version......
18a860
00000000 00000000 14000000 00000000 ................
18a870
54686520 45474f20 706c7567 696e0000 The CGO plugin..
18a880
00000000 00000000 0c000000 00000000 ................
<etc>
Unfortunately, it seems impossible to torture clang / gcc into
producing anything like this. This patch fabricates a plausible
vlib_plugin_registration_t from the so-called vlib_plugin_r2_t.
Type: improvement
Signed-off-by: Dave Barach <dave@barachs.net>
Change-Id: I8c0c5a24f3b7bfea07d5181a7250b3d9685e8446