[PATCH 0/2] Toolchain fixes.

3 views
Skip to first unread message

Barret Rhoden

unread,
Nov 3, 2015, 11:24:04 AM11/3/15
to aka...@googlegroups.com
These fixes were caused by my recent changes to redefine assert and printf
throughout parlib. These commits are on origin/staging.

------------
You can also find these patches at:
g...@github.com:brho/akaros.git
FROM: 91d62e0c75d3 HEAD~2
TO: b3dc4ab6cc78 staging

And view them at:
https://github.com/brho/akaros/compare/91d62e0c75d3...b3dc4ab6cc78


Barret Rhoden (2):
Limit the headers pulled in by parlib/arch.h (XCC)
Be more careful when re#defining printf (XCC)

user/parlib/include/stdio.h | 2 +-
user/parlib/include/x86/arch.h | 2 --
2 files changed, 1 insertion(+), 3 deletions(-)

--
2.6.0.rc2.230.g3dd15c0

Barret Rhoden

unread,
Nov 3, 2015, 11:24:05 AM11/3/15
to aka...@googlegroups.com
The problem here was that #defining printf catches all usages of the
word printf. We only want to #define printf when it is used as a
function.

This popped up when libgomp failed to build, complaining that
"akaros_printf" is not a format function. What's going on is that
somewhere in libgomp they are doing an __atttribute__ ((format (printf,
1, 2))), which marks a function as a printf-style function. The word
'printf' in there is getting expanded to akaros_printf, and gcc rejects
that. (For more info on that, check out
https://gcc.gnu.org/onlinedocs/gcc-3.2/gcc/Function-Attributes.html).

Removing parlib/stdio.h from parlib/common.h wouldn't really fix this.
It would, in the short term, but eventually libgomp would need to
#include parlib/stdio.h, since it probably will use some 2LS / vcore
feature and want to do a printf.

Rebuild glibc.

Signed-off-by: Barret Rhoden <br...@cs.berkeley.edu>
---
user/parlib/include/stdio.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/user/parlib/include/stdio.h b/user/parlib/include/stdio.h
index c799b43bb762..9395aa5a87df 100644
--- a/user/parlib/include/stdio.h
+++ b/user/parlib/include/stdio.h
@@ -33,7 +33,7 @@ int ros_vdebug(const char *fmt, va_list);
* otherwise. */
int akaros_printf(const char *format, ...);
#undef printf
-#define printf akaros_printf
+#define printf(args...) akaros_printf(args)

__END_DECLS

--
2.6.0.rc2.230.g3dd15c0

Barret Rhoden

unread,
Nov 3, 2015, 11:24:05 AM11/3/15
to aka...@googlegroups.com
The problem here is that arch.h is used by parts of glibc. By including
common.h, we're pulling in parlib/stdio.h, which pulls in stdio.h.
That's more than parts of glibc can handle. string.h was unneeded as
well.

The problem manifested itself as glibc build errors, complaining about
stdio. An alternative solution would be to remove parlib/assert.h and
parlib/stdio.h from parlib/common.h, though that would make it harder
for us to broadly include those headers.

For now, we can keep the lower-level headers (e.g. arch.h) from
including other major parts of parlib.

Rebuild glibc.

Signed-off-by: Barret Rhoden <br...@cs.berkeley.edu>
---
user/parlib/include/x86/arch.h | 2 --
1 file changed, 2 deletions(-)

diff --git a/user/parlib/include/x86/arch.h b/user/parlib/include/x86/arch.h
index ce242f0a5155..e1ad4dab2cfe 100644
--- a/user/parlib/include/x86/arch.h
+++ b/user/parlib/include/x86/arch.h
@@ -3,8 +3,6 @@

#include <ros/trapframe.h>
#include <ros/arch/mmu.h>
-#include <parlib/common.h>
-#include <string.h>

__BEGIN_DECLS

--
2.6.0.rc2.230.g3dd15c0

ron minnich

unread,
Nov 3, 2015, 1:26:58 PM11/3/15
to aka...@googlegroups.com
lgtm

--
You received this message because you are subscribed to the Google Groups "Akaros" group.
To unsubscribe from this group and stop receiving emails from it, send an email to akaros+un...@googlegroups.com.
To post to this group, send email to aka...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

ron minnich

unread,
Nov 3, 2015, 1:27:15 PM11/3/15
to aka...@googlegroups.com
lgtm

On Tue, Nov 3, 2015 at 8:24 AM Barret Rhoden <br...@cs.berkeley.edu> wrote:
Reply all
Reply to author
Forward
0 new messages