<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/binutils-gdb.git, branch hjl/gpoff-backup</title>
<subtitle>sourceware.org: git/binutils-gdb.git
</subtitle>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/binutils-gdb.git/'/>
<entry>
<title>x86: Add R_X86_64_GPOFF/R_386_GPOFF relocation</title>
<updated>2017-08-11T16:51:20+00:00</updated>
<author>
<name>H.J. Lu</name>
<email>hjl.tools@gmail.com</email>
</author>
<published>2017-08-03T16:43:28+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/binutils-gdb.git/commit/?id=8a03433660ddfa653228b57ae8d93c03e9a3f02b'/>
<id>8a03433660ddfa653228b57ae8d93c03e9a3f02b</id>
<content type='text'>
On x86, a segment register is used as thread pointer to access thread
local storage (TLS) with __thread.  TLS is an OS-dependent, user-space
feature.

Here is a proposal to add R_X86_64_GPOFF/R_386_GPOFF relocation to
access symbol with an offset to global pointer, __gp.  The assembly
syntax is

1. Load value of foo relative to __gp, pointed by %seg, into %reg:

	op %seg:foo@GPOFF, %reg

2. Store value in %reg to foo relative to __gp, pointed by %seg:

	op %reg, %seg:foo@GPOFF

3. Compute offset of foo to __gp:

	lea foo@GPOFF, %reg
	.long foo@GPOFF

Linker sets __gp to the middle of the section which contains definitions
of symbols with GPOFF relocations and the maximum offset is [-2G, 2G).
Run-time must initialize the segment register, %seg, with the address of
global pointer, __gp.

bfd/

	* elf32-i386.c (elf_howto_table): Add R_386_GPOFF.
	(R_386_ext2): Replace R_386_GOT32X with R_386_GPOFF.
	(elf_i386_reloc_type_lookup): Support BFD_RELOC_GPREL32.
	(elf_i386_link_hash_entry): Add has_gpoff_reloc.
	(elf_i386_link_hash_table): Add gp.
	(elf_i386_link_hash_newfunc): Initialize has_gpoff_reloc to 0.
	(elf_i386_copy_indirect_symbol): Also copy has_gpoff_reloc.
	(elf_i386_check_relocs): Add a fake local symbol and set
	has_gpoff_reloc for GPOFF relocation.
	(elf_i386_allocate_local_dynrelocs): Skip local symbol with
	GPOFF relocation.
	(elf_i386_finish_local_dynamic_symbol): Likewise.
	(elf_i386_relocate_section): Process GPOFF relocation.
	(elf_i386_link_check_relocs): Cache and hide __gp symbol.
	(elf_i386_setup_gp): New function.
	(elf_i386_setup_gp_from_local_symbol): Likewise.
	(elf_i386_final_link): Likewise.
	(bfd_elf32_bfd_final_link): New.
	* elf64-x86-64.c (elf_howto_table): Add R_X86_64_GPOFF.
	(R_X86_64_standard): Replace R_X86_64_REX_GOTPCRELX with
	R_X86_64_GPOFF.
	(x86_64_reloc_map): Add BFD_RELOC_GPREL32.
	(elf_x86_64_link_hash_entry): Add has_gpoff_reloc.
	(elf_x86_64_link_hash_table): Add gp.
	(elf_x86_64_link_hash_newfunc): Initialize has_gpoff_reloc to 0.
	(elf_x86_64_copy_indirect_symbol): Also copy has_gpoff_reloc.
	(elf_x86_64_check_relocs): Add a fake local symbol and set
	has_gpoff_reloc for GPOFF relocation.
	(elf_x86_64_allocate_local_dynrelocs): Skip local symbol with
	GPOFF relocation.
	(elf_x86_64_finish_local_dynamic_symbol): Likewise.
	(elf_x86_64_relocate_section): Process GPOFF relocation.
	(elf_x86_64_link_check_relocs): Cache and hide __gp symbol.
	(elf_x86_64_setup_gp): New function.
	(elf_x86_64_setup_gp_from_local_symbol): Likewise.
	(elf_x86_64_final_link): Likewise.
	(bfd_elf64_bfd_final_link): New.
	(bfd_elf32_bfd_final_link): Likewise.

gas/

	* config/tc-i386.c (GP_symbol): New.
	(gotrel): Add "GPOFF".
	(lex_got): Support BFD_RELOC_GPREL32.
	(i386_displacement): Disallow BFD_RELOC_GPREL32 relocation
	with base or index registers.
	(md_undefined_symbol): Create GP_symbol if needed.
	(tc_gen_reloc): Handle BFD_RELOC_GPREL32.
	* config/tc-i386.h (GLOBAL_POINTER_NAME): New.
	* testsuite/gas/i386/gpoff.d: New file.
	* testsuite/gas/i386/gpoff.s: Likewise.
	* testsuite/gas/i386/inval-gpoff.l: Likewise.
	* testsuite/gas/i386/inval-gpoff.s: Likewise.
	* testsuite/gas/i386/x86-64-gpoff.d: Likewise.
	* testsuite/gas/i386/x86-64-gpoff.s: Likewise.
	* testsuite/gas/i386/x86-64-inval-gpoff.l: Likewise.
	* testsuite/gas/i386/x86-64-inval-gpoff.s: Likewise.
	* testsuite/gas/i386/i386.exp: Run gpoff, inval-gpoff,
	x86-64-gpoff and x86-64-inval-gpoff.

