This is the mail archive of the libstdc++@sourceware.cygnus.com mailing list for the libstdc++ project.


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

HOWTO-honor-std




The g++ flag sommelier recommended some exciting flags to me, and I
thought I'd share them with this group.

They are:

-fhonor-std
enable namespaces (ie std::)

-fnew-exceptions
enable new, table-driven exception model on hosts that support it
(x86/powerpc ELF targets)

-fsquangle
enable compressed mangling schemes

-fvtable-thunks
enable efficient vtable generation
(is already the default on x86/linux)

-fvtable-gc -ffunction-sections
enables putting functions into individual sections, so that the
linking process can be optimized. This is an automatic way to do what
the string*.o instantiation files are doing manually right now.
(ELF targets using binutils-2.9.4)


To use these flags, some twisting and contortions may be necessary. For
those with an adventurous palette, please read on.


Step 1: Figure out which of the new varietals CXXFLAGS is going to
include, and stick with it. These actually work right now: 
CXXFLAGS="-fhonor-std -fsquangle"

Step 2: Rebuild libstdc++-v3 with the new flags.
This should be automated, and easier to do, but it is not.

a) mkcheck
Change line 62

# gcc compiler flags
CXX_FLAG="-g -O2 -DDEBUG_ASSERT "

to

CXX_FLAG="-fsquangle -fhonor-std -g -O2 -DDEBUG_ASSERT "

b) src/gen-c++config.cc
Change line 46

// # define _GLIBCPP_USE_NAMESPACES 1 

to

# define _GLIBCPP_USE_NAMESPACES 1 

c) src/Makefile.am
Change line 8

CXXFLAGS = -g -D_GNU_SOURCE -fno-implicit-templates 

to

CXXFLAGS = -g -D_GNU_SOURCE -fno-implicit-templates \
	   -fsquangle -fhonor-std 


d) go to the top level of the source directory and run automake

e) go to a new build directory, and configure/build libstdc++


Step 3: Rebuild libgcc.a

1) go into the build directory of your compiler, say

 /mnt/hd/bliss/bld-x86-gcc-2_95/gcc                               

2) rm libgcc2.*
   rm libgcc.*

3) make libgcc2.a TARGET_LIBGCC2_CFLAGS="-fsquangle -fhonor-std"

4) make libgcc.a

5) cp this new libgcc.a into your EXE_PREFIX_DIRECTORY, and rename the old one.
For me, this means that 

/mnt/hd/bliss/H-x86-gcc-2_95/lib/gcc-lib/i686-pc-linux-gnu/2.95

now has:

lrwxrwxrwx   1 bkoz     bkoz           12 Jul 28 14:52 libgcc.a -> libgcc.a.new
-rw-rw-r--   1 bkoz     bkoz       734588 Jul 28 14:51 libgcc.a.new
-rw-r--r--   1 bkoz     bkoz       772410 Jul 27 23:05 libgcc.a.old

Step 4: Now, try to use. . ..weeee!







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