From b9eaf24df211591793bfe151169a23ab1567bdf9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Piotr=20Jaroszy=C5=84ski?=
Date: Thu, 19 Aug 2010 23:39:17 +0200
Subject: [PATCH] [build] Fix misaligned table entries when using gcc 4.5
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Declarations without the accompanying __table_entry cause misalignment
of the table entries when using gcc 4.5. Fix by adding the
appropriate __table_entry macro or (where possible) by removing
unnecessary forward declarations.
Signed-off-by: Piotr JaroszyĆski
Signed-off-by: Michael Brown
---
src/arch/i386/core/video_subr.c | 2 +-
src/include/ipxe/arp.h | 6 ++----
src/include/ipxe/icmp6.h | 2 +-
src/include/ipxe/ip.h | 5 ++---
src/include/ipxe/ip6.h | 8 ++++----
src/include/ipxe/rarp.h | 4 ++--
src/include/ipxe/tcp.h | 2 +-
src/net/aoe.c | 2 +-
src/net/arp.c | 2 +-
src/net/eth_slow.c | 2 +-
src/net/icmpv6.c | 2 --
src/net/ipv4.c | 2 --
src/net/ipv6.c | 2 --
src/net/udp.c | 2 +-
14 files changed, 17 insertions(+), 26 deletions(-)
diff --git a/src/arch/i386/core/video_subr.c b/src/arch/i386/core/video_subr.c
index b10ef7bc..4c583e5b 100644
--- a/src/arch/i386/core/video_subr.c
+++ b/src/arch/i386/core/video_subr.c
@@ -12,7 +12,7 @@
#include
#include "vga.h"
-struct console_driver vga_console;
+struct console_driver vga_console __console_driver;
static char *vidmem; /* The video buffer */
static int video_line, video_col;
diff --git a/src/include/ipxe/arp.h b/src/include/ipxe/arp.h
index 373a95da..f7b99c68 100644
--- a/src/include/ipxe/arp.h
+++ b/src/include/ipxe/arp.h
@@ -10,9 +10,7 @@
FILE_LICENCE ( GPL2_OR_LATER );
#include
-
-struct net_device;
-struct net_protocol;
+#include
/** A network-layer protocol that relies upon ARP */
struct arp_net_protocol {
@@ -35,7 +33,7 @@ struct arp_net_protocol {
/** Declare an ARP protocol */
#define __arp_net_protocol __table_entry ( ARP_NET_PROTOCOLS, 01 )
-extern struct net_protocol arp_protocol;
+extern struct net_protocol arp_protocol __net_protocol;
extern int arp_resolve ( struct net_device *netdev,
struct net_protocol *net_protocol,
diff --git a/src/include/ipxe/icmp6.h b/src/include/ipxe/icmp6.h
index d2ab3bc1..1d433408 100644
--- a/src/include/ipxe/icmp6.h
+++ b/src/include/ipxe/icmp6.h
@@ -15,7 +15,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
#define ICMP6_NSOLICIT 135
#define ICMP6_NADVERT 136
-extern struct tcpip_protocol icmp6_protocol;
+extern struct tcpip_protocol icmp6_protocol __tcpip_protocol;
struct icmp6_header {
uint8_t type;
diff --git a/src/include/ipxe/ip.h b/src/include/ipxe/ip.h
index e3445aa4..3f3dc1f7 100644
--- a/src/include/ipxe/ip.h
+++ b/src/include/ipxe/ip.h
@@ -13,10 +13,9 @@ FILE_LICENCE ( GPL2_OR_LATER );
#include
#include
#include
+#include
struct io_buffer;
-struct net_device;
-struct net_protocol;
/* IP constants */
@@ -92,6 +91,6 @@ struct frag_buffer {
extern struct list_head ipv4_miniroutes;
-extern struct net_protocol ipv4_protocol;
+extern struct net_protocol ipv4_protocol __net_protocol;
#endif /* _IPXE_IP_H */
diff --git a/src/include/ipxe/ip6.h b/src/include/ipxe/ip6.h
index 70c2fad2..e9584bd6 100644
--- a/src/include/ipxe/ip6.h
+++ b/src/include/ipxe/ip6.h
@@ -11,6 +11,8 @@ FILE_LICENCE ( GPL2_OR_LATER );
#include
#include
+#include
+#include
/* IP6 constants */
@@ -64,11 +66,9 @@ struct ipv6_pseudo_header {
#define IP6_NO_HEADER 0x59
struct io_buffer;
-struct net_device;
-struct net_protocol;
-extern struct net_protocol ipv6_protocol;
-extern struct tcpip_net_protocol ipv6_tcpip_protocol;
+extern struct net_protocol ipv6_protocol __net_protocol;
+extern struct tcpip_net_protocol ipv6_tcpip_protocol __tcpip_net_protocol;
extern char * inet6_ntoa ( struct in6_addr in6 );
extern int add_ipv6_address ( struct net_device *netdev,
diff --git a/src/include/ipxe/rarp.h b/src/include/ipxe/rarp.h
index 7edbe219..f84301a4 100644
--- a/src/include/ipxe/rarp.h
+++ b/src/include/ipxe/rarp.h
@@ -9,8 +9,8 @@
FILE_LICENCE ( GPL2_OR_LATER );
-struct net_protocol;
+#include
-extern struct net_protocol rarp_protocol;
+extern struct net_protocol rarp_protocol __net_protocol;
#endif /* _IPXE_RARP_H */
diff --git a/src/include/ipxe/tcp.h b/src/include/ipxe/tcp.h
index b189afd7..e6461464 100644
--- a/src/include/ipxe/tcp.h
+++ b/src/include/ipxe/tcp.h
@@ -342,6 +342,6 @@ static inline int tcp_in_window ( uint32_t seq, uint32_t start,
return ( ( seq - start ) < len );
}
-extern struct tcpip_protocol tcp_protocol;
+extern struct tcpip_protocol tcp_protocol __tcpip_protocol;
#endif /* _IPXE_TCP_H */
diff --git a/src/net/aoe.c b/src/net/aoe.c
index 4b700073..4a03e2b6 100644
--- a/src/net/aoe.c
+++ b/src/net/aoe.c
@@ -44,7 +44,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
FEATURE ( FEATURE_PROTOCOL, "AoE", DHCP_EB_FEATURE_AOE, 1 );
-struct net_protocol aoe_protocol;
+struct net_protocol aoe_protocol __net_protocol;
/** List of all AoE sessions */
static LIST_HEAD ( aoe_sessions );
diff --git a/src/net/arp.c b/src/net/arp.c
index fe4dbff9..714b471b 100644
--- a/src/net/arp.c
+++ b/src/net/arp.c
@@ -63,7 +63,7 @@ static struct arp_entry arp_table[NUM_ARP_ENTRIES];
static unsigned int next_new_arp_entry = 0;
-struct net_protocol arp_protocol;
+struct net_protocol arp_protocol __net_protocol;
/**
* Find entry in the ARP cache
diff --git a/src/net/eth_slow.c b/src/net/eth_slow.c
index 86fe62c3..4b2df280 100644
--- a/src/net/eth_slow.c
+++ b/src/net/eth_slow.c
@@ -40,7 +40,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
* partner sends us.
*/
-struct net_protocol eth_slow_protocol;
+struct net_protocol eth_slow_protocol __net_protocol;
/** Slow protocols multicast address */
static const uint8_t eth_slow_address[ETH_ALEN] =
diff --git a/src/net/icmpv6.c b/src/net/icmpv6.c
index ab8a65ec..1a5aad3b 100644
--- a/src/net/icmpv6.c
+++ b/src/net/icmpv6.c
@@ -11,8 +11,6 @@
#include
#include
-struct tcpip_protocol icmp6_protocol;
-
/**
* Send neighbour solicitation packet
*
diff --git a/src/net/ipv4.c b/src/net/ipv4.c
index 95486527..a3cbdb03 100644
--- a/src/net/ipv4.c
+++ b/src/net/ipv4.c
@@ -26,8 +26,6 @@ FILE_LICENCE ( GPL2_OR_LATER );
/* Unique IP datagram identification number */
static uint16_t next_ident = 0;
-struct net_protocol ipv4_protocol;
-
/** List of IPv4 miniroutes */
struct list_head ipv4_miniroutes = LIST_HEAD_INIT ( ipv4_miniroutes );
diff --git a/src/net/ipv6.c b/src/net/ipv6.c
index 781d7628..ffaa558b 100644
--- a/src/net/ipv6.c
+++ b/src/net/ipv6.c
@@ -15,8 +15,6 @@
#include
#include
-struct net_protocol ipv6_protocol;
-
/* Unspecified IP6 address */
static struct in6_addr ip6_none = {
.in6_u.u6_addr32 = { 0,0,0,0 }
diff --git a/src/net/udp.c b/src/net/udp.c
index 0ed1503a..9bd80f3a 100644
--- a/src/net/udp.c
+++ b/src/net/udp.c
@@ -44,7 +44,7 @@ static LIST_HEAD ( udp_conns );
/* Forward declatations */
static struct interface_descriptor udp_xfer_desc;
-struct tcpip_protocol udp_protocol;
+struct tcpip_protocol udp_protocol __tcpip_protocol;
/**
* Bind UDP connection to local port