include/

	* elf/i386.h (R_386_GPOFF): New relocation.
	* elf/x86-64.h (R_X86_64_GPOFF): Likewise.

ld/

	* testsuite/ld-i386/gpoff-1a.S: New file.
	* testsuite/ld-i386/gpoff-1b.c: Likewise.
	* testsuite/ld-i386/gpoff-2a.S: Likewise.
	* testsuite/ld-i386/gpoff-2b.c: Likewise.
	* testsuite/ld-i386/gpoff-3.d: Likewise.
	* testsuite/ld-i386/gpoff-3.s: Likewise.
	* testsuite/ld-i386/gpoff-4.d: Likewise.
	* testsuite/ld-i386/gpoff-4.s: Likewise.
	* testsuite/ld-i386/gpoff-5.d: Likewise.
	* testsuite/ld-i386/gpoff-5.s: Likewise.
	* testsuite/ld-i386/gpoff-6.d: Likewise.
	* testsuite/ld-i386/gpoff-6.s: Likewise.
	* testsuite/ld-i386/gpoff-7.d: Likewise.
	* testsuite/ld-i386/gpoff-7.s: Likewise.
	* testsuite/ld-i386/gpoff-8.s: Likewise.
	* testsuite/ld-i386/gpoff-8.t: Likewise.
	* testsuite/ld-i386/gpoff-8a.d: Likewise.
	* testsuite/ld-i386/gpoff-8b.d: Likewise.
	* testsuite/ld-i386/gpoff-8c.d: Likewise.
	* testsuite/ld-i386/gpoff-8d.d: Likewise.
	* testsuite/ld-i386/gpoff-8e.d: Likewise.
	* testsuite/ld-i386/gpoff-8f.d: Likewise.
	* testsuite/ld-x86-64/gpoff-1a.S: Likewise.
	* testsuite/ld-x86-64/gpoff-1b.c: Likewise.
	* testsuite/ld-x86-64/gpoff-2a.S: Likewise.
	* testsuite/ld-x86-64/gpoff-2b.c: Likewise.
	* testsuite/ld-x86-64/gpoff-3.d: Likewise.
	* testsuite/ld-x86-64/gpoff-3.s: Likewise.
	* testsuite/ld-x86-64/gpoff-4.d: Likewise.
	* testsuite/ld-x86-64/gpoff-4.s: Likewise.
	* testsuite/ld-x86-64/gpoff-5.d: Likewise.
	* testsuite/ld-x86-64/gpoff-5.s: Likewise.
	* testsuite/ld-x86-64/gpoff-6.d: Likewise.
	* testsuite/ld-x86-64/gpoff-6.s: Likewise.
	* testsuite/ld-x86-64/gpoff-7.d: Likewise.
	* testsuite/ld-x86-64/gpoff-7.s: Likewise.
	* testsuite/ld-x86-64/gpoff-8.s: Likewise.
	* testsuite/ld-x86-64/gpoff-8.t: Likewise.
	* testsuite/ld-x86-64/gpoff-8a.d: Likewise.
	* testsuite/ld-x86-64/gpoff-8b.d: Likewise.
	* testsuite/ld-x86-64/gpoff-8c.d: Likewise.
	* testsuite/ld-x86-64/gpoff-8d.d: Likewise.
	* testsuite/ld-x86-64/gpoff-8e.d: Likewise.
	* testsuite/ld-x86-64/gpoff-8f.d: Likewise.
	* testsuite/ld-i386/i386.exp: Run R_386_GPOFF tests.
	* testsuite/ld-x86-64/x86-64.exp: Run R_X86_64_GPOFF tests.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
On x86, a segment register is used as thread pointer to access thread
local storage (TLS) with __thread.  TLS is an OS-dependent, user-space
feature.

Here is a proposal to add R_X86_64_GPOFF/R_386_GPOFF relocation to
access symbol with an offset to global pointer, __gp.  The assembly
syntax is

1. Load value of foo relative to __gp, pointed by %seg, into %reg:

	op %seg:foo@GPOFF, %reg

2. Store value in %reg to foo relative to __gp, pointed by %seg:

	op %reg, %seg:foo@GPOFF

3. Compute offset of foo to __gp:

	lea foo@GPOFF, %reg
	.long foo@GPOFF

Linker sets __gp to the middle of the section which contains definitions
of symbols with GPOFF relocations and the maximum offset is [-2G, 2G).
Run-time must initialize the segment register, %seg, with the address of
global pointer, __gp.

