user148898
user148898

Reputation: 21

Modify compile steps of glibc

I am trying to recompile the standard Glibc 2.20, with a requirement that I disable optimizations for a few specific components. In particular, I'm looking to remove the -O2 flag that's inherited from the parent make files, to components like saying malloc. Where the standard process of making does gcc malloc.c -O2, I'd want to specify my own command line for this particular module.

Is there a way that can be done?

Upvotes: 0

Views: 129

Answers (1)

Florian Weimer
Florian Weimer

Reputation: 33694

In order to compile malloc/malloc.c with -O0, you can add this to malloc/Makefile:

CFLAGS-malloc.c = -O0 -D__OPTIMIZE__

The -D__OPTIMIZE__ flag is needed to bypass a check in include/libc-symbols.h. This trick does not work for all parts of glibc, but for malloc.c, it produces a working library.

Upvotes: 1

Related Questions