[Bug binutils/20063] Segmentation fault on objdump -D (with invalid SHT_GROUP entry)

2016-05-10 Thread paulwebsec at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=20063

--- Comment #3 from PaulSec  ---
Thanks for the patch. 

Would it be possible to get notified when this is going to be pushed in a
release or anything so I can try it with couple of other crashes I have (with
the invalid SHT_GROUP entry again) 

Best,

-- 
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/20022] --gc-sections is broken with __start_ and shared library

2016-05-10 Thread nickc at redhat dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=20022

--- Comment #5 from Nick Clifton  ---
(In reply to H.J. Lu from comment #4)

> Somewhere in _bfd_elf_is_start_stop?

I don't think that will work.  We only want to trigger if an orphan section
is being referenced solely via its start/stop symbols, and I don't think that
we can determine this in _bfd_elf_is_start_stop.

Still if you have a potential patch to suggest I would be happy to take a look.

I think that the patch should produce a warning/error message, rather than an
abort however, since the user is not doing anything wrong.

Cheers
  Nick

-- 
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 gas/20067] New: GAS generates an illegal instruction for the 'FLD' pseudo instruction

2016-05-10 Thread chuazl at comp dot nus.edu.sg
https://sourceware.org/bugzilla/show_bug.cgi?id=20067

Bug ID: 20067
   Summary: GAS generates an illegal instruction for the 'FLD'
pseudo instruction
   Product: binutils
   Version: 2.27 (HEAD)
Status: NEW
  Severity: normal
  Priority: P2
 Component: gas
  Assignee: unassigned at sourceware dot org
  Reporter: chuazl at comp dot nus.edu.sg
  Target Milestone: ---

Processor : Marvell PJ4Bv7 Processor rev 2 (v7l)
Features : swp half thumb fastmult vfp edsp vfpv3 tls 
CPU implementer : 0x56
CPU architecture: 7
CPU variant : 0x2
CPU part : 0x584
CPU revision : 2

Assembling 'FLDD D11, =0' with -mfpu=vfpv3 produces 'VMOV.I64 D11, #0'.
Executing it on the CPU results in an illegal operation.

VMOV (Immediate) VMOV.I64 is a NEON instruction and specifying -mfpu=vfpv3
specifies that the coprocessor does not support NEON, however GAS still emits
the vmov.i64 instruction.

Details:
md assembled is called with the following arguments: md_assemble (str=0x162982
"fldd D11,=0")
opcode now contains the result of opcode_lookup("fldd D11, =0)
*Note, this will pass all the constraint test since the requirements of 'fldd'
is just vfp
aencode of opcode is called which is actually do_vfp_dp_ldst().
do_vfp_dp_ldst() calls encode_arm_cp_address() which in turn calls
move_or_literal_pool().
This is where the problem occurs, neon_cmode_for_move_imm() is called if the
type is a CONST_VEC without any checks for NEON support which results in the
VMOV.I64 instruction to be generated.

Workaround patch:
As a workaround, I've added in the feature check in the else if statement, if
the fpu doesn't support NEON, use the default literal-pool load, not sure of
the correctness.

-- 
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 gas/20067] GAS generates an illegal instruction for the 'FLD' pseudo instruction

2016-05-10 Thread chuazl at comp dot nus.edu.sg
https://sourceware.org/bugzilla/show_bug.cgi?id=20067

--- Comment #1 from Chua Zheng Leong  ---
Created attachment 9247
  --> https://sourceware.org/bugzilla/attachment.cgi?id=9247&action=edit
As a workaround, I've added in the feature check in the else if statement, if
the fpu doesn't support NEON, use the default literal-pool load, not sure of
the correctness.

-- 
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 gas/20068] New: GAS complains about ‘Error: floating point number invalid‘ when producing a literal pool.

2016-05-10 Thread chuazl at comp dot nus.edu.sg
https://sourceware.org/bugzilla/show_bug.cgi?id=20068

Bug ID: 20068
   Summary: GAS complains about ‘Error: floating point number
