[PATCH 1/2] x86: Support Intel IBT with IBT property and IBT-enable PLT

H.J. Lu hjl.tools@gmail.com
Thu Jun 22 21:31:00 GMT 2017


On Thu, Jun 22, 2017 at 1:52 PM, Simon Marchi <simon.marchi@ericsson.com> wrote:
> Hi,
>
> clang shows this warning for the code added by this patch.  I am not familiar with this
> code, but it seems to me like it's not a false positive.
>
> /home/emaisin/src/binutils-gdb/bfd/elf64-x86-64.c:7408:8: error: variable 'htab' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
>           if (!bfd_set_section_alignment (ebfd, sec, 2))
>               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> /home/emaisin/src/binutils-gdb/bfd/elf64-x86-64.c:7574:9: note: uninitialized use occurs here
>   sec = htab->elf.sgotplt;
>         ^~~~
> /home/emaisin/src/binutils-gdb/bfd/elf64-x86-64.c:7408:4: note: remove the 'if' if its condition is always false
>           if (!bfd_set_section_alignment (ebfd, sec, 2))
>           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> /home/emaisin/src/binutils-gdb/bfd/elf64-x86-64.c:7351:42: note: initialize the variable 'htab' to silence this warning
>   struct elf_x86_64_link_hash_table *htab;
>                                          ^
>                                           = NULL
> /home/emaisin/src/binutils-gdb/bfd/elf64-x86-64.c:7408:8: error: variable 'dynobj' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
>           if (!bfd_set_section_alignment (ebfd, sec, 2))
>               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> /home/emaisin/src/binutils-gdb/bfd/elf64-x86-64.c:7575:35: note: uninitialized use occurs here
>   if (!bfd_set_section_alignment (dynobj, sec, 3))
>                                   ^~~~~~
> /home/emaisin/src/binutils-gdb/bfd/elf64-x86-64.c:7408:4: note: remove the 'if' if its condition is always false
>           if (!bfd_set_section_alignment (ebfd, sec, 2))
>           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> /home/emaisin/src/binutils-gdb/bfd/elf64-x86-64.c:7348:14: note: initialize the variable 'dynobj' to silence this warning
>   bfd *dynobj;
>              ^
>               = NULL
>

I checked in this patch to silence clang.

Thanks.

-- 
H.J.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-x86-64-Move-the-error_alignment-label-forward.patch
Type: text/x-patch
Size: 2502 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20170622/1b6a40e5/attachment.bin>


More information about the Binutils mailing list