fix declaration of symbol of different size 13/513/2
authorJean-Mickael Guerin <jean-mickael.guerin@6wind.com>
Fri, 4 Mar 2016 13:14:21 +0000 (14:14 +0100)
committerGerrit Code Review <gerrit@fd.io>
Mon, 14 Mar 2016 12:40:17 +0000 (12:40 +0000)
I got many warnings at the link step with gcc version 5.3.1 20160225 (Ubuntu 5.3.1-10ubuntu2):

/usr/bin/ld: Warning: size of symbol `cop_input_node' changed from 112 in vnet/cop/.libs/cop.o to 168 in vnet/cop/.libs/node1.o
/usr/bin/ld: Warning: size of symbol `ethernet_input_node' changed from 112 in vnet/.libs/interface.o to 136 in vnet/ethernet/.libs/node.o
/usr/bin/ld: Warning: size of symbol `l2output_node' changed from 112 in vnet/l2/.libs/l2_efp_filter.o to 120 in vnet/l2/.libs/l2_output.o
/usr/bin/ld: Warning: size of symbol `srp_input_node' changed from 112 in vnet/srp/.libs/format.o to 136 in vnet/srp/.libs/node.o
/usr/bin/ld: Warning: size of symbol `vxlan_encap_node' changed from 112 in vnet/vxlan/.libs/vxlan.o to 128 in vnet/vxlan/.libs/encap.o
/usr/bin/ld: Warning: size of symbol `vxlan_input_node' changed from 112 in vnet/vxlan/.libs/vxlan.o to 144 in vnet/vxlan/.libs/decap.o
...

Looking at vlib_node_registration_t, I think the reason is that
the char * next_nodes[] could be bigger where the variable is defined
in .c file.

We should mark global variables as external in header files.

Some of them can be made static.

Change-Id: Ieb6961fd08180c9a69e1d884852703f3eb23f23f
Signed-off-by: Jean-Mickael Guerin <jean-mickael.guerin@6wind.com>
27 files changed:
vnet/vnet/classify/vnet_classify.h
vnet/vnet/cop/cop.h
vnet/vnet/devices/dpdk/dpdk.h
vnet/vnet/devices/ssvm/ssvm_eth.h
vnet/vnet/ethernet/ethernet.h
vnet/vnet/gre/gre.h
vnet/vnet/ipsec/ikev2.c
vnet/vnet/ipsec/ikev2.h
vnet/vnet/ipsec/ipsec.h
vnet/vnet/ipsec/ipsec_input.c
vnet/vnet/ipsec/ipsec_output.c
vnet/vnet/l2/l2_classify.h
vnet/vnet/l2/l2_output.c
vnet/vnet/l2/l2_output.h
vnet/vnet/l2tp/l2tp.h
vnet/vnet/lawful-intercept/lawful_intercept.h
vnet/vnet/lisp-gpe/lisp_gpe.h
vnet/vnet/map/ip4_sixrd.c
vnet/vnet/map/ip6_sixrd.c
vnet/vnet/map/map.h
vnet/vnet/map/sixrd.h
vnet/vnet/mpls-gre/mpls.h
vnet/vnet/nsh-gre/nsh_gre.h
vnet/vnet/nsh-vxlan-gpe/nsh_vxlan_gpe.h
vnet/vnet/srp/node.c
vnet/vnet/srp/srp.h
vnet/vnet/vxlan/vxlan.h

index 3e93ba3..0c93e90 100644 (file)
@@ -35,8 +35,8 @@
 #include <vppinfra/cache.h>
 #include <vppinfra/xxhash.h>
 
-vlib_node_registration_t ip4_classify_node;
-vlib_node_registration_t ip6_classify_node;
+extern vlib_node_registration_t ip4_classify_node;
+extern vlib_node_registration_t ip6_classify_node;
 
 #define CLASSIFY_TRACE 0
 