invalid‘ when producing a literal pool.
   Product: binutils
   Version: 2.27 (HEAD)
Status: NEW
  Severity: normal
  Priority: P2
 Component: gas
  Assignee: unassigned at sourceware dot org
  Reporter: chuazl at comp dot nus.edu.sg
  Target Milestone: ---

Created attachment 9248
  --> https://sourceware.org/bugzilla/attachment.cgi?id=9248&action=edit
Change the type of padding to O_constant

Assembling the following ARM assembly will result in gas complaining:
LDR R0, =0x12345678
FLDD D9, =0xfff00fff
.LTORG
‘Error: floating point number invalid‘

Adding an additional 4 bytes into the literal pool will cause GAS to assemble
without any errors.
LDR R0, =0x12345678
LDR R0, =0x87654321
FLDD D9, =0xfff00fff
.LTORG

Debugging GAS reveals that the error is generated from emit_expr_with_reloc(),
more specifically, it fails this test : 
if (op == O_big && exp->X_add_number <= 0)

Digging further, this expression is generated due to alignment for a 8 byte
long literal being added to the pool, more specifically in add_to_lit_pool().
If the pool is not 8 byte aligned and a 8 byte literal is added to the pool, a
4 byte pad will be generated with the following code.

<...>
else if (pool_size & 0x7)
{
  <> 
  pool->literals[entry] = inst.reloc.exp;
  pool->literals[entry].X_add_number = 0;
  pool->literals[entry++].X_md = (PADDING_SLOT << 8) | 4;
  pool->next_free_entry += 1;
  pool_size += 4;
}

Since the current exp is of type O_big, the padding expression will be of type
O_big with X_add_number = 0 failing the above test.

Workaround patch:
Change the type of the padding to O_constant. Again, not too sure about the
correctness.

-- 
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/20070] New: LLVM gold plugin(LLVMgold.so) report Unexpected resolution failure on ld when LTO, but pass on gold

2016-05-10 Thread steven.shi at intel dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=20070

Bug ID: 20070
   Summary: LLVM gold plugin(LLVMgold.so) report Unexpected
resolution failure on ld when LTO, but pass on gold
   Product: binutils
   Version: 2.26
Status: NEW
  Severity: critical
  Priority: P2
 Component: ld
  Assignee: unassigned at sourceware dot org
  Reporter: steven.shi at intel dot com
  Target Milestone: ---

Created attachment 9249
  --> https://sourceware.org/bugzilla/attachment.cgi?id=9249&action=edit
testcase to reproduce LLVMgold.so Unexpected resolution failure on ld

I'm enabling clang LTO feature to to improve code size of Uefi standard
(http://www.uefi.org/) firmware (https://github.com/tianocore/edk2). My project
is in https://github.com/shijunjing/edk2 branch llvm :
https://github.com/shijunjing/edk2/tree/llvm.

I find ld in binutils 2.26 cannot co-work correctly with LLVM gold plugin
(LLVMgold.so), and the LLVM gold plugin will report unexpected resolution
failure as below when ld do the optimization. But this failure will not happen
on gold.

Unexpected resolution
UNREACHABLE executed at
/home/jshi19/llvm-3.8.0.src/tools/gold/gold-plugin.cpp:679!


Below is the steps on how to setup clang compiler and reproduce the clang LTO
link failure:

1. Download and extract the llvm 3.8.0 Pre-Built Binaries from
http://www.llvm.org/releases/ (e.g.
http://www.llvm.org/releases/3.8.0/clang+llvm-3.8.0-x86_64-linux-gnu-ubuntu-16.04.tar.xz
and extract it as ~/clang38).
2. Decompress and rename the debug version LLVM gold plugin in
https://github.com/shijunjing/edk2/blob/llvm/BaseTools/Bin/LLVMgold-debug.tar.gz
as LLVMgold.so. Copy it to above clang lib folder (e.g.
~/clang38/lib/LLVMgold.so)
3. Copy GNU Binutils 2.26 linker ld to /usr/bin/ld
4. run below clang LTO link command:

