From: Andrew Lunn <andrew@lunn.ch>
To: Andrew Lunn <andrew@lunn.ch>
Cc: "oliver munz @ s p e a g" <munz@speag.ch>, ecos-devel@sources.redhat.com
Subject: Re: why use the SA1110-USB-driver a static /dev/usbs... definition ???
Date: Mon, 27 Jun 2005 13:41:00 -0000 [thread overview]
Message-ID: <20050627134055.GG11071@lunn.ch> (raw)
In-Reply-To: <20050627130201.GD11071@lunn.ch>
[-- Attachment #1: Type: text/plain, Size: 349 bytes --]
> What version of gcc are you using? Something newish?
My guess would be something like 3.4 or higher.
http://www.gnu.org/software/gcc/gcc-3.4/changes.html
I says that "Unreferenced static variables and functions are removed"
This fits your problem description.
Please could you try the attached patch.
Thanks
Andrew
[-- Attachment #2: used.diff --]
[-- Type: text/plain, Size: 4012 bytes --]
Index: hal/common/current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/hal/common/current/ChangeLog,v
retrieving revision 1.109
diff -u -r1.109 ChangeLog
--- hal/common/current/ChangeLog 7 Jun 2005 18:31:35 -0000 1.109
+++ hal/common/current/ChangeLog 27 Jun 2005 13:40:04 -0000
@@ -1,3 +1,10 @@
+2005-06-27 Andrew Lunn <andrew.lunn@ascom.ch>
+
+ * include/hal_tables.h (CYG_HAL_TABLE_{QUALIFIED_}ENTRY): added
+ CYGBLD_ATTRIB_USED so that gcc 3.4.4 does not discard entries
+ which are not refereced explicitly. Problem reported by
+ Oliver Munz.
+
2005-05-19 Peter Korsgaard <jacmet@sunsite.dk>
* doc/porting.sgml: Changed dead sourceware.cygnus.com links to
Index: hal/common/current/include/hal_tables.h
===================================================================
RCS file: /cvs/ecos/ecos/packages/hal/common/current/include/hal_tables.h,v
retrieving revision 1.7
diff -u -r1.7 hal_tables.h
--- hal/common/current/include/hal_tables.h 23 May 2002 23:02:47 -0000 1.7
+++ hal/common/current/include/hal_tables.h 27 Jun 2005 13:40:04 -0000
@@ -101,13 +101,15 @@
#ifndef CYG_HAL_TABLE_ENTRY
#define CYG_HAL_TABLE_ENTRY( _name ) \
- CYGBLD_ATTRIB_SECTION(".ecos.table." __xstring(_name) ".data")
+ CYGBLD_ATTRIB_SECTION(".ecos.table." __xstring(_name) ".data") \
+ CYGBLD_ATTRIB_USED
#endif
#ifndef CYG_HAL_TABLE_QUALIFIED_ENTRY
#define CYG_HAL_TABLE_QUALIFIED_ENTRY( _name, _qual ) \
CYGBLD_ATTRIB_SECTION(".ecos.table." __xstring(_name) ".data." \
- __xstring(_qual))
+ __xstring(_qual)) \
+ CYGBLD_ATTRIB_USED
#endif
/*------------------------------------------------------------------------*/
Index: infra/current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/infra/current/ChangeLog,v
retrieving revision 1.49
diff -u -r1.49 ChangeLog
--- infra/current/ChangeLog 27 Mar 2005 18:14:58 -0000 1.49
+++ infra/current/ChangeLog 27 Jun 2005 13:40:05 -0000
@@ -1,3 +1,9 @@
+2005-06-27 Andrew Lunn <andrew.lunn@ascom.ch>
+
+ * include/cyg_type.h: Added CYGBLD_ATTRIB_USED so that we can
+ indicate to gcc 3.4.4 or above not to throw away a variable or
+ function even when it appears to be not references.
+
2005-03-27 Andrew Lunn <andrew.lunn@ascom.ch>
* include/diag.h: Added CYGBLD_ATTRIB_PRINTF_FORMAT where
Index: infra/current/include/cyg_type.h
===================================================================
RCS file: /cvs/ecos/ecos/packages/infra/current/include/cyg_type.h,v
retrieving revision 1.22
diff -u -r1.22 cyg_type.h
--- infra/current/include/cyg_type.h 27 Mar 2005 18:14:59 -0000 1.22
+++ infra/current/include/cyg_type.h 27 Jun 2005 13:40:05 -0000
@@ -313,6 +313,15 @@
// COMPILER-SPECIFIC STUFF
#ifdef __GNUC__
+#if defined(__GNU_PATCHLEVEL__)
+# define __GNUC_VERSION__ (__GNUC__ * 10000 \
+ + __GNUC_MINOR__ * 100 \
+ + __GNUC_PATCHLEVEL__)
+#else
+# define __GNUC_VERSION__ (__GNUC__ * 10000 \
+ + __GNUC_MINOR__ * 100)
+#endif
+
// Force a 'C' routine to be called like a 'C++' contructor
# if !defined(CYGBLD_ATTRIB_CONSTRUCTOR)
# define CYGBLD_ATTRIB_CONSTRUCTOR __attribute__((constructor))
@@ -383,6 +392,16 @@
# define CYGBLD_ATTRIB_STRFTIME_FORMAT(__format__, __args__) \
__attribute__((format (strftime, __format__, __args__)))
+// Tell the compiler not to throw away a variable or function. Only
+// available on 3.3.4 or above. Old version's didn't throw them away,
+// but using the unused attribute should stop warnings.
+# if !defined(CYGBLD_ATTRIB_USED)
+# if __GNUC_VERSION__ >= 30404
+# define CYGBLD_ATTRIB_USED __attribute__((used))
+# else
+# define CYGBLD_ATTRIB_USED __attribute__((unused))
+# endif
+# endif
#else // non-GNU
# define CYGBLD_ATTRIB_CONSTRUCTOR
next prev parent reply other threads:[~2005-06-27 13:41 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-06-27 12:46 oliver munz @ s p e a g
2005-06-27 13:02 ` Andrew Lunn
2005-06-27 13:41 ` Andrew Lunn [this message]
2005-06-27 14:34 ` oliver munz @ s p e a g
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20050627134055.GG11071@lunn.ch \
--to=andrew@lunn.ch \
--cc=ecos-devel@sources.redhat.com \
--cc=munz@speag.ch \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).