Skip to contentSkip to conversation

smc91111_eeprom: fix linking error

PATCH New Mike Frysinger 2 participants 2 messages Jan 21, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 smc91111_eeprom: fix linking error

Building for a bf533-stamp ends up with this error:
smc91111_eeprom.o: In function `smc91111_eeprom':
examples/standalone/smc91111_eeprom.c:58: undefined reference to `memset' make[2]: *** [smc91111_eeprom] Error 1

The new eth_struct definition means gcc has to zero out the structure on the stack, and some gcc versions optimize this with an implicit call to memset. So tweak the structure style to avoid that gcc feature.

---
 examples/standalone/smc91111_eeprom.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)
examples/standalone/smc91111_eeprom.c +2 -3
index 9145763..b91f34c 100644
@@ -53,9 +53,8 @@ int smc91111_eeprom (int argc, char *argv[])
 	int c, i, j, done, line, reg, value, start, what;
 	char input[50];
 
-	struct eth_device dev = {
-		.iobase = CONFIG_SMC91111_BASE
-	};
+	struct eth_device dev;
+	dev.iobase = CONFIG_SMC91111_BASE;
 
 	/* Print the ABI version */
 	app_startup (argv);
Signature · 1 line
1.6.6
Applied
#1 lore raw

PATCH 1/1 smc91111_eeprom: fix linking error

Mike,

Quoted 21 lines · Mike Frysinger

Building for a bf533-stamp ends up with this error:
smc91111_eeprom.o: In function `smc91111_eeprom':
examples/standalone/smc91111_eeprom.c:58: undefined reference to `memset' make[2]: *** [smc91111_eeprom] Error 1

The new eth_struct definition means gcc has to zero out the structure on the stack, and some gcc versions optimize this with an implicit call to memset. So tweak the structure style to avoid that gcc feature.

---
 examples/standalone/smc91111_eeprom.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)
examples/standalone/smc91111_eeprom.c +0 -0
index 9145763..b91f34c 100644
@@ -53,9 +53,8 @@ int smc91111_eeprom (int argc, char *argv[])
 	int c, i, j, done, line, reg, value, start, what;

examples/standalone/smc91111_eeprom.c int smc91111_eeprom (int argc, char *argv[]) · line 60

Quoted 10 lines
examples/standalone/smc91111_eeprom.c +2 -3
 	char input[50];
 
-	struct eth_device dev = {
-		.iobase = CONFIG_SMC91111_BASE
-	};
+	struct eth_device dev;
+	dev.iobase = CONFIG_SMC91111_BASE;
 
 	/* Print the ABI version */
 	app_startup (argv);

Applied to net repo.

thanks,
Ben