index 20238b8..eb5f1df 100644 (file)
@@ -72,7 +72,7 @@ typedef struct {
 
 cop_main_t cop_main;
 
-vlib_node_registration_t cop_input_node;
+extern vlib_node_registration_t cop_input_node;
 
 int cop_interface_enable_disable (u32 sw_if_index, int enable_disable);
 
index 77b19ba..1635c0a 100644 (file)
@@ -66,9 +66,9 @@
 #define NB_MBUF   (32<<10)
 
 vnet_device_class_t dpdk_device_class;
-vlib_node_registration_t dpdk_input_node;
-vlib_node_registration_t dpdk_io_input_node;
-vlib_node_registration_t handoff_dispatch_node;
+extern vlib_node_registration_t dpdk_input_node;
+extern vlib_node_registration_t dpdk_io_input_node;
+extern vlib_node_registration_t handoff_dispatch_node;
 
 typedef enum {
   VNET_DPDK_DEV_ETH = 1,      /* Standard DPDK PMD driver */
index 1b07722..618fb5c 100644 (file)
@@ -32,7 +32,7 @@
 #include <ssvm.h>
 
 vnet_device_class_t ssvm_eth_device_class;
-vlib_node_registration_t ssvm_eth_input_node;
+extern vlib_node_registration_t ssvm_eth_input_node;
 
 #define SSVM_BUFFER_SIZE  \
   (VLIB_BUFFER_DEFAULT_FREE_LIST_BYTES + VLIB_BUFFER_PRE_DATA_SIZE)
index 04e07b7..21257c5 100644 (file)
@@ -448,6 +448,6 @@ int vnet_add_del_ip4_arp_change_event (vnet_main_t * vnm,
                                        uword type_opaque,
                                        uword data, int is_add);
 
-vlib_node_registration_t ethernet_input_node;
+extern vlib_node_registration_t ethernet_input_node;
 
 #endif /* included_ethernet_h */
index c0689f6..490360d 100644 (file)
@@ -95,7 +95,7 @@ format_function_t format_gre_protocol;
 format_function_t format_gre_header;
 format_function_t format_gre_header_with_length;
 
-vlib_node_registration_t gre_input_node;
+extern vlib_node_registration_t gre_input_node;
 vnet_device_class_t gre_device_class;
 
 /* Parse gre protocol as 0xXXXX or protocol name.
index 70dd58b..4a047ee 100644 (file)
@@ -47,7 +47,7 @@ static u8 * format_ikev2_trace (u8 * s, va_list * args)
   return s;
 }
 
-vlib_node_registration_t ikev2_node;
+static vlib_node_registration_t ikev2_node;
 
 #define foreach_ikev2_error \
 _(PROCESSED, "IKEv2 packets processed") \
@@ -1908,7 +1908,7 @@ dispatch0:
   return frame->n_vectors;
 }
 
-VLIB_REGISTER_NODE (ikev2_node) = {
+VLIB_REGISTER_NODE (ikev2_node,static) = {
   .function = ikev2_node_fn,
   .name = "ikev2",
   .vector_size = sizeof (u32),
index fd0d75a..0b5eb3c 100644 (file)
@@ -26,8 +26,6 @@
 
 typedef u8 v8;
 
-vlib_node_registration_t ikev2_node;
-
 typedef CLIB_PACKED (struct {
   u64  ispi;
   u64  rspi;
index b755976..386c0ad 100644 (file)
@@ -201,13 +201,10 @@ typedef struct {
 
 ipsec_main_t ipsec_main;
 
-vlib_node_registration_t ipsec_input_ip4_node;
-vlib_node_registration_t ipsec_input_ip6_node;
-vlib_node_registration_t ipsec_output_node;
-vlib_node_registration_t esp_encrypt_node;
-vlib_node_registration_t esp_decrypt_node;
-vlib_node_registration_t ipsec_if_output_node;
-vlib_node_registration_t ipsec_if_input_node;
+extern vlib_node_registration_t esp_encrypt_node;
+extern vlib_node_registration_t esp_decrypt_node;
+extern vlib_node_registration_t ipsec_if_output_node;
+extern vlib_node_registration_t ipsec_if_input_node;
 
 
 /*
index abb4a47..3cd60ba 100644 (file)
@@ -52,8 +52,6 @@ static char * ipsec_input_error_strings[] = {
 #undef _
 };
 
-vlib_node_registration_t ipsec_input_node;
-
 typedef struct {
   u32 tunnel_index;
   u32 spi;
@@ -172,6 +170,8 @@ ipsec_input_ip6_protect_policy_match (ipsec_spd_t * spd,
     return 0;
 }
 
+static vlib_node_registration_t ipsec_input_ip4_node;
+
 static uword
 ipsec_input_ip4_node_fn (vlib_main_t * vm,
                         vlib_node_runtime_t * node,
@@ -270,7 +270,7 @@ trace0:
 }
 
 
-VLIB_REGISTER_NODE (ipsec_input_ip4_node) = {
+VLIB_REGISTER_NODE (ipsec_input_ip4_node,static) = {
   .function = ipsec_input_ip4_node_fn,
   .name = "ipsec-input-ip4",
   .vector_size = sizeof (u32),
@@ -289,6 +289,8 @@ VLIB_REGISTER_NODE (ipsec_input_ip4_node) = {
 };
 
 
+static vlib_node_registration_t ipsec_input_ip6_node;
+
 static uword
 ipsec_input_ip6_node_fn (vlib_main_t * vm,
                          vlib_node_runtime_t * node,
@@ -387,7 +389,7 @@ trace0:
 }
 
 
-VLIB_REGISTER_NODE (ipsec_input_ip6_node) = {
+VLIB_REGISTER_NODE (ipsec_input_ip6_node,static) = {
   .function = ipsec_input_ip6_node_fn,
   .name = "ipsec-input-ip6",
   .vector_size = sizeof (u32),
index fd804fa..509b1e2 100644 (file)
@@ -58,7 +58,7 @@ static char * ipsec_output_error_strings[] = {
 #undef _
 };
 
-vlib_node_registration_t ipsec_output_node;
+static vlib_node_registration_t ipsec_output_node;
 
 typedef struct {
   u32 spd_id;
@@ -386,7 +386,7 @@ dispatch0:
   return from_frame->n_vectors;
 }
 
-VLIB_REGISTER_NODE (ipsec_output_node) = {
+VLIB_REGISTER_NODE (ipsec_output_node,static) = {
   .function = ipsec_output_node_fn,
   .name = "ipsec-output",
   .vector_size = sizeof (u32),
index 55c2fc8..74e9d91 100644 (file)
@@ -65,7 +65,7 @@ typedef struct {
 
 l2_classify_main_t l2_classify_main;
 
-vlib_node_registration_t l2_classify_node;
+extern vlib_node_registration_t l2_classify_node;
 
 void vnet_l2_classify_enable_disable (u32 sw_if_index,
                                       int enable_disable);
index 31fe2d9..bea640c 100644 (file)
@@ -102,6 +102,8 @@ split_horizon_violation (u8 shg1, u8 shg2)
 }
 
 
+static vlib_node_registration_t l2output_node;
+
 static uword
 l2output_node_fn (vlib_main_t * vm,
                  vlib_node_runtime_t * node,
@@ -394,7 +396,7 @@ l2output_node_fn (vlib_main_t * vm,
 }
 
 
-VLIB_REGISTER_NODE (l2output_node) = {
+VLIB_REGISTER_NODE (l2output_node,static) = {
   .function = l2output_node_fn,
   .name = "l2-output",
   .vector_size = sizeof (u32),
index 0d171b8..1c7b033 100644 (file)
@@ -73,7 +73,6 @@ typedef struct {
 } l2output_main_t;
 
 l2output_main_t l2output_main;
-vlib_node_registration_t l2output_node;
 
 // L2 output features
 
index 9e7ac13..3f77f70 100644 (file)
@@ -85,8 +85,8 @@ typedef struct {
 } l2t_trace_t;
 
 l2t_main_t l2t_main;
-vlib_node_registration_t l2t_encap_node;
-vlib_node_registration_t l2t_decap_node;
+extern vlib_node_registration_t l2t_encap_node;
+extern vlib_node_registration_t l2t_decap_node;
 
 enum {
     SESSION_COUNTER_USER_TO_NETWORK=0,
index f6cbf66..6fe6caf 100644 (file)
@@ -41,6 +41,6 @@ typedef CLIB_PACKED(struct {
   udp_header_t udp;
 }) ip4_udp_header_t;
 
-vlib_node_registration_t li_hit_node;
+extern vlib_node_registration_t li_hit_node;
 
 #endif /* __lawful_intercept_h__ */
index 8ca721d..12c4ebc 100644 (file)
@@ -110,8 +110,8 @@ typedef struct {
 
 lisp_gpe_main_t lisp_gpe_main;
 
-vlib_node_registration_t lisp_gpe_input_node;
-vlib_node_registration_t lisp_gpe_encap_node;
+extern vlib_node_registration_t lisp_gpe_input_node;
+extern vlib_node_registration_t lisp_gpe_encap_node;
 
 u8 * format_lisp_gpe_encap_trace (u8 * s, va_list * args);
 u8 * format_lisp_gpe_header_with_length (u8 * s, va_list * args);
index 1e83ce8..2fb8015 100644 (file)
@@ -15,7 +15,7 @@
  */
 #include "sixrd.h"
 
-vlib_node_registration_t ip4_sixrd_node;
+static vlib_node_registration_t ip4_sixrd_node;
 
 typedef enum {
   IP4_SIXRD_NEXT_IP6_LOOKUP,
@@ -112,7 +112,7 @@ static char *sixrd_error_strings[] = {
 #undef _
 };
 
-VLIB_REGISTER_NODE(ip4_sixrd_node) = {
+VLIB_REGISTER_NODE(ip4_sixrd_node,static) = {
   .function = ip4_sixrd,
   .name = "ip4-sixrd",
   .vector_size = sizeof(u32),
index 0bd0cf3..36f3fab 100644 (file)
@@ -20,7 +20,7 @@
 
 #include "sixrd.h"
 
-vlib_node_registration_t ip6_sixrd_node;
+static vlib_node_registration_t ip6_sixrd_node;
 
 typedef enum {
   IP6_SIXRD_NEXT_IP4_LOOKUP,
@@ -114,7 +114,7 @@ static char *sixrd_error_strings[] = {
 #undef _
 };
 
-VLIB_REGISTER_NODE(ip6_sixrd_node) = {
+VLIB_REGISTER_NODE(ip6_sixrd_node,static) = {
   .function = ip6_sixrd,
   .name = "ip6-sixrd",
   .vector_size = sizeof(u32),
index d38d7f4..a79da2c 100644 (file)
@@ -296,18 +296,18 @@ typedef struct {
 
 map_main_t map_main;
 
-vlib_node_registration_t ip4_map_node;
-vlib_node_registration_t ip6_map_node;
-
-vlib_node_registration_t ip4_map_t_node;
-vlib_node_registration_t ip4_map_t_fragmented_node;
-vlib_node_registration_t ip4_map_t_tcp_udp_node;
-vlib_node_registration_t ip4_map_t_icmp_node;
-
-vlib_node_registration_t ip6_map_t_node;
-vlib_node_registration_t ip6_map_t_fragmented_node;
-vlib_node_registration_t ip6_map_t_tcp_udp_node;
-vlib_node_registration_t ip6_map_t_icmp_node;
+extern vlib_node_registration_t ip4_map_node;
+extern vlib_node_registration_t ip6_map_node;
+
+extern vlib_node_registration_t ip4_map_t_node;
+extern vlib_node_registration_t ip4_map_t_fragmented_node;
+extern vlib_node_registration_t ip4_map_t_tcp_udp_node;
+extern vlib_node_registration_t ip4_map_t_icmp_node;
+
+extern vlib_node_registration_t ip6_map_t_node;
+extern vlib_node_registration_t ip6_map_t_fragmented_node;
+extern vlib_node_registration_t ip6_map_t_tcp_udp_node;
+extern vlib_node_registration_t ip6_map_t_icmp_node;
 
 /*
  * map_get_pfx
index d741cb2..388ba4d 100644 (file)
@@ -18,9 +18,6 @@
 #include <vnet/vnet.h>
 #include <vnet/ip/ip.h>
 
-vlib_node_registration_t ip6_sixrd_node;
-vlib_node_registration_t ip4_sixrd_node;
-
 int sixrd_create_domain(ip6_address_t *ip6_prefix, u8 ip6_prefix_len,
                        ip4_address_t *ip4_prefix, u8 ip4_prefix_len,
                        ip4_address_t *ip4_src, u32 *sixrd_domain_index, u16 mtu);
index 5d7f9c5..c0a3531 100644 (file)
@@ -113,8 +113,8 @@ format_function_t format_mpls_eth_header_with_length;
 format_function_t format_mpls_unicast_label;
 format_function_t format_mpls_encap_index;
 
-vlib_node_registration_t mpls_input_node;
-vlib_node_registration_t mpls_policy_encap_node;
+extern vlib_node_registration_t mpls_input_node;
+extern vlib_node_registration_t mpls_policy_encap_node;
 
 vnet_device_class_t mpls_gre_device_class;
 
index c82c80f..580942f 100644 (file)
@@ -97,8 +97,8 @@ typedef struct {
 
 nsh_gre_main_t nsh_gre_main;
 
-vlib_node_registration_t nsh_gre_input_node;
-vlib_node_registration_t nsh_gre_encap_node;
+extern vlib_node_registration_t nsh_gre_input_node;
+extern vlib_node_registration_t nsh_gre_encap_node;
 
 u8 * format_nsh_gre_encap_trace (u8 * s, va_list * args);
 
index 953035a..99dc600 100644 (file)
@@ -125,8 +125,8 @@ typedef struct {
 
 nsh_vxlan_gpe_main_t nsh_vxlan_gpe_main;
 
-vlib_node_registration_t nsh_vxlan_gpe_input_node;
-vlib_node_registration_t nsh_vxlan_gpe_encap_node;
+extern vlib_node_registration_t nsh_vxlan_gpe_input_node;
+extern vlib_node_registration_t nsh_vxlan_gpe_encap_node;
 
 u8 * format_nsh_vxlan_gpe_encap_trace (u8 * s, va_list * args);
 
index 0b23258..0ffd401 100644 (file)
@@ -269,7 +269,7 @@ static char * srp_error_strings[] = {
 #undef _
 };
 
-vlib_node_registration_t srp_input_node = {
+static vlib_node_registration_t srp_input_node = {
   .function = srp_input,
   .name = "srp-input",
   /* Takes a vector of packets. */
index 48c447b..5288ebe 100644 (file)
@@ -149,8 +149,7 @@ void srp_interface_set_hw_wrap_function (u32 hw_if_index, srp_hw_wrap_function_t
 
 void srp_interface_set_hw_enable_function (u32 hw_if_index, srp_hw_enable_function_t * f);
 
-vlib_node_registration_t srp_ips_process_node;
-vlib_node_registration_t srp_input_node;
+extern vlib_node_registration_t srp_ips_process_node;
 
 /* Called when an IPS control packet is received on given interface. */
 void srp_ips_rx_packet (u32 sw_if_index, srp_ips_header_t * ips_packet);
index b38e65d..2454e4c 100644 (file)
@@ -112,8 +112,8 @@ typedef struct {
 
 vxlan_main_t vxlan_main;
 
-vlib_node_registration_t vxlan_input_node;
-vlib_node_registration_t vxlan_encap_node;
+extern vlib_node_registration_t vxlan_input_node;
+extern vlib_node_registration_t vxlan_encap_node;
 
 u8 * format_vxlan_encap_trace (u8 * s, va_list * args);