Re: Build regression with --enable-targets=all [Re: [RFA] Remove target_section.bfd]

Doug Evans
2013-07-17T05:31:12Z

Jan Kratochvil writes:
> On Tue, 16 Jul 2013 00:42:33 +0200, Doug Evans wrote:
> > 2013-07-15 Doug Evans <dje@google.com>
> >
> > * target.h (struct target_section): Delete member bfd.
> > All users updated to use the_bfd_section->owner instead.
> > * exec.c (add_to_section_table): Assert bfd is expected value.
> > Remove initialization of target_section.bfd.
> > (remove_target_sections): Update.
> > (section_table_available_memory): Update.
> > (section_table_xfer_memory_partial): Update.
> > (print_section_info): Update.
> > (exec_set_section_address): Update.
> > * record-full.c (record_full_core_xfer_partial): Update.
> > * solib-svr4.c (svr4_relocate_section_addresses): Update.
> > * solib-target.c (solib_target_relocate_section_addresses): Update.
> > * symfile.c (build_section_addr_info_from_section_table): Update.
> > * target.c (memory_xfer_live_readonly_partial): Update.
> > (memory_xfer_partial_1): Update.
>
> With --enable-targets=all I get:
>
> nto-tdep.c: In function \x18nto_relocate_section_addresses\x19:
> nto-tdep.c:309:48: error: \x18struct target_section\x19 has no member named \x18bfd\x19
> make: *** [nto-tdep.o] Error 1
> ppc64-tdep.c: In function \x18ppc64_convert_from_func_ptr_addr\x19:
> ppc64-tdep.c:386:40: error: \x18struct target_section\x19 has no member named \x18bfd\x19
> make: *** [ppc64-tdep.o] Error 1
> solib-aix.c: In function \x18solib_aix_relocate_section_addresses\x19:
> solib-aix.c:393:18: error: \x18struct target_section\x19 has no member named \x18bfd\x19
> make: *** [solib-aix.o] Error 1
> s390-tdep.c: In function \x18s390_load\x19:
> s390-tdep.c:1182:15: error: \x18struct target_section\x19 has no member named \x18bfd\x19
> s390-tdep.c:1182:15: error: left-hand operand of comma expression has no effect [-Werror=unused-value]
> cc1: all warnings being treated as errors

Yikes. Committed.

2013-07-16 Doug Evans <dje@google.com>

* nto-tdep.c (nto_relocate_section_addresses): Update,
target_section.bfd deleted.
* ppc64-tdep.c (ppc64_convert_from_func_ptr_addr): Ditto.
* s390-tdep.c (s390_load): Ditto.
* solib-aix.c (solib_aix_relocate_section_addresses): Ditto.

Index: nto-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/nto-tdep.c,v
retrieving revision 1.50
diff -u -p -r1.50 nto-tdep.c
--- nto-tdep.c 16 Jul 2013 20:43:48 -0000 1.50
+++ nto-tdep.c 17 Jul 2013 05:20:19 -0000
@@ -306,7 +306,7 @@ nto_relocate_section_addresses (struct s
/* Neutrino treats the l_addr base address field in link.h as different than
the base address in the System V ABI and so the offset needs to be
calculated and applied to relocations. */
- Elf_Internal_Phdr *phdr = find_load_phdr (sec->bfd);
+ Elf_Internal_Phdr *phdr = find_load_phdr (sec->the_bfd_section->owner);
unsigned vaddr = phdr ? phdr->p_vaddr : 0;

sec->addr = nto_truncate_ptr (sec->addr + lm_addr (so) - vaddr);
Index: ppc64-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/ppc64-tdep.c,v
retrieving revision 1.3
diff -u -p -r1.3 ppc64-tdep.c
--- ppc64-tdep.c 4 Jun 2013 02:44:35 -0000 1.3
+++ ppc64-tdep.c 17 Jul 2013 05:20:19 -0000
@@ -383,7 +383,8 @@ ppc64_convert_from_func_ptr_addr (struct
gdb_byte buf[8];
int res;

- res = bfd_get_section_contents (s->bfd, s->the_bfd_section,
+ res = bfd_get_section_contents (s->the_bfd_section->owner,
+ s->the_bfd_section,
&buf, addr - s->addr, 8);
if (res != 0)
return extract_unsigned_integer (buf, 8, byte_order)
Index: s390-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/s390-tdep.c,v
retrieving revision 1.212
diff -u -p -r1.212 s390-tdep.c
--- s390-tdep.c 24 Jun 2013 22:18:31 -0000 1.212
+++ s390-tdep.c 17 Jul 2013 05:20:19 -0000
@@ -1179,7 +1179,8 @@ s390_load (struct s390_prologue_data *da
struct target_section *secp;
secp = target_section_by_addr (&current_target, addr.k);
if (secp != NULL
- && (bfd_get_section_flags (secp->bfd, secp->the_bfd_section)
+ && (bfd_get_section_flags (secp->the_bfd_section->owner,
+ secp->the_bfd_section)
& SEC_READONLY))
return pv_constant (read_memory_integer (addr.k, size,
data->byte_order));
Index: solib-aix.c
===================================================================
RCS file: /cvs/src/src/gdb/solib-aix.c,v
retrieving revision 1.7
diff -u -p -r1.7 solib-aix.c
--- solib-aix.c 30 May 2013 17:31:00 -0000 1.7
+++ solib-aix.c 17 Jul 2013 05:20:19 -0000
@@ -390,8 +390,8 @@ static void
solib_aix_relocate_section_addresses (struct so_list *so,
struct target_section *sec)
{
- bfd *abfd = sec->bfd;
struct bfd_section *bfd_sect = sec->the_bfd_section;
+ bfd *abfd = bfd_sect->owner;
const char *section_name = bfd_section_name (abfd, bfd_sect);
struct lm_info *info = so->lm_info;