bfd/

	* elf32-i386.c (elf_howto_table): Add R_386_GPOFF.
	(R_386_ext2): Replace R_386_GOT32X with R_386_GPOFF.
	(elf_i386_reloc_type_lookup): Support BFD_RELOC_GPREL32.
	(elf_i386_link_hash_entry): Add has_gpoff_reloc.
	(elf_i386_link_hash_table): Add gp.
	(elf_i386_link_hash_newfunc): Initialize has_gpoff_reloc to 0.
	(elf_i386_copy_indirect_symbol): Also copy has_gpoff_reloc.
	(elf_i386_check_relocs): Add a fake local symbol and set
	has_gpoff_reloc for GPOFF relocation.
	(elf_i386_allocate_local_dynrelocs): Skip local symbol with
	GPOFF relocation.
	(elf_i386_finish_local_dynamic_symbol): Likewise.
	(elf_i386_relocate_section): Process GPOFF relocation.
	(elf_i386_link_check_relocs): Cache and hide __gp symbol.
	(elf_i386_setup_gp): New function.
	(elf_i386_setup_gp_from_local_symbol): Likewise.
	(elf_i386_final_link): Likewise.
	(bfd_elf32_bfd_final_link): New.
	* elf64-x86-64.c (elf_howto_table): Add R_X86_64_GPOFF.
	(R_X86_64_standard): Replace R_X86_64_REX_GOTPCRELX with
	R_X86_64_GPOFF.
	(x86_64_reloc_map): Add BFD_RELOC_GPREL32.
	(elf_x86_64_link_hash_entry): Add has_gpoff_reloc.
	(elf_x86_64_link_hash_table): Add gp.
	(elf_x86_64_link_hash_newfunc): Initialize has_gpoff_reloc to 0.
	(elf_x86_64_copy_indirect_symbol): Also copy has_gpoff_reloc.
	(elf_x86_64_check_relocs): Add a fake local symbol and set
	has_gpoff_reloc for GPOFF relocation.
	(elf_x86_64_allocate_local_dynrelocs): Skip local symbol with
	GPOFF relocation.
	(elf_x86_64_finish_local_dynamic_symbol): Likewise.
	(elf_x86_64_relocate_section): Process GPOFF relocation.
	(elf_x86_64_link_check_relocs): Cache and hide __gp symbol.
	(elf_x86_64_setup_gp): New function.
	(elf_x86_64_setup_gp_from_local_symbol): Likewise.
	(elf_x86_64_final_link): Likewise.
	(bfd_elf64_bfd_final_link): New.
	(bfd_elf32_bfd_final_link): Likewise.

gas/

	* config/tc-i386.c (GP_symbol): New.
	(gotrel): Add "GPOFF".
	(lex_got): Support BFD_RELOC_GPREL32.
	(i386_displacement): Disallow BFD_RELOC_GPREL32 relocation
	with base or index registers.
	(md_undefined_symbol): Create GP_symbol if needed.
	(tc_gen_reloc): Handle BFD_RELOC_GPREL32.
	* config/tc-i386.h (GLOBAL_POINTER_NAME): New.
	* testsuite/gas/i386/gpoff.d: New file.
	* testsuite/gas/i386/gpoff.s: Likewise.
	* testsuite/gas/i386/inval-gpoff.l: Likewise.
	* testsuite/gas/i386/inval-gpoff.s: Likewise.
	* testsuite/gas/i386/x86-64-gpoff.d: Likewise.
	* testsuite/gas/i386/x86-64-gpoff.s: Likewise.
	* testsuite/gas/i386/x86-64-inval-gpoff.l: Likewise.
	* testsuite/gas/i386/x86-64-inval-gpoff.s: Likewise.
	* testsuite/gas/i386/i386.exp: Run gpoff, inval-gpoff,
	x86-64-gpoff and x86-64-inval-gpoff.

include/

	* elf/i386.h (R_386_GPOFF): New relocation.
	* elf/x86-64.h (R_X86_64_GPOFF): Likewise.

