This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Flag to disable wchar support


Sorry to bother you, but got no answer on this, so I'm trying to ask the same question again. Hope it is allowed by the mailing list policy.

Federico Terraneo wrote:
Hi,
I've been using newlib + libstdc++ for quite some time compiled with "--target=arm-elf", but I'm switching to "--target=arm-eabi" for better support of new Cortex M3 microcontrollers.


However, this change caused a large code size increase in C++ code (see below), and the problem seems related to newlib.
In practice, compiling newlib 1.18.0 with "--target=arm-eabi" causes the inclusion of some new functions to support wide charactes, like wprintf and wscanf (for the full list see below), and this triggers libstdc++ into including support for wide characters in iostream code, which is what causes the code size increase.


So I'm asking these two questions:
1) Is it "normal" that these additional functions are included only with "--target=arm-eabi" and not with "--target=arm-elf"?
2) Is there a way to disable wide character support?
I've tried "--disable-newlib-mb" but it didn't work.


For now I've temporarily fixed the problem by downgrading to newlib 1.17.0 since it does not have these new functions and code size returned at acceptable levels, but I'd like to stay up to date with the latest newlib.

-------------------------------------------------------

An example program to show the difference in code size between arm-elf and arm-eabi

#include <iostream>
using namespace std;

int main()
{
    cout<<"Hello world"<<endl;
    string line;
    getline(cin,line);
    cout<<line;
}

arm-elf-g++ -mcpu=arm7tdmi -g -O0 -c arm_test.cpp
arm-elf-g++ -mcpu=arm7tdmi  -o arm_test arm_test.o
arm-elf-size arm_test
   text       data        bss        dec        hex    filename
 368320       2648       3880     374848      5b840    arm_test

arm-eabi-g++ -mcpu=arm7tdmi -g -O0 -c arm_test.cpp
arm-eabi-g++ -mcpu=arm7tdmi  -o arm_test arm_test.o
arm-eabi-size arm_test
   text       data        bss        dec        hex    filename
 504292       2756       7468     514516      7d9d4    arm_test

-------------------------------------------------------

The list of functions that are present only when compiling with "--target=arm-elf"

$ arm-eabi-ar -t /opt/arm-eabi/arm-eabi/lib/libc.a | sort > ~/libc-eabi.txt
$ arm-elf-ar -t /opt/arm-elf/arm-elf/lib/libc.a | sort > ~/libc-elf.txt
$ diff -U 0 libc-elf.txt libc-eabi.txt
--- libc-elf.txt    2010-02-07 11:22:50.000000000 +0100
+++ libc-eabi.txt    2010-02-07 11:22:41.000000000 +0100
@@ -99,0 +100 @@
+lib_a-fpurge.o
@@ -117,0 +119 @@
+lib_a-fwprintf.o
@@ -118,0 +121 @@
+lib_a-fwscanf.o
@@ -211,0 +215 @@
+lib_a-mbsnrtowcs.o
@@ -224,0 +229 @@
+lib_a-mkdirr.o
@@ -269,0 +275 @@
+lib_a-sb_charsets.o
@@ -283,0 +290 @@
+lib_a-sf_fpclassify.o
@@ -292,0 +300 @@
+lib_a-s_fpclassify.o
@@ -350,0 +359 @@
+lib_a-strtold.o
@@ -360,0 +370,2 @@
+lib_a-svfiwprintf.o
+lib_a-svfiwscanf.o
@@ -362,0 +374,2 @@
+lib_a-svfwprintf.o
+lib_a-svfwscanf.o
@@ -363,0 +377,2 @@
+lib_a-swprintf.o
+lib_a-swscanf.o
@@ -395 +409,0 @@
-lib_a-_tolower.o
@@ -397 +410,0 @@
-lib_a-_toupper.o
@@ -423,0 +437,2 @@
+lib_a-vfiwprintf.o
+lib_a-vfiwscanf.o
@@ -425,0 +441,2 @@
+lib_a-vfwprintf.o
+lib_a-vfwscanf.o
@@ -435,0 +453,4 @@
+lib_a-vswprintf.o
+lib_a-vswscanf.o
+lib_a-vwprintf.o
+lib_a-vwscanf.o
@@ -439,0 +461 @@
+lib_a-wcscasecmp.o
@@ -445,0 +468,2 @@
+lib_a-wcsdup.o
+lib_a-wcsftime.o
@@ -448,0 +473 @@
+lib_a-wcsncasecmp.o
@@ -452,0 +478 @@
+lib_a-wcsnrtombs.o
@@ -457,0 +484 @@
+lib_a-wcstod.o
@@ -458,0 +486 @@
+lib_a-wcstold.o
@@ -479,0 +508 @@
+lib_a-wprintf.o
@@ -480,0 +510 @@
+lib_a-wscanf.o





Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]