[Bug binutils/21057] New: GDB build failure with flex 2.6.3

2017-01-16 Thread pefoley2+sourceware at pefoley dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=21057

Bug ID: 21057
   Summary: GDB build failure with flex 2.6.3
   Product: binutils
   Version: 2.29 (HEAD)
Status: UNCONFIRMED
  Severity: normal
  Priority: P2
 Component: binutils
  Assignee: unassigned at sourceware dot org
  Reporter: pefoley2+sourceware at pefoley dot com
  Target Milestone: ---

Created attachment 9756
  --> https://sourceware.org/bugzilla/attachment.cgi?id=9756=edit
Patch for bug

Building gdb at commit f964e51d90 with flex 2.6.3 and bison 3.0.4 fails with
the below error.
I've attached a patch that allows the compile to succeed, although I'm unclear
whether the compatibility code it removes is still necessary.

g++ -std=gnu++11 -g -O2   -I. -I../../gdb -I../../gdb/common -I../../gdb/config
-DLOCALEDIR="\"/usr/local/share/locale\"" -DHAVE_CONFIG_H
-I../../gdb/../include/opcode -I../../gdb/../opcodes/..
-I../../gdb/../readline/.. -I../../gdb/../zlib -I../bfd -I../../gdb/../bfd
-I../../gdb/../include -I../libdecnumber -I../../gdb/../libdecnumber 
-I../../gdb/gnulib/import -Ibuild-gnulib/import   -DTUI=1 
-I/usr/include/python2.7 -I/usr/include/python2.7 -Wall -Wpointer-arith
-Wno-unused -Wunused-value -Wunused-function -Wno-switch -Wno-char-subscripts
-Wempty-body -Wunused-but-set-parameter -Wunused-but-set-variable
-Wno-sign-compare -Wno-write-strings -Wno-narrowing -Wformat-nonliteral -Werror
`echo " -Wall -Wpointer-arith -Wno-unused -Wunused-value -Wunused-function
-Wno-switch -Wno-char-subscripts -Wempty-body -Wunused-but-set-parameter
-Wunused-but-set-variable -Wno-sign-compare -Wno-write-strings -Wno-narrowing
-Wformat-nonliteral " | sed "s/ -Wold-style-definition /
-Wno-old-style-definition /g"` \
-c -o ada-exp.o -MT ada-exp.o -MMD -MP -MF .deps/ada-exp.Tpo `if test
-f ada-exp.c; then echo ada-exp.c; else echo ../../gdb/ada-exp.c; fi`
In file included from ../../gdb/ada-exp.y:731:0:
ada-lex.c:16:0: error: "yy_create_buffer" redefined [-Werror]

 ^
../../gdb/ada-exp.y:717:0: note: this is the location of the previous
definition
 #define yy_create_buffer ada_yy_create_buffer
 ^
In file included from ../../gdb/ada-exp.y:731:0:
ada-lex.c:18:0: error: "yy_delete_buffer" redefined [-Werror]

 ^
../../gdb/ada-exp.y:718:0: note: this is the location of the previous
definition
 #define yy_delete_buffer ada_yy_delete_buffer
 ^
In file included from ../../gdb/ada-exp.y:731:0:
ada-lex.c:26:0: error: "yy_init_buffer" redefined [-Werror]

 ^
../../gdb/ada-exp.y:719:0: note: this is the location of the previous
definition
 #define yy_init_buffer ada_yy_init_buffer
 ^
In file included from ../../gdb/ada-exp.y:731:0:
ada-lex.c:30:0: error: "yy_load_buffer_state" redefined [-Werror]

 ^
../../gdb/ada-exp.y:720:0: note: this is the location of the previous
definition
 #define yy_load_buffer_state ada_yy_load_buffer_state
 ^
In file included from ../../gdb/ada-exp.y:731:0:
ada-lex.c:32:0: error: "yy_switch_to_buffer" redefined [-Werror]

 ^
../../gdb/ada-exp.y:721:0: note: this is the location of the previous
definition
 #define yy_switch_to_buffer ada_yy_switch_to_buffer
 ^
In file included from ../../gdb/ada-exp.y:731:0:
ada-lex.c:40:0: error: "yylex" redefined [-Werror]

 ^
In file included from ../../gdb/ada-exp.y:56:0:
../../gdb/yy-remap.h:41:0: note: this is the location of the previous
definition
 #define yylex  GDB_YY_REMAP (yylex)
 ^
In file included from ../../gdb/ada-exp.y:731:0:
ada-lex.c:42:0: error: "yyrestart" redefined [-Werror]

 ^
../../gdb/ada-exp.y:722:0: note: this is the location of the previous
definition
 #define yyrestart ada_yyrestart
 ^
In file included from ../../gdb/ada-exp.y:731:0:
ada-lex.c:74:0: error: "yywrap" redefined [-Werror]

 ^
../../gdb/ada-exp.y:724:0: note: this is the location of the previous
definition
 #define yywrap ada_yywrap
 ^
In file included from ../../gdb/ada-exp.y:731:0:
ada-lex.c:82:0: error: "yytext" redefined [-Werror]

 ^