ld/

	* testsuite/ld-i386/gpoff-1a.S: New file.
	* testsuite/ld-i386/gpoff-1b.c: Likewise.
	* testsuite/ld-i386/gpoff-2a.S: Likewise.
	* testsuite/ld-i386/gpoff-2b.c: Likewise.
	* testsuite/ld-i386/gpoff-3.d: Likewise.
	* testsuite/ld-i386/gpoff-3.s: Likewise.
	* testsuite/ld-i386/gpoff-4.d: Likewise.
	* testsuite/ld-i386/gpoff-4.s: Likewise.
	* testsuite/ld-i386/gpoff-5.d: Likewise.
	* testsuite/ld-i386/gpoff-5.s: Likewise.
	* testsuite/ld-i386/gpoff-6.d: Likewise.
	* testsuite/ld-i386/gpoff-6.s: Likewise.
	* testsuite/ld-i386/gpoff-7.d: Likewise.
	* testsuite/ld-i386/gpoff-7.s: Likewise.
	* testsuite/ld-i386/gpoff-8.s: Likewise.
	* testsuite/ld-i386/gpoff-8.t: Likewise.
	* testsuite/ld-i386/gpoff-8a.d: Likewise.
	* testsuite/ld-i386/gpoff-8b.d: Likewise.
	* testsuite/ld-i386/gpoff-8c.d: Likewise.
	* testsuite/ld-i386/gpoff-8d.d: Likewise.
	* testsuite/ld-i386/gpoff-8e.d: Likewise.
	* testsuite/ld-i386/gpoff-8f.d: Likewise.
	* testsuite/ld-x86-64/gpoff-1a.S: Likewise.
	* testsuite/ld-x86-64/gpoff-1b.c: Likewise.
	* testsuite/ld-x86-64/gpoff-2a.S: Likewise.
	* testsuite/ld-x86-64/gpoff-2b.c: Likewise.
	* testsuite/ld-x86-64/gpoff-3.d: Likewise.
	* testsuite/ld-x86-64/gpoff-3.s: Likewise.
	* testsuite/ld-x86-64/gpoff-4.d: Likewise.
	* testsuite/ld-x86-64/gpoff-4.s: Likewise.
	* testsuite/ld-x86-64/gpoff-5.d: Likewise.
	* testsuite/ld-x86-64/gpoff-5.s: Likewise.
	* testsuite/ld-x86-64/gpoff-6.d: Likewise.
	* testsuite/ld-x86-64/gpoff-6.s: Likewise.
	* testsuite/ld-x86-64/gpoff-7.d: Likewise.
	* testsuite/ld-x86-64/gpoff-7.s: Likewise.
	* testsuite/ld-x86-64/gpoff-8.s: Likewise.
	* testsuite/ld-x86-64/gpoff-8.t: Likewise.
	* testsuite/ld-x86-64/gpoff-8a.d: Likewise.
	* testsuite/ld-x86-64/gpoff-8b.d: Likewise.
	* testsuite/ld-x86-64/gpoff-8c.d: Likewise.
	* testsuite/ld-x86-64/gpoff-8d.d: Likewise.
	* testsuite/ld-x86-64/gpoff-8e.d: Likewise.
	* testsuite/ld-x86-64/gpoff-8f.d: Likewise.
	* testsuite/ld-i386/i386.exp: Run R_386_GPOFF tests.
	* testsuite/ld-x86-64/x86-64.exp: Run R_X86_64_GPOFF tests.
</pre>
</div>
</content>
</entry>
<entry>
<title>x86: Allocate space for symbol names with symbol table</title>
<updated>2017-08-11T16:40:39+00:00</updated>
<author>
<name>H.J. Lu</name>
<email>hjl.tools@gmail.com</email>
</author>
<published>2017-08-11T16:32:44+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/binutils-gdb.git/commit/?id=98c5dfc99444094652c2f2259126f70e5cacf56f'/>
<id>98c5dfc99444094652c2f2259126f70e5cacf56f</id>
<content type='text'>
When synthesizing symbols for PLT entries, allocate space for symbol
names with @plt suffixes together with symbol table so that all memory
is returned when symbol table is freed.

	PR binutils/21943
	* elf32-i386.c (elf_i386_get_synthetic_symtab): Allocate space
	for @plt suffixes first.
	* elf64-x86-64.c (elf_x86_64_get_synthetic_symtab): Likewise.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When synthesizing symbols for PLT entries, allocate space for symbol
names with @plt suffixes together with symbol table so that all memory
is returned when symbol table is freed.

	PR binutils/21943
	* elf32-i386.c (elf_i386_get_synthetic_symtab): Allocate space
	for @plt suffixes first.
	* elf64-x86-64.c (elf_x86_64_get_synthetic_symtab): Likewise.
</pre>
</div>
</content>
</entry>
<entry>
<title>Add -z globalaudit linker command line option to set the DF_GLOBALAUDIT flag bit in the dynamic tags.</title>
<updated>2017-08-11T15:36:28+00:00</updated>
<author>
<name>Nick Clifton</name>
<email>nickc@redhat.com</email>
</author>
<published>2017-08-11T15:36:28+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/binutils-gdb.git/commit/?id=93ab9c0de7ba4a477720622c7e772d76f646e3f5'/>
<id>93ab9c0de7ba4a477720622c7e772d76f646e3f5</id>
<content type='text'>
	* emultempl/elf32.em (handle_option): Accept the -z globalaudit
	command line option.
	* lexsup.c (elf_static_list_options): Add -z globalaudit.
	* ld.texinfo: Document the support for the new command line
	option.
	* NEWS: Mention the new feature.
	* testsuite/ld-elf/audit.exp: Add a test of the -z globalaudit
	command line option.
	* testsuite/ld-elf/globalaudit.rd: New file: Expected output from
	readelf.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
	* emultempl/elf32.em (handle_option): Accept the -z globalaudit
	command line option.
	* lexsup.c (elf_static_list_options): Add -z globalaudit.
	* ld.texinfo: Document the support for the new command line
	option.
	* NEWS: Mention the new feature.
	* testsuite/ld-elf/audit.exp: Add a test of the -z globalaudit
	command line option.
	* testsuite/ld-elf/globalaudit.rd: New file: Expected output from
	readelf.