~/clang38/bin/clang -o Hello.dll -flto -nostdlib -Wl,-n -Wl,-q
-Wl,--gc-sections -Wl,-z,common-page-size=0x40 -Wl,--entry,_ModuleEntryPoint
-Wl,-u,_ModuleEntryPoint -Wl,-Map,Hello.map -Wl,-melf_x86_64
-Wl,--oformat=elf64-x86-64 -Wl,--start-group,,@static_library_files.lst
-Wl,--end-group

ld 2.26 fail in gold plugin optimization with below output:
steven: getModuleForFile pass
Unexpected resolution
UNREACHABLE executed at
/home/jshi19/llvm-3.8.0.src/tools/gold/gold-plugin.cpp:679!
clang-3.8: error: unable to execute command: Aborted (core dumped)
clang-3.8: error: linker command failed due to signal (use -v to see
invocation)

5. Copy GNU Binutils 2.26 gold linker ld-new to /usr/bin/ld
6. re-run step 4 clang LTO link command again:

~/clang38/bin/clang -o Hello.dll -flto -nostdlib -Wl,-n -Wl,-q
-Wl,--gc-sections -Wl,-z,common-page-size=0x40 -Wl,--entry,_ModuleEntryPoint
-Wl,-u,_ModuleEntryPoint -Wl,-Map,Hello.map -Wl,-melf_x86_64
-Wl,--oformat=elf64-x86-64 -Wl,--start-group,,@static_library_files.lst
-Wl,--end-group


gold pass gold plugin optimization with below output:
steven: getModuleForFile pass
steven: getModuleForFile pass
steven: getModuleForFile pass
steven: getModuleForFile pass
steven: getModuleForFile pass
steven: getModuleForFile pass
steven: getModuleForFile pass
steven: getModuleForFile pass
steven: getModuleForFile pass
steven: getModuleForFile pass
steven: getModuleForFile pass
steven: getModuleForFile pass
steven: getModuleForFile pass
steven: getModuleForFile pass
steven: getModuleForFile pass
steven: getModuleForFile pass
steven: getModuleForFile pass
steven: getModuleForFile pass
steven: getModuleForFile pass
steven: getModuleForFile pass
steven: getModuleForFile pass
steven: getModuleForFile pass
steven: getModuleForFile pass
steven: getModuleForFile pass
steven: getModuleForFile pass
/usr/bin/ld: internal error in do_layout, at
../../binutils-2.26/gold/object.cc:1819
clang-3.8: error: linker command failed with exit code 1 (use -v to see
invocation)
Above gold do_layout issue is a known bug which is not related LLVM LTO, and
has been tracked in Bug 20062
https://sourceware.org/bugzilla/show_bug.cgi?id=20062

The "steven: getModuleForFile pass" is debug message I especially added in the
debug version LLVMgold.so, which is line 905 in
llvm-3.8.0.src\tools\gold\gold-plugin.cpp. I have a gold-plugin.cpp copy in
this folder.



This folder example libraries are abstracted from Uefi Hello module. You can
build them by yourself from https://github.com/shijunjing/edk2/tree/llvm

0. Download and extract the llvm 3.8.0 Pre-Built Binaries from
http://www.llvm.org/releases/ (e.g.
http://www.llvm.org/releases/3.8.0/clang+llvm-3.8.0-x86_64-linux-gnu-ubuntu-16.04.tar.xz
and extract it as ~/clang38).
0. Decompress and rename the debug version LLVM gold plugin in
https://github.com/shijunjing/edk2/blob/llvm/BaseTools/Bin/LLVMgold-debug.tar.gz
as LLVMgold.so. Copy it to above clang lib folder (e.g.
~/clang38/lib/LLVMgold.so)
1. Setup EDK2 build environment as steps in the link:
https://github.com/tianocore/tianocore.github.io/wiki/Using-EDK-II-

[Bug ld/20070] LLVM gold plugin(LLVMgold.so) report Unexpected resolution failure on ld when LTO, but pass on gold

2016-05-10 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=20070

H.J. Lu  changed:

   What|Removed |Added

 CC||hjl.tools at gmail 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