../../gdb/ada-exp.y:723:0: note: this is the location of the previous
definition
 #define yytext ada_yytext
 ^
In file included from ../../gdb/ada-exp.y:56:0:
../../gdb/ada-exp.y:55:29: error: ‘int ada_yylex()’ used but never defined
[-Werror]
 #define GDB_YY_REMAP_PREFIX ada_
 ^
../../gdb/yy-remap.h:35:39: note: in definition of macro ‘GDB_YY_REMAP_2’
 #define GDB_YY_REMAP_2(PREFIX, YYSYM) PREFIX ## YYSYM
   ^
../../gdb/yy-remap.h:37:29: note: in expansion of macro ‘GDB_YY_REMAP_1’
 #define GDB_YY_REMAP(YYSYM) GDB_YY_REMAP_1 (GDB_YY_REMAP_PREFIX, YYSYM)
 ^
../../gdb/yy-remap.h:37:45: note: in expansion of macro ‘GDB_YY_REMAP_PREFIX’
 #define GDB_YY_REMAP(YYSYM) GDB_YY_REMAP_1 (GDB_YY_REMAP_PREFIX, YYSYM)
 ^
../../gdb/yy-remap.h:41:16: note: in expansion of macro ‘GDB_YY_REMAP’
 #define yylex  GDB_YY_REMAP (yylex)
^

"-flto -O2" shouln't opt out "undefined reference" error

2017-01-16 Thread Xuefer
without -flto or without -O2 produce good (expected) result:

configure:5332: checking for dlsym
configure:5369: clang -o conftest -O2 -pipe -march=ivybridge -O2 -pipe
  conftest.c  >&5
/tmp/conftest-597c62.o:conftest.c:function main: error: undefined
reference to 'dlsym'
clang-3.9: error: linker command failed with exit code 1 (use -v to
see invocation)
configure:5372: $? = 1
configure: failed program was:
#line 5338 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char dlsym (); below.  */
#include 
/* Override any gcc2 internal prototype to avoid an error.  */
#ifdef __cplusplus
extern "C"
#endif
/* We use char because int might match the return type of a gcc2
   builtin and then its argument prototype would still apply.  */
char dlsym ();
char (*f) ();

int
main ()
{
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS.  Some functions are actually named
something starting with __ and the normal name is an alias.  */
#if defined (__stub_dlsym) || defined (__stub___dlsym)
choke me
#else
f = dlsym; /* workaround for ICC 12.0.3 */ if (f == 0) return 1;
#endif

  ;
  return 0;
}


 with both -flto and -O2 produce bad result (tested with clang and
gcc), this is reproduced when i build ncurses which have strange
configure script built with many workaround, unlike other configure
script


configure:5332: checking for dlsym
configure:5369: clang -o conftest -flto -O2 -pipe -march=ivybridge -O2
-pipe   conftest.c  >&5
configure:5372: $? = 0
configure:5375: test -s conftest
configure:5378: $? = 0
configure:5388: result: yes


___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug binutils/21056] New: tic6x - erroneous disassembly of parallel instructions

2017-01-16 Thread alexis.deruelle at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=21056

Bug ID: 21056
   Summary: tic6x - erroneous disassembly of parallel instructions
   Product: binutils
   Version: unspecified
Status: UNCONFIRMED
  Severity: normal
  Priority: P2
 Component: binutils
  Assignee: unassigned at sourceware dot org
  Reporter: alexis.deruelle at gmail dot com
  Target Milestone: ---

Created attachment 9755
  --> https://sourceware.org/bugzilla/attachment.cgi?id=9755=edit
Patch and test case

Problem : missing or erroneously marked parallel instruction in disassembly
output.

Instructions can be scheduled in parallel.

Consecutive parallel instructions are called an « execution packet ».

If an instruction has it's parallel bit (p-bit) set, the next instruction
belongs to the same execute packet, denoted by a leading '||'.
The last instruction of an execute packet is the first one with
it's p-bit set to 0.

To correctly display the leading '||', it's necessary to
fetch the previous instruction in order to read the p-bit
value.

Execute packets can cross fetch packet boundary leading to 3 cases :

1/ Fetch packet 1 (FP1) is not header based (i.e. all 32 bit instructions) :

FP1+20  :
FP1+24  word#6  INS1
FP1+28  word#7  ||  INS2

FP2+0   word#0  ||  INS3
:

Instruction INS3 is displayed as parallel if bit 0 of FP1/word#7 is set.

2/ FP1 is header based and word #6 contains two 16 bit instructions.

FP1+20  :
FP1+24  LSB(word#6) INS1
FP1+26  MSB(word#6) ||  INS2
FP1+28  

FP2+0   word#0  ||  INS3
:

Instruction INS3 is displayed as parallel if header's p-bit #13
is set (parallel bit of 16 bits instructions are stored in the header).

3/ FP1 is header based but word #6 contains a single 32 bit instruction

FP1+20  :
FP1+24  word#6  INS1
FP1+28  

FP2+0   word#0  ||  INS2
:

Instruction INS2 is displayed as parallel if bit 0 of word #6 (p-bit) is set.

Cases 1 & 2 are handled correctly while case 3 isn't (defaulted to
case 2), leading to missing or erroneously marked parallel instruction
in disassembly output.

Patch with test-case attached

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/20828] GC-ed DSO symbols make corresponding symbols defined by a linker script local