</pre>
</div>
</content>
</entry>
<entry>
<title>Add 2 more tests for PR ld/21884</title>
<updated>2017-08-11T15:05:00+00:00</updated>
<author>
<name>H.J. Lu</name>
<email>hjl.tools@gmail.com</email>
</author>
<published>2017-08-11T15:05:00+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/binutils-gdb.git/commit/?id=9593aade74f0da0c08a4ab55e4c59173b07b1f63'/>
<id>9593aade74f0da0c08a4ab55e4c59173b07b1f63</id>
<content type='text'>
	PR ld/21884
	* testsuite/ld-i386/i386.exp: Run pr21884.
	* testsuite/ld-x86-64/x86-64.exp: Likewise.
	* testsuite/ld-i386/pr21884.d: New file.
	* testsuite/ld-i386/pr21884.t: Likewise.
	* testsuite/ld-x86-64/pr21884.d: Likewise.
	* testsuite/ld-x86-64/pr21884.t: Likewise.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
	PR ld/21884
	* testsuite/ld-i386/i386.exp: Run pr21884.
	* testsuite/ld-x86-64/x86-64.exp: Likewise.
	* testsuite/ld-i386/pr21884.d: New file.
	* testsuite/ld-i386/pr21884.t: Likewise.
	* testsuite/ld-x86-64/pr21884.d: Likewise.
	* testsuite/ld-x86-64/pr21884.t: Likewise.
</pre>
</div>
</content>
</entry>
<entry>
<title>Also disallow global alias of common symbol</title>
<updated>2017-08-11T14:42:02+00:00</updated>
<author>
<name>H.J. Lu</name>
<email>hjl.tools@gmail.com</email>
</author>
<published>2017-08-11T14:41:51+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/binutils-gdb.git/commit/?id=76db0a2e171d2c6780e0388840e3a10ffe7e9ee2'/>
<id>76db0a2e171d2c6780e0388840e3a10ffe7e9ee2</id>
<content type='text'>
We can't create alias of common symbol.  Local alias of common symbol has
been disallowed.  But global alias of common symbol is disallowed when the
common symbol is seen first and silently dropped otherwise.  This patch
disallows alias of common symbol in all cases.

gas/

	PR gas/21667
	* read.c (pseudo_set): Update error message for alias of common
	symbol.
	* write.c (write_object_file): Disallow both local and global
	aliases of common symbol.
	* testsuite/gas/elf/common5a.d: New file.
	* testsuite/gas/elf/common5a.l: Likewise.
	* testsuite/gas/elf/common5a.s: Likewise.
	* testsuite/gas/elf/common5b.d: Likewise.
	* testsuite/gas/elf/common5b.l: Likewise.
	* testsuite/gas/elf/common5b.s: Likewise.
	* testsuite/gas/elf/common5c.d: Likewise.
	* testsuite/gas/elf/common5c.s: Likewise.
	* testsuite/gas/elf/common5d.d: Likewise.
	* testsuite/gas/elf/common5d.s: Likewise.
	* testsuite/gas/elf/elf.exp: Run common5a, common5b, common5c
	and common5d.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We can't create alias of common symbol.  Local alias of common symbol has
been disallowed.  But global alias of common symbol is disallowed when the
common symbol is seen first and silently dropped otherwise.  This patch
disallows alias of common symbol in all cases.

gas/

	PR gas/21667
	* read.c (pseudo_set): Update error message for alias of common
	symbol.
	* write.c (write_object_file): Disallow both local and global
	aliases of common symbol.
	* testsuite/gas/elf/common5a.d: New file.
	* testsuite/gas/elf/common5a.l: Likewise.
	* testsuite/gas/elf/common5a.s: Likewise.
	* testsuite/gas/elf/common5b.d: Likewise.
	* testsuite/gas/elf/common5b.l: Likewise.
	* testsuite/gas/elf/common5b.s: Likewise.
	* testsuite/gas/elf/common5c.d: Likewise.
	* testsuite/gas/elf/common5c.s: Likewise.
	* testsuite/gas/elf/common5d.d: Likewise.
	* testsuite/gas/elf/common5d.s: Likewise.
	* testsuite/gas/elf/elf.exp: Run common5a, common5b, common5c
	and common5d.
</pre>
</div>
</content>
</entry>
<entry>
<title>More gdb/skip.c C++ification</title>
<updated>2017-08-11T11:11:28+00:00</updated>
<author>
<name>Pedro Alves</name>
<email>palves@redhat.com</email>
</author>
<published>2017-08-11T11:11:28+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/binutils-gdb.git/commit/?id=de7985c3cca1358b21b49a9872455e2032f48ee3'/>
<id>de7985c3cca1358b21b49a9872455e2032f48ee3</id>
<content type='text'>
- Make skiplist_entry a class with private data members.
- Move all construction logic to the ctor.
- Make skip_file_p etc be methods of skiplist_entry.
- Use std::list for the skip entries chain.  Make the list own its
  elements.
- Get rid of the ALL_SKIPLIST_ENTRIES/ALL_SKIPLIST_ENTRIES_SAFE
  macros, use range-for / iterators instead.
- function_name_is_marked_for_skip 'function_sal' argument must be
  non-NULL, so make it a reference instead.

All skiplist_entry invariants are now controlled by skiplist_entry
methods/internals.  Some gdb_asserts disappear for being redundant.

gdb/ChangeLog:
2017-08-11  Pedro Alves  &lt;palves@redhat.com&gt;

	* infrun.c (process_event_stop_test): Adjust
	function_name_is_marked_for_skip call.
	* skip.c: Include &lt;list&gt;.
	(skiplist_entry): Make it a class with private fields, and
	getters/setters.
	(skiplist_entry_chain): Delete.
	(skiplist_entries): New.
	(skiplist_entry_count): Delete.
	(highest_skiplist_entry_num): New.
	(ALL_SKIPLIST_ENTRIES, ALL_SKIPLIST_ENTRIES_SAFE): Delete.
	(add_skiplist_entry): Delete.
	(skiplist_entry::skiplist_entry): New.
	(skiplist_entry::add_entry): New.
	(skip_file_command, skip_function): Adjust.
	(compile_skip_regexp): Delete.
	(skip_command): Don't compile regexp here.  Adjust to use
	skiplist_entry::add_entry.
	(skip_info): Adjust to use range-for and getters.
	(skip_enable_command, skip_disable_command): Adjust to use
	range-for and setters.
	(skip_delete_command): Adjust to use std::list.
	(add_skiplist_entry): Delete.
	(skip_file_p): Delete, refactored as ...
	(skiplist_entry::do_skip_file_p): ... this new method.
	(skip_gfile_p): Delete, refactored as ...
	(skiplist_entry::do_gskip_file_p): ... this new method.
	(skip_function_p, skip_rfunction_p): Delete, refactored as ...
	(skiplist_entry::skip_function_p): ... this new method.
	(function_name_is_marked_for_skip): Now returns bool, and takes
	the function sal by const reference.  Adjust to use range-for and
	skiplist_entry methods.
	(_initialize_step_skip): Remove references to
	skiplist_entry_chain, skiplist_entry_count.
	* skip.h (function_name_is_marked_for_skip): Now returns bool, and
	takes the function sal by const reference.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
- Make skiplist_entry a class with private data members.
- Move all construction logic to the ctor.
- Make skip_file_p etc be methods of skiplist_entry.
- Use std::list for the skip entries chain.  Make the list own its
  elements.
- Get rid of the ALL_SKIPLIST_ENTRIES/ALL_SKIPLIST_ENTRIES_SAFE
  macros, use range-for / iterators instead.
- function_name_is_marked_for_skip 'function_sal' argument must be
  non-NULL, so make it a reference instead.

All skiplist_entry invariants are now controlled by skiplist_entry
methods/internals.  Some gdb_asserts disappear for being redundant.

gdb/ChangeLog:
2017-08-11  Pedro Alves  &lt;palves@redhat.com&gt;

	* infrun.c (process_event_stop_test): Adjust
	function_name_is_marked_for_skip call.
	* skip.c: Include &lt;list&gt;.
	(skiplist_entry): Make it a class with private fields, and
	getters/setters.
	(skiplist_entry_chain): Delete.
	(skiplist_entries): New.
	(skiplist_entry_count): Delete.
	(highest_skiplist_entry_num): New.
	(ALL_SKIPLIST_ENTRIES, ALL_SKIPLIST_ENTRIES_SAFE): Delete.
	(add_skiplist_entry): Delete.
	(skiplist_entry::skiplist_entry): New.
	(skiplist_entry::add_entry): New.
	(skip_file_command, skip_function): Adjust.
	(compile_skip_regexp): Delete.
	(skip_command): Don't compile regexp here.  Adjust to use
	skiplist_entry::add_entry.
	(skip_info): Adjust to use range-for and getters.
	(skip_enable_command, skip_disable_command): Adjust to use
	range-for and setters.
	(skip_delete_command): Adjust to use std::list.
	(add_skiplist_entry): Delete.
	(skip_file_p): Delete, refactored as ...
	(skiplist_entry::do_skip_file_p): ... this new method.
	(skip_gfile_p): Delete, refactored as ...
	(skiplist_entry::do_gskip_file_p): ... this new method.
	(skip_function_p, skip_rfunction_p): Delete, refactored as ...
	(skiplist_entry::skip_function_p): ... this new method.
	(function_name_is_marked_for_skip): Now returns bool, and takes
	the function sal by const reference.  Adjust to use range-for and
	skiplist_entry methods.
	(_initialize_step_skip): Remove references to
	skiplist_entry_chain, skiplist_entry_count.
	* skip.h (function_name_is_marked_for_skip): Now returns bool, and
	takes the function sal by const reference.
