Bug 19851 - Binutils fails to build with -O0
Summary: Binutils fails to build with -O0
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: ld (show other bugs)
Version: 2.27
: P2 normal
Target Milestone: 2.27
Assignee: Alan Modra
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-03-21 18:00 UTC by H.J. Lu
Modified: 2016-03-22 13:37 UTC (History)
1 user (show)

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


Attachments
Proposed patch (383 bytes, patch)
2016-03-22 13:07 UTC, Nick Clifton
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description H.J. Lu 2016-03-21 18:00:23 UTC
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I/export/gnu/import/git/sources/binutils-gdb/bfd -I. -I/export/gnu/import/git/sources/binutils-gdb/bfd -I/export/gnu/import/git/sources/binutils-gdb/bfd/../include -DHAVE_x86_64_elf64_vec -DHAVE_i386_elf32_vec -DHAVE_iamcu_elf32_vec -DHAVE_x86_64_elf32_vec -DHAVE_i386_aout_linux_vec -DHAVE_i386_pei_vec -DHAVE_x86_64_pei_vec -DHAVE_l1om_elf64_vec -DHAVE_k1om_elf64_vec -DHAVE_elf64_le_vec -DHAVE_elf64_be_vec -DHAVE_elf32_le_vec -DHAVE_elf32_be_vec -DHAVE_plugin_vec -DBINDIR=\"/usr/local/bin\" -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Werror -Wstack-usage=262144 -g -O0 -MT plugin.lo -MD -MP -MF .deps/plugin.Tpo -c /export/gnu/import/git/sources/binutils-gdb/bfd/plugin.c -o plugin.o
/export/gnu/import/git/sources/binutils-gdb/bfd/plugin.c: In function ‘try_load_plugin’:
/export/gnu/import/git/sources/binutils-gdb/bfd/plugin.c:206:1: error: stack usage might be unbounded [-Werror=stack-usage=]
Comment 1 cvs-commit@gcc.gnu.org 2016-03-22 03:58:19 UTC
The master branch has been updated by Alan Modra <amodra@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=6f4c0a426c653867c40936a9b8f503628adbd64b

commit 6f4c0a426c653867c40936a9b8f503628adbd64b
Author: Alan Modra <amodra@gmail.com>
Date:   Tue Mar 22 14:20:18 2016 +1030

    Binutils fails to build with -O0
    
    	PR 19851
    	* plugin.c (try_load_plugin): Avoid -Wstack-usage warning.
Comment 2 Alan Modra 2016-03-22 04:02:18 UTC
Fixed
Comment 3 Nick Clifton 2016-03-22 09:23:00 UTC
Thanks Alan,

  I thought that this might be the problem, but I could not find a way to reproduce the failure in order to test a fix.

Cheers
  Nick
Comment 4 H.J. Lu 2016-03-22 12:18:43 UTC
Not fixed:

gcc -DHAVE_CONFIG_H -I. -I/export/gnu/import/git/sources/binutils-gdb/binutils  -I. -I/export/gnu/import/git/sources/binutils-gdb/binutils -I../bfd -I/export/gnu/import/git/sources/binutils-gdb/binutils/../bfd -I/export/gnu/import/git/sources/binutils-gdb/binutils/../include -DLOCALEDIR="\"/usr/local/share/locale\"" -Dbin_dummy_emulation=bin_vanilla_emulation  -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wstack-usage=262144 -Werror  -g -O0 -MT dwarf.o -MD -MP -MF .deps/dwarf.Tpo -c -o dwarf.o /export/gnu/import/git/sources/binutils-gdb/binutils/dwarf.c
/export/gnu/import/git/sources/binutils-gdb/binutils/dwarf.c: In function \u2018process_extended_line_op\u2019:
/export/gnu/import/git/sources/binutils-gdb/binutils/dwarf.c:419:1: error: stack usage might be unbounded [-Werror=stack-usage=]
/export/gnu/import/git/sources/binutils-gdb/binutils/dwarf.c: In function \u2018decode_location_expression\u2019:
/export/gnu/import/git/sources/binutils-gdb/binutils/dwarf.c:887:1: error: stack usage might be unbounded [-Werror=stack-usage=]
/export/gnu/import/git/sources/binutils-gdb/binutils/dwarf.c: In function \u2018read_and_display_attr_value\u2019:
/export/gnu/import/git/sources/binutils-gdb/binutils/dwarf.c:1495:1: error: stack usage might be unbounded [-Werror=stack-usage=]
/export/gnu/import/git/sources/binutils-gdb/binutils/dwarf.c: In function \u2018process_debug_info\u2019:
/export/gnu/import/git/sources/binutils-gdb/binutils/dwarf.c:2241:1: error: stack usage might be unbounded [-Werror=stack-usage=]
/export/gnu/import/git/sources/binutils-gdb/binutils/dwarf.c: In function \u2018read_debug_line_header\u2019:
/export/gnu/import/git/sources/binutils-gdb/binutils/dwarf.c:2732:1: error: stack usage might be unbounded [-Werror=stack-usage=]
/export/gnu/import/git/sources/binutils-gdb/binutils/dwarf.c: In function \u2018display_debug_lines_decoded\u2019:
/export/gnu/import/git/sources/binutils-gdb/binutils/dwarf.c:3191:1: error: stack usage might be unbounded [-Werror=stack-usage=]
/export/gnu/import/git/sources/binutils-gdb/binutils/dwarf.c: In function \u2018display_debug_pubnames_worker\u2019:
/export/gnu/import/git/sources/binutils-gdb/binutils/dwarf.c:3715:1: error: stack usage might be unbounded [-Werror=stack-usage=]
/export/gnu/import/git/sources/binutils-gdb/binutils/dwarf.c: In function \u2018display_debug_macro\u2019:
/export/gnu/import/git/sources/binutils-gdb/binutils/dwarf.c:4026:1: error: stack usage might be unbounded [-Werror=stack-usage=]
/export/gnu/import/git/sources/binutils-gdb/binutils/dwarf.c: In function \u2018display_loc_list\u2019:
/export/gnu/import/git/sources/binutils-gdb/binutils/dwarf.c:4342:1: error: stack usage might be unbounded [-Werror=stack-usage=]
/export/gnu/import/git/sources/binutils-gdb/binutils/dwarf.c: In function \u2018display_debug_aranges\u2019:
/export/gnu/import/git/sources/binutils-gdb/binutils/dwarf.c:4855:1: error: stack usage might be unbounded [-Werror=stack-usage=]
/export/gnu/import/git/sources/binutils-gdb/binutils/dwarf.c: In function \u2018display_debug_ranges\u2019:
/export/gnu/import/git/sources/binutils-gdb/binutils/dwarf.c:5104:1: error: stack usage might be unbounded [-Werror=stack-usage=]
/export/gnu/import/git/sources/binutils-gdb/binutils/dwarf.c: In function \u2018display_debug_frames\u2019:
/export/gnu/import/git/sources/binutils-gdb/binutils/dwarf.c:5714:1: error: stack usage might be unbounded [-Werror=stack-usage=]
Comment 5 Nick Clifton 2016-03-22 13:07:19 UTC
Created attachment 9117 [details]
Proposed patch

Hi H.J.

  The compiler that I am using does not generate these warnings, so please could you try out this patch for me and let me know if it works for you.

Cheers
  Nick
Comment 6 H.J. Lu 2016-03-22 13:22:24 UTC
(In reply to Nick Clifton from comment #5)
> Created attachment 9117 [details]
> Proposed patch
> 
> Hi H.J.
> 
>   The compiler that I am using does not generate these warnings, so please
> could you try out this patch for me and let me know if it works for you.
> 

It works with GCC in Fedora 23. Thanks.
Comment 7 cvs-commit@gcc.gnu.org 2016-03-22 13:26:44 UTC
The master branch has been updated by Nick Clifton <nickc@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=34b9f7292f9c75d09c169a293c1f021eb97517ca

commit 34b9f7292f9c75d09c169a293c1f021eb97517ca
Author: Nick Clifton <nickc@redhat.com>
Date:   Tue Mar 22 13:25:22 2016 +0000

    Fix unbounded stack usage warning inside the SAFE_BYTE_GET macro.
    
    	PR 19851
    binutils * dwarf.c (SAFE_BYTE_GET): Replace local dynamic array allocation
    	with run time size check.
Comment 8 Nick Clifton 2016-03-22 13:29:04 UTC
Hi H.J.

  OK - I have checked the patch in.  Are there any more problems, or can this PR be closed now ?

Cheers
  Nick
Comment 9 H.J. Lu 2016-03-22 13:37:54 UTC
Fixed.