2017-01-16 Thread ma...@linux-mips.org
https://sourceware.org/bugzilla/show_bug.cgi?id=20828

Maciej W. Rozycki  changed:

   What|Removed |Added

Summary|[MIPS] produces invalid |GC-ed DSO symbols make
   |dynamic symbol table when   |corresponding symbols
   |--gc-sections is used since |defined by a linker script
   |PR ld/13177 fix |local

--- Comment #17 from Maciej W. Rozycki  ---
I've got down to the bottom of this issue now and as it turns out our
initial understanding was completely wrong.

The real issue is the presence of unused (and GC-ed) symbols in a DSO
used in a link makes identically named symbols ordinarily defined (not
hidden or PROVIDEd) by a linker script local, even though the latter
symbols are supposed to be global as if no DSO defined them as well.  So
rather than removing the local entries made in the dynamic symbol table
produced we actually need to make them global.  See
 for the full
analysis, proposed patch, test cases and results.

The issue applies to our all ELF targets with DSO support and the outcome
just happens to hurt MIPS binaries in the most spectacular way, due to
this target psABI's peculiarity and our handling of it, by making any
affected binaries produced invalid, in addition to being incorrect as
with the remaining ELF targets.

Regardless I have made a MIPS dynamic symbol table sorting update in case
we have a valid reason sometime to have (non-section) local entries
there.  This turned out simpler than I had thought as by the time
`mips_elf_sort_hash_table' is called all the necessary information has
already been gathered by the generic ELF linker and the MIPS backend, as
applicable.  So all that has to be done is using it properly to assign
final indices.

With the fix for this issue in place the problematic case of dynamic
symbol table sorting cannot be triggered however, so no test case is
possible, and I will be only pushing the sorting change, along with a
couple of preparatory clean-ups to code affected, to our master branch,
with no backport to 2.28 planned.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug gold/21054] [MIPS] Forced local symbol rearranging messes up GOT

2017-01-16 Thread aurelien at aurel32 dot net
https://sourceware.org/bugzilla/show_bug.cgi?id=21054

Aurelien Jarno  changed:

   What|Removed |Added

 CC||aurelien at aurel32 dot net

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug gold/21054] New: [MIPS] Forced local symbol rearranging messes up GOT

2017-01-16 Thread james410 at cowgill dot org.uk
https://sourceware.org/bugzilla/show_bug.cgi?id=21054

Bug ID: 21054
   Summary: [MIPS] Forced local symbol rearranging messes up GOT
   Product: binutils
   Version: 2.29 (HEAD)
Status: UNCONFIRMED
  Severity: normal
  Priority: P2
 Component: gold
  Assignee: ccoutant at gmail dot com
  Reporter: james410 at cowgill dot org.uk
CC: ian at airs dot com
  Target Milestone: ---

Created attachment 9754
  --> https://sourceware.org/bugzilla/attachment.cgi?id=9754=edit
gold-mips-forced-local.c

Originally this systemd bug in Debian:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=851412

The attached testcase immediately segfaults when run after being compiled by
gold on mips. It works fine when the bfd linker is used.

Compile with:
gcc -Wl,-version-script=blank.ver -fuse-ld=gold gold-mips-forced-local.c

With blank.ver hiding all symbols:
{
local:
*;
};

The segfault occurs in __start when it tries to call __libc_start_main. It
instead calls a NULL pointer. Looking in GDB the GOT has definitely been
initialized but the pointer to __libc_start_main occurs 8 bytes (2 words)
before the GOT entry actually accessed in __start.

In Debian, the bug manifested in any executable which loaded libsystemd.so by
segfaulting on exit. The segfault occured in __do_global_dtors_aux when it
tried to call __cxa_finalize but instead called some other random function from
libsystemd.

Aurélien Jarno bisected this bug to commit
c4d5a76223f74930add9014f2a77339eb80b737c:
Author: Cary Coutant 
Date:   Thu Dec 22 14:06:24 2016 -0800

Fix placement of forced local symbols in the dynamic symbol table.

Gold was not placing forced-local symbols (e.g., hidden visibility)
at the front of the dynamic symbol table, or including them in the
count of local symbols recorded in the .dynsym section's sh_info field.

In my testcase I expect the __start_ASECTION and __stop_ASECTION symbols are
forced local and were affected by this (also fits the GOT being offset by 2
words). On MIPS they will require GOT entries as they are used by num_ptrs, but
presumably moving them around the dynamic symbol table screwed the GOT up on
MIPS. I know that on MIPS, the dynamic symbol table is used as an index into
the GOT but I don't have a lot of in depth knowledge on it.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug binutils/20755] readelf: DWARF-5 support

2017-01-16 Thread vleschuk at accesssoftek dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=20755

Victor Leschuk  changed:

   What|Removed |Added

 CC||vleschuk at accesssoftek dot 
com

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils