Bug 31134 - 2.41: build fails with --disable-warn-execstack
Summary: 2.41: build fails with --disable-warn-execstack
Status: UNCONFIRMED
Alias: None
Product: binutils
Classification: Unclassified
Component: ld (show other bugs)
Version: 2.41
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-12-10 21:06 UTC by kloczek
Modified: 2023-12-11 14:15 UTC (History)
1 user (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description kloczek 2023-12-10 21:06:54 UTC
Looks like ld build fails when source tree is configured with --enable-warn-execstack

make[4]: Entering directory '/home/tkloczko/rpmbuild/BUILD/binutils-2.41/ld'
/usr/bin/gcc -DHAVE_CONFIG_H -I.  -I. -I. -I../bfd -I./../bfd -I./../include  -O2 -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fdata-sections -ffunction-sections     -DLOCALEDIR="\"/usr/share/locale\""  -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wstack-usage=262144 -DELF_LIST_OPTIONS=true -DELF_SHLIB_LIST_OPTIONS=true -DELF_PLT_UNWIND_LIST_OPTIONS=true   -O2 -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fdata-sections -ffunction-sections     -c -o eelf_x86_64.o eelf_x86_64.c
eelf_x86_64.c: In function ‘gldelf_x86_64_before_parse’:
eelf_x86_64.c:91:31: error: ‘DEFAULT_LD_ERROR_EXECSTACK’ undeclared (first use in this function); did you mean ‘DEFAULT_LD_WARN_EXECSTACK’?
   91 |   link_info.error_execstack = DEFAULT_LD_ERROR_EXECSTACK;
      |                               ^~~~~~~~~~~~~~~~~~~~~~~~~~
      |                               DEFAULT_LD_WARN_EXECSTACK
eelf_x86_64.c:91:31: note: each undeclared identifier is reported only once for each function it appears in
eelf_x86_64.c:92:46: error: ‘DEFAULT_LD_ERROR_RWX_SEGMENTS’ undeclared (first use in this function); did you mean ‘DEFAULT_LD_WARN_RWX_SEGMENTS’?
   92 |   link_info.warn_is_error_for_rwx_segments = DEFAULT_LD_ERROR_RWX_SEGMENTS;
      |                                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                              DEFAULT_LD_WARN_RWX_SEGMENTS
make[4]: *** [Makefile:1599: eelf_x86_64.o] Error 1
Comment 1 kloczek 2023-12-10 23:16:09 UTC
Looks like DEFAULT_LD_ERROR_EXECSTACK is defined only when --disable-error-rwx-segments is used.

[tkloczko@pers-jacek ld]$ grep -r DEFAULT_LD_ERROR_EXECSTACK
emultempl/elf.em:  link_info.error_execstack = DEFAULT_LD_ERROR_EXECSTACK;
config.in:#undef DEFAULT_LD_ERROR_EXECSTACK
configure.ac:AC_DEFINE_UNQUOTED(DEFAULT_LD_ERROR_EXECSTACK,
config.h:/* #undef DEFAULT_LD_ERROR_EXECSTACK */
eelf_iamcu.c:  link_info.error_execstack = DEFAULT_LD_ERROR_EXECSTACK;
eelf_i386.c:  link_info.error_execstack = DEFAULT_LD_ERROR_EXECSTACK;
eelf32_x86_64.c:  link_info.error_execstack = DEFAULT_LD_ERROR_EXECSTACK;
eelf_x86_64.c:  link_info.error_execstack = DEFAULT_LD_ERROR_EXECSTACK;
Comment 2 kloczek 2023-12-10 23:18:29 UTC
Correction when --enaable-warn-execstack
Comment 3 Nick Clifton 2023-12-11 14:15:10 UTC
Hi Kloczek,

  Sorry - I am unable to reproduce this problem.  Can you show the entire configure command line that you used ?

Cheers
  Nick