Re: [patch rfc] -Wmissing-prototypes round #3

Richard Earnshaw
2003-06-13T14:13:59Z

[-- Attachment #1: Type: text/plain, Size: 988 bytes --]

> > ac131313@redhat.com said:
> >
> >> * config/arm/tm-linux.h (arm_linux_svr4_fetch_link_map_offsets):
> >> Delete declaration, moved to "arm-tdep.h". Include "arm-tdep.h".
> >> * arm-tdep.h: Add ARM_TDEP_H wrapper.
> >> (arm_linux_svr4_fetch_link_map_offsets): Declare.
> >
> >
> > arm_linux_svr4_fetch_link_map_offsets should be moved from arm-tdep.c to
> > armlinux-tdep.c. Then it can be made private to that file; it doesn't
> > belong in the generic ARM code.
>
> Please be my guest, it will simplify my -Wmissing-prototypes patch.
>

Done.

2003-06-13 Richard Earnshaw <rearnsha@arm.com>

* arm-tdep.c (solib-svr4.h): Dont' include it.
(arm_linux_svr4_fetch_link_map_offsets): Move to ...
* arm-linux-tdep.c: ... here. Make static.
(arm_linux_init_abi): Register it.
(solib-svr4.h): Include it.
* Makefile.in: Update dependencies.
* config/arm/tm-linux.h (SVR4_FETCH_LINK_MAP_OFFSETS): Delete.
(arm_linux_svr4_fetch_link_map_offsets): Delete declaration.

[-- Attachment #2: linux-svr4.patch --]
[-- Type: text/plain , Size: 6631 bytes --]

Index: Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/Makefile.in,v
retrieving revision 1.402
diff -p -r1.402 Makefile.in
*** Makefile.in 12 Jun 2003 18:01:28 -0000 1.402
--- Makefile.in 13 Jun 2003 13:16:24 -0000
*************** arm-linux-nat.o: arm-linux-nat.c $(defs_
*** 1552,1561 ****
arm-linux-tdep.o: arm-linux-tdep.c $(defs_h) $(target_h) $(value_h) \
$(gdbtypes_h) $(floatformat_h) $(gdbcore_h) $(frame_h) $(regcache_h) \
$(doublest_h) $(arm_tdep_h) $(symtab_h) $(symfile_h) $(objfiles_h) \
! $(osabi_h)
arm-tdep.o: arm-tdep.c $(defs_h) $(frame_h) $(inferior_h) $(gdbcmd_h) \
$(gdbcore_h) $(symfile_h) $(gdb_string_h) $(dis_asm_h) $(regcache_h) \
! $(doublest_h) $(value_h) $(arch_utils_h) $(solib_svr4_h) $(osabi_h) \
$(arm_tdep_h) $(sim_arm_h) $(elf_bfd_h) $(coff_internal_h) \
$(elf_arm_h) $(gdb_assert_h)
armnbsd-nat.o: armnbsd-nat.c $(defs_h) $(arm_tdep_h) $(inferior_h) \
--- 1552,1561 ----
arm-linux-tdep.o: arm-linux-tdep.c $(defs_h) $(target_h) $(value_h) \
$(gdbtypes_h) $(floatformat_h) $(gdbcore_h) $(frame_h) $(regcache_h) \
$(doublest_h) $(arm_tdep_h) $(symtab_h) $(symfile_h) $(objfiles_h) \
! $(solib_svr4_h) $(osabi_h)
arm-tdep.o: arm-tdep.c $(defs_h) $(frame_h) $(inferior_h) $(gdbcmd_h) \
$(gdbcore_h) $(symfile_h) $(gdb_string_h) $(dis_asm_h) $(regcache_h) \
! $(doublest_h) $(value_h) $(arch_utils_h) $(osabi_h) \
$(arm_tdep_h) $(sim_arm_h) $(elf_bfd_h) $(coff_internal_h) \
$(elf_arm_h) $(gdb_assert_h)
armnbsd-nat.o: armnbsd-nat.c $(defs_h) $(arm_tdep_h) $(inferior_h) \
Index: arm-linux-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/arm-linux-tdep.c,v
retrieving revision 1.34
diff -p -r1.34 arm-linux-tdep.c
*** arm-linux-tdep.c 2 Jun 2003 02:09:39 -0000 1.34
--- arm-linux-tdep.c 13 Jun 2003 13:16:24 -0000
***************
*** 27,32 ****
--- 27,33 ----
#include "frame.h"
#include "regcache.h"
#include "doublest.h"
+ #include "solib-svr4.h"
#include "osabi.h"

#include "arm-tdep.h"
*************** find_minsym_and_objfile (char *name, str
*** 376,381 ****
--- 377,425 ----
}

+ /* Fetch, and possibly build, an appropriate link_map_offsets structure
+ for ARM linux targets using the struct offsets defined in <link.h>.
+ Note, however, that link.h is not actually referred to in this file.
+ Instead, the relevant structs offsets were obtained from examining
+ link.h. (We can't refer to link.h from this file because the host
+ system won't necessarily have it, or if it does, the structs which
+ it defines will refer to the host system, not the target). */
+
+ static struct link_map_offsets *
+ arm_linux_svr4_fetch_link_map_offsets (void)
+ {
+ static struct link_map_offsets lmo;
+ static struct link_map_offsets *lmp = 0;
+
+ if (lmp == 0)
+ {
+ lmp = &lmo;
+
+ lmo.r_debug_size = 8; /* Actual size is 20, but this is all we
+ need. */
+
+ lmo.r_map_offset = 4;
+ lmo.r_map_size = 4;
+
+ lmo.link_map_size = 20; /* Actual size is 552, but this is all we
+ need. */
+
+ lmo.l_addr_offset = 0;
+ lmo.l_addr_size = 4;
+
+ lmo.l_name_offset = 4;
+ lmo.l_name_size = 4;
+
+ lmo.l_next_offset = 12;
+ lmo.l_next_size = 4;
+
+ lmo.l_prev_offset = 16;
+ lmo.l_prev_size = 4;
+ }
+
+ return lmp;
+ }
+
static CORE_ADDR
skip_hurd_resolver (CORE_ADDR pc)
{
*************** arm_linux_init_abi (struct gdbarch_info
*** 529,534 ****
--- 573,581 ----

tdep->jb_pc = ARM_LINUX_JB_PC;
tdep->jb_elt_size = ARM_LINUX_JB_ELEMENT_SIZE;
+
+ set_solib_svr4_fetch_link_map_offsets
+ (gdbarch, arm_linux_svr4_fetch_link_map_offsets);

set_gdbarch_deprecated_call_dummy_words (gdbarch, arm_linux_call_dummy_words);
set_gdbarch_deprecated_sizeof_call_dummy_words (gdbarch, sizeof (arm_linux_call_dummy_words));
Index: arm-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/arm-tdep.c,v
retrieving revision 1.141
diff -p -r1.141 arm-tdep.c
*** arm-tdep.c 13 Jun 2003 04:40:30 -0000 1.141
--- arm-tdep.c 13 Jun 2003 13:16:25 -0000
*************** arm_othernames (char *names, int n)
*** 2668,2716 ****
set_disassembly_style ();
}

- /* Fetch, and possibly build, an appropriate link_map_offsets structure
- for ARM linux targets using the struct offsets defined in <link.h>.
- Note, however, that link.h is not actually referred to in this file.
- Instead, the relevant structs offsets were obtained from examining
- link.h. (We can't refer to link.h from this file because the host
- system won't necessarily have it, or if it does, the structs which
- it defines will refer to the host system, not the target). */
-
- struct link_map_offsets *
- arm_linux_svr4_fetch_link_map_offsets (void)
- {
- static struct link_map_offsets lmo;
- static struct link_map_offsets *lmp = 0;
-
- if (lmp == 0)
- {
- lmp = &lmo;
-
- lmo.r_debug_size = 8; /* Actual size is 20, but this is all we
- need. */
-
- lmo.r_map_offset = 4;
- lmo.r_map_size = 4;
-
- lmo.link_map_size = 20; /* Actual size is 552, but this is all we
- need. */
-
- lmo.l_addr_offset = 0;
- lmo.l_addr_size = 4;
-
- lmo.l_name_offset = 4;
- lmo.l_name_size = 4;
-
- lmo.l_next_offset = 12;
- lmo.l_next_size = 4;
-
- lmo.l_prev_offset = 16;
- lmo.l_prev_size = 4;
- }
-
- return lmp;
- }
-
/* Test whether the coff symbol specific value corresponds to a Thumb
function. */

--- 2668,2673 ----
Index: config/arm/tm-linux.h
===================================================================
RCS file: /cvs/src/src/gdb/config/arm/tm-linux.h,v
retrieving revision 1.17
diff -p -r1.17 tm-linux.h
*** config/arm/tm-linux.h 5 Jun 2002 19:18:16 -0000 1.17
--- config/arm/tm-linux.h 13 Jun 2003 13:16:25 -0000
***************
*** 30,39 ****

#include "config/tm-linux.h"

- /* Use target-specific function to define link map offsets. */
- extern struct link_map_offsets *arm_linux_svr4_fetch_link_map_offsets (void);
- #define SVR4_FETCH_LINK_MAP_OFFSETS() arm_linux_svr4_fetch_link_map_offsets ()
-
/* Offset to saved PC in sigcontext structure, from <asm/sigcontext.h> */
#define SIGCONTEXT_PC_OFFSET (sizeof(unsigned long) * 18)

--- 30,35 ----