Bug 11633 - bintuils testsuit fails if built with CFLAGS="-fstack-protector-all"
Summary: bintuils testsuit fails if built with CFLAGS="-fstack-protector-all"
Status: RESOLVED WONTFIX
Alias: None
Product: binutils
Classification: Unclassified
Component: binutils (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-25 13:51 UTC by Peter Hjalmarsson
Modified: 2023-01-19 12:09 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments
demonstration patch (372 bytes, patch)
2010-05-26 13:46 UTC, Nick Clifton
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Hjalmarsson 2010-05-25 13:51:22 UTC
In a updated binutils git tree:

$ CC="gcc" CFLAGS="-march=native -mtune=native -O2 -pipe -fstack-protector-all"
./configure && make -j10 && make -j10 check

<snip>
Running /home/xake/devel/testcases/binutils/ld/testsuite/ld-elfvsb/elfvsb.exp ...
FAIL: common hidden symbol
FAIL: weak hidden symbol DSO last
FAIL: weak hidden symbol DSO first


However if I try build it with -fstack-protector or -fno-stack-protector all
checks passes fine.

The tests fails because the link command does not link with anything, but
-fstack-protector-all needs the final binary to be linked against libc, else it
will not find all its symbols.
If I add -fno-stack-protector to the CFLAGS in elfvsb.exp it also passes.

However I do not know how to write the code for runtest to make this change in a
portable and reliable way. config/default.exp has a logic to determine if it
uses gcc, should I do a similar check for elfvsb.exp and add
-fno-stack-protector to the end of CFLAGS if gcc is used??
Comment 1 Nick Clifton 2010-05-26 13:46:51 UTC
Created attachment 4815 [details]
demonstration patch
Comment 2 Nick Clifton 2010-05-26 13:49:52 UTC
Hi Peter,

  Well you could modify the default_ld_simple_link in the linker testsuite
library so that it adds the missing symbols.  (See the uploaded patch).  But
this introduces other failures in the testsuite since it pollutes the symbol table.

  You could export the logic from default_ld_simple_link for detecting a gcc
compiler and use it in the elfvsb.exp script to add the missing symbols, or to
turn off stack protection.

Cheers
  Nick
Comment 3 Alan Modra 2023-01-19 12:09:45 UTC
Yes, there are many CFLAGS that perturb the testsuite