</pre>
</div>
</content>
</entry>
<entry>
<title>Reset *THIS_CACHE in frame_unwind_try_unwinder in case of exception</title>
<updated>2017-08-11T08:30:02+00:00</updated>
<author>
<name>Yao Qi</name>
<email>yao.qi@linaro.org</email>
</author>
<published>2017-08-11T08:30:02+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/binutils-gdb.git/commit/?id=be7d3cd5f13196dd070978aa48c2832c351c25b6'/>
<id>be7d3cd5f13196dd070978aa48c2832c351c25b6</id>
<content type='text'>
It is required that unwinder-&gt;sniffer should set *this_cache to NULL if
the unwinder is not applicable or exception is thrown, so
78ac5f831692f70b841044961069e50d4ba6a76f adds clear_pointer_cleanup to set
*this_cache to NULL in case of exception in order to fix PR 14100.
https://sourceware.org/ml/gdb-patches/2012-08/msg00075.html

This patch removes that clear_pointer_cleanup, and catch all exception in
the caller of unwinder-&gt;sniffer.  In case of exception, reset *this_case.

gdb:

2017-08-11  Yao Qi  &lt;yao.qi@linaro.org&gt;

	* dwarf2-frame.c (clear_pointer_cleanup): Remove.
	(dwarf2_frame_cache): Remove reset_cache_cleanup.
	(dwarf2_frame_cache):
	* frame-unwind.c (frame_unwind_try_unwinder): Catch
	RETURN_MASK_ALL and set *this_case to NULL.
	* frame-unwind.h: Update comments.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
It is required that unwinder-&gt;sniffer should set *this_cache to NULL if
the unwinder is not applicable or exception is thrown, so
78ac5f831692f70b841044961069e50d4ba6a76f adds clear_pointer_cleanup to set
*this_cache to NULL in case of exception in order to fix PR 14100.
https://sourceware.org/ml/gdb-patches/2012-08/msg00075.html

This patch removes that clear_pointer_cleanup, and catch all exception in
the caller of unwinder-&gt;sniffer.  In case of exception, reset *this_case.

gdb:

2017-08-11  Yao Qi  &lt;yao.qi@linaro.org&gt;

	* dwarf2-frame.c (clear_pointer_cleanup): Remove.
	(dwarf2_frame_cache): Remove reset_cache_cleanup.
	(dwarf2_frame_cache):
	* frame-unwind.c (frame_unwind_try_unwinder): Catch
	RETURN_MASK_ALL and set *this_case to NULL.
	* frame-unwind.h: Update comments.
</pre>
</div>
</content>
</entry>
<entry>
<title>Class-fy dwarf2_frame_state_reg_info</title>
<updated>2017-08-11T08:30:02+00:00</updated>
<author>
<name>Yao Qi</name>
<email>yao.qi@linaro.org</email>
</author>
<published>2017-08-11T08:30:02+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/binutils-gdb.git/commit/?id=1c90d9f022469629c255d44664b4452998168359'/>
<id>1c90d9f022469629c255d44664b4452998168359</id>
<content type='text'>
This patch adds dwarf2_frame_state_reg_info ctor, dtor, copy ctor,
assignment operator, and move assignment.  This patch also adds unit test
to execute_cfa_program to cover the changes.

gdb:

2017-08-11  Yao Qi  &lt;yao.qi@linaro.org&gt;

	* dwarf2-frame.c (dwarf2_frame_state_alloc_regs): Remove.
	(dwarf2_frame_state_copy_regs): Remove.
	(dwarf2_frame_state_free_regs): Remove.
	(dwarf2_frame_state::~dwarf2_frame_state): Remove.
	(dwarf2_restore_rule): Call method .alloc_regs instead of
	dwarf2_frame_state_alloc_regs.
	(execute_cfa_program): Likewise.  Call dwarf2_frame_state_reg_info
	constructor.  Call std::move.
	(dwarf2_fetch_cfa_info): Don't call dwarf2_frame_state_copy_regs.
	(dwarf2_frame_cache): Likewise.

	[GDB_SELF_TEST]: Include selftest.h and
	selftest-arch.h.
	[GDB_SELF_TEST] (execute_cfa_program_test): New function.
	(_initialize_dwarf2_frame) [GDB_SELF_TEST]: Register
	execute_cfa_program_test.

	* dwarf2-frame.h (dwarf2_frame_state_reg_info): Add ctor, dtor,
	copy ctor, assignment operator, move assignment.
	&lt;alloc_regs&gt;: New method.
	&lt;swap&gt;: New method.
	(struct dwarf2_frame_state): Delete dtor.
	(dwarf2_frame_state_alloc_regs): Remove declaration.
	* sparc-tdep.c (sparc_execute_dwarf_cfa_vendor_op): Don't call
	dwarf2_frame_state_alloc_regs, use .alloc_regs instead.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This patch adds dwarf2_frame_state_reg_info ctor, dtor, copy ctor,
assignment operator, and move assignment.  This patch also adds unit test
to execute_cfa_program to cover the changes.

gdb:

2017-08-11  Yao Qi  &lt;yao.qi@linaro.org&gt;

	* dwarf2-frame.c (dwarf2_frame_state_alloc_regs): Remove.
	(dwarf2_frame_state_copy_regs): Remove.
	(dwarf2_frame_state_free_regs): Remove.
	(dwarf2_frame_state::~dwarf2_frame_state): Remove.
	(dwarf2_restore_rule): Call method .alloc_regs instead of
	dwarf2_frame_state_alloc_regs.
	(execute_cfa_program): Likewise.  Call dwarf2_frame_state_reg_info
	constructor.  Call std::move.
	(dwarf2_fetch_cfa_info): Don't call dwarf2_frame_state_copy_regs.
	(dwarf2_frame_cache): Likewise.

	[GDB_SELF_TEST]: Include selftest.h and
	selftest-arch.h.
	[GDB_SELF_TEST] (execute_cfa_program_test): New function.
	(_initialize_dwarf2_frame) [GDB_SELF_TEST]: Register
	execute_cfa_program_test.

	* dwarf2-frame.h (dwarf2_frame_state_reg_info): Add ctor, dtor,
	copy ctor, assignment operator, move assignment.
	&lt;alloc_regs&gt;: New method.
	&lt;swap&gt;: New method.
	(struct dwarf2_frame_state): Delete dtor.
	(dwarf2_frame_state_alloc_regs): Remove declaration.
	* sparc-tdep.c (sparc_execute_dwarf_cfa_vendor_op): Don't call
	dwarf2_frame_state_alloc_regs, use .alloc_regs instead.
</pre>
</div>
</content>
</entry>
<entry>
<title>Class-fy dwarf2_frame_state</title>
<updated>2017-08-11T08:30:02+00:00</updated>
<author>
<name>Yao Qi</name>
<email>yao.qi@linaro.org</email>
</author>
<published>2017-08-11T08:30:02+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/binutils-gdb.git/commit/?id=afe37d6be57a505e6abd01778474a2b73dff52c4'/>
<id>afe37d6be57a505e6abd01778474a2b73dff52c4</id>
<content type='text'>
This patch adds ctor and dtor to dwarf2_frame_state, so that we can
remove one cleanup "old_chain".

gdb:

2017-08-11  Yao Qi  &lt;yao.qi@linaro.org&gt;

	* dwarf2-frame.c (dwarf2_frame_state_free): Remove.
	(dwarf2_frame_state::dwarf2_frame_state): New.
	(dwarf2_frame_state::~dwarf2_frame_state): New.
	(dwarf2_fetch_cfa_info): Update.
	(dwarf2_frame_cache): Remove old_chain.  Change 'fs' to an object
	rather than a pointer.  Update code.
	* dwarf2-frame.h (struct dwarf2_frame_state): Declare ctor and
	dtor.
	&lt;data_align, code_align, retaddr_column&gt;: Change them to const.
	&lt;armcc_cfa_offsets_sf, armcc_cfa_offsets_reversed&gt;: Change them
	to bool.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This patch adds ctor and dtor to dwarf2_frame_state, so that we can
remove one cleanup "old_chain".

gdb:

2017-08-11  Yao Qi  &lt;yao.qi@linaro.org&gt;

	* dwarf2-frame.c (dwarf2_frame_state_free): Remove.
	(dwarf2_frame_state::dwarf2_frame_state): New.
	(dwarf2_frame_state::~dwarf2_frame_state): New.
	(dwarf2_fetch_cfa_info): Update.
	(dwarf2_frame_cache): Remove old_chain.  Change 'fs' to an object
	rather than a pointer.  Update code.
	* dwarf2-frame.h (struct dwarf2_frame_state): Declare ctor and
	dtor.
	&lt;data_align, code_align, retaddr_column&gt;: Change them to const.
	&lt;armcc_cfa_offsets_sf, armcc_cfa_offsets_reversed&gt;: Change them
	to bool.
</pre>
</div>
</content>
</entry>
<entry>
<title>Move dwarf2_frame_state_reg.exp_len to union .loc</title>
<updated>2017-08-11T08:30:02+00:00</updated>
<author>
<name>Yao Qi</name>
<email>yao.qi@linaro.org</email>
</author>
<published>2017-08-11T08:30:02+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/binutils-gdb.git/commit/?id=b348037fd8c0de5c39cc43970697c51048a8ec9c'/>
<id>b348037fd8c0de5c39cc43970697c51048a8ec9c</id>
<content type='text'>
dwarf2_frame_state_reg.exp_len is only used together with .loc.exp, so
it makes more sense to exp_len to the union as well.

gdb:

2017-08-11  Yao Qi  &lt;yao.qi@linaro.org&gt;

	* dwarf2-frame.h (struct dwarf2_frame_state_reg) &lt;exp_len&gt;: Remove.
	&lt;loc.exp&gt;: New field.
	* dwarf2-frame.c (execute_cfa_program): Update.
	(dwarf2_frame_prev_register): Update.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
dwarf2_frame_state_reg.exp_len is only used together with .loc.exp, so
it makes more sense to exp_len to the union as well.

gdb:

2017-08-11  Yao Qi  &lt;yao.qi@linaro.org&gt;

	* dwarf2-frame.h (struct dwarf2_frame_state_reg) &lt;exp_len&gt;: Remove.
	&lt;loc.exp&gt;: New field.
	* dwarf2-frame.c (execute_cfa_program): Update.
	(dwarf2_frame_prev_register): Update.
</pre>
</div>
</content>
</entry>
</feed>
