gcc-13-20230319 is now available

2023-03-19 Thread GCC Administrator via Gcc
Snapshot gcc-13-20230319 is now available on
  https://gcc.gnu.org/pub/gcc/snapshots/13-20230319/
and on various mirrors, see http://gcc.gnu.org/mirrors.html for details.

This snapshot has been generated from the GCC 13 git branch
with the following options: git://gcc.gnu.org/git/gcc.git branch master 
revision 5426ab34643d9e6502f3ee572891a03471fa33ed

You'll find:

 gcc-13-20230319.tar.xz   Complete GCC

  SHA256=22320959c842e7dd5888c01fe3ecc07e0fda12f2cb17833df827004fdab78b13
  SHA1=7d1826d60c542070489519aa4aad79ca0c904c3f

Diffs from 13-20230312 are available in the diffs/ subdirectory.

When a particular snapshot is ready for public consumption the LATEST-13
link is updated and a message is sent to the gcc list.  Please do not use
a snapshot before it has been announced that way.


Re: Is it possible to enable data sections and function sections without explicitly giving flags "-fdata-sections" and "-ffunction-sections"?

2023-03-19 Thread David Brown

On 19/03/2023 13:38, 3119369616.qq via Gcc wrote:

To divide functions into sections and then remove unused sections, I
must provide flags "-fdata-sections" and "-ffunction-sections" in GCC
and a flag "--gc-sections" in LD. Most of the build systems don't
support these flags so GCC will generate bigger binaries. Is it
possible to enable this feature without  giving any command line
flags manually?


Just to be clear here - removing unused sections is only beneficial if 
you have a significant amount of unused code and data compiled in the 
build.  That can sometimes be the case, if you are making re-usable 
library code.  But for other types of code, it is better to be clear in 
the source code about what is and is not part of the program - i.e., if 
the function is not used by the program, it should not be in the source 
code.  I don't know what kind of code you are working on, but it's worth 
considering.


Re: Is it possible to enable data sections and function sections without explicitly giving flags "-fdata-sections" and "-ffunction-sections"?

2023-03-19 Thread Arsen Arsenović via Gcc

"3119369616.qq via Gcc"  writes:

> To divide functions into sections and then remove unused sections, I must
> provide flags "-fdata-sections" and "-ffunction-sections" in GCC and a flag
> "--gc-sections" in LD. Most of the build systems don't support these flags so
> GCC will generate bigger binaries.
> Is it possible to enable this feature without  giving any command line 
> flags manually?

All (at least decent) build systems support passing extra flags to the
compiler and linker (e.g. CXXFLAGS="-ffunction-sections"), or passing a
custom compiler and linker (which can set those flags, something like
CC="gcc -ffunction-sections").  This is how you should be setting such
flags.

If you're interested in DCE and other size-reducing optimizations, you
might also be interested in LTO and -Os.
-- 
Arsen Arsenović


signature.asc
Description: PGP signature


Is it possible to enable data sections and function sections without explicitly giving flags "-fdata-sections" and "-ffunction-sections"?

2023-03-19 Thread 3119369616.qq via Gcc
To divide functions into sections and then remove unused sections, I must 
provide flags "-fdata-sections" and "-ffunction-sections" in GCC and a flag 
"--gc-sections" in LD. Most of the build systems don't support these flags so 
GCC will generate bigger binaries.
Is it possible to enable this feature without  giving any command line 
flags manually?