gcc testsuite - howto adjust spec file

robert baker robertmbaker at gmail.com
Mon Jun 15 13:18:06 PDT 2009

I have never built a uclibc based HLFS, but this is what I came up
with to get through the test suites without any unexpected failures on
my glibc build.

%(cc1_cpu) %{profile:-p} %{!-fPIE:-fno-PIE}

%{!-fPIE:-fno-PIE} %{!-stack-protector:-fno-stack-protector}

On Mon, Jun 15, 2009 at 7:39 AM, Mwanguhya Daniel
Murungi<dmurungi at dicts.mak.ac.ug> wrote:
> I made the following change in the gcc spec file for cc1: from;
> *cc1:
> %(cc1_cpu) %{profile:-p} %{fno-pic|fpic|fPIC:;:-fPIC}
> to
> *cc1:
> %(cc1_cpu) %{profile:-p} %{fno-pic|fpic|fPIC:;:-fno-PIE -fno-stack-protector}

Well correct me if I am wrong (its been known to happen) but the above
line says if fno-pic and or fpic and or PIC is declared then use
-fno-PIE -fno-stack-protector. If that is indeed what it means then I
could see why you are still getting a few failures. Not all tests
necessarily pass those flags and so any tests that don't are still
lacking the -fno-PIE -fno-stack-protector flags. That is why I decided
to do %{!-fPIE:-fno-PIE} %{!-stack-protector:-fno-stack-protector}.
With this line (as I understand the specs file) we get both -fno-PIE
and -fno-stack-protector unless -PIE or -stack-protector is passed. I
figured if anything explicitly requires either of those flags it would
be best to allow it. Also it is probably better to declare -fno-PIE
and -fno-stack-protector separately so we can check for the opposite
flag for each rather than just expecting one to go along with the
other. Again I may be misunderstanding the specs file so forgive me if
that is the case, but the above amendments worked very well for my

Robert Baker

More information about the hlfs-dev mailing list