summaryrefslogtreecommitdiff
path: root/bfd/elf-linux-core.h
Commit message (Collapse)AuthorAgeFilesLines
* Update year range in copyright notice of binutils filesAlan Modra2023-01-011-1/+1
| | | | | | The newer update-copyright.py fixes file encoding too, removing cr/lf on binutils/bfdtest2.c and ld/testsuite/ld-cygwin/exe-export.exp, and embedded cr in binutils/testsuite/binutils-all/ar.exp string match.
* Update year range in copyright notice of binutils filesAlan Modra2022-01-021-1/+1
| | | | | | | | | | The result of running etc/update-copyright.py --this-year, fixing all the files whose mode is changed by the script, plus a build with --enable-maintainer-mode --enable-cgen-maint=yes, then checking out */po/*.pot which we don't update frequently. The copy of cgen was with commit d1dd5fcc38ead reverted as that commit breaks building of bfp opcodes files.
* Update year range in copyright notice of binutils filesAlan Modra2021-01-011-1/+1
|
* Update year range in copyright notice of binutils filesAlan Modra2020-01-011-1/+1
|
* Update year range in copyright notice of binutils filesAlan Modra2019-01-011-1/+1
|
* -Wstringop-truncation warningsAlan Modra2018-05-041-31/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch is aimed at silencing gcc8 -Wstringop-truncation warnings. Unfortunately adding __attribute__ ((__nonstring)) doesn't work in a number of the places patched here, (see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85643) so if you have recent glibc headers installed you'll need to configure binutils with --disable-werror to compile using gcc8 or gcc9. include/ * ansidecl.h: Import from gcc. * coff/internal.h (struct internal_scnhdr): Add ATTRIBUTE_NONSTRING to s_name. (struct internal_syment): Add ATTRIBUTE_NONSTRING to _n_name. bfd/ * elf-linux-core.h (struct elf_external_linux_prpsinfo32_ugid32), (struct elf_external_linux_prpsinfo32_ugid16), (struct elf_external_linux_prpsinfo64_ugid32), (struct elf_external_linux_prpsinfo64_ugid16): Add ATTRIBUTE_NONSTRING to pr_fname and pr_psargs fields. Remove GCC diagnostic pragmas. Move comment to.. * elf.c (elfcore_write_prpsinfo): ..here. Indent nested preprocessor directives. * elf32-arm.c (elf32_arm_nabi_write_core_note): Add ATTRIBUTE_NONSTRING to data. * elf32-ppc.c (ppc_elf_write_core_note): Likewise. * elf32-s390.c (elf_s390_write_core_note): Likewise. * elf64-s390.c (elf_s390_write_core_note): Likewise. * elfxx-aarch64.c (_bfd_aarch64_elf_write_core_note): Likewise. * elf64-x86-64.c (elf_x86_64_write_core_note): Add GCC diagnostic pragmas. * peXXigen.c (_bfd_XXi_swap_scnhdr_out): Use strnlen to avoid false positive gcc-8 warning. gas/ * config/obj-evax.c (shorten_identifier): Use memcpy in place of strncpy. * config/obj-macho.c (obj_mach_o_make_or_get_sect): Ensure segname and sectname fields are NUL terminated.
* Silence gcc-8 warningsAlan Modra2018-04-251-0/+23
| | | | | | | This seems to work with gcc-8 and a bunch of prior gcc versions I tested. * elf-linux-core.h: Disable gcc-8 string truncation warning. * elf.c (elfcore_write_prpsinfo): Likewise.
* Revert bfd part of "Silence gcc-8 warnings"Alan Modra2018-04-231-16/+0
| | | | | | | | The gcc warning has been fixed, and the patch regressed builds with some older versions of gcc. * elf-linux-core.h: Revert last change. * elf.c: Likewise.
* Silence gcc-8 warningsAlan Modra2018-04-231-0/+16
| | | | | | | | | | | | | | | | | | All of these warnings were false positives. -Wstringop-truncation is particularly annoying when it warns about strncpy used quite correctly. bfd/ * elf-linux-core.h (swap_linux_prpsinfo32_ugid32_out): Disable gcc-8 string truncation warning. (swap_linux_prpsinfo32_ugid16_out): Likewise. (swap_linux_prpsinfo64_ugid32_out): Likewise. (swap_linux_prpsinfo64_ugid16_out): Likewise. * elf.c (elfcore_write_prpsinfo): Likewise. gas/ * stabs.c (generate_asm_file): Use memcpy rather than strncpy. Remove call to strlen inside loop. * config/tc-cr16.c (getreg_image): Warning fix. * config/tc-crx.c (getreg_image): Warning fix.
* Update year range in copyright notice of binutils filesAlan Modra2018-01-031-1/+1
|
* ELF/BFD: Handle both variants of the 64-bit Linux core PRPSINFO noteMaciej W. Rozycki2017-10-111-5/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix commit 70a38d42c5b3 ("New entry points for writing Linux NT_PRPSINFO notes."), <https://sourceware.org/ml/binutils/2013-02/msg00023.html>, and handle both variants of the 64-bit Linux core PRPSINFO note across all targets. The 64-bit Linux core PRPSINFO note matches the 64-bit kernel structure, defined as follows: (gdb) ptype struct elf_prpsinfo type = struct elf_prpsinfo { char pr_state; char pr_sname; char pr_zomb; char pr_nice; unsigned long pr_flag; __kernel_uid_t pr_uid; __kernel_gid_t pr_gid; pid_t pr_pid; pid_t pr_ppid; pid_t pr_pgrp; pid_t pr_sid; char pr_fname[16]; char pr_psargs[80]; } (gdb) where the individual data types of most members are the same across all 64-bit Linux ports, with the exception of `__kernel_uid_t' and `__kernel_gid_t'. These are defined in <asm-generic/posix_types.h> as 32-bit `unsigned int' by default, however overridden as 16-bit `unsigned short' in port-specific <asm/posix_types.h> for the SuperH target. The default is already handled, as from the commit referred. Add the other variant then and provide a backend flag to switch between the two cases possible, with the 32-bit one being the default and the 16-bit one explicitly selected. Set the flag in the SuperH target backend. This arrangement is analogous to how the 32-bit Linux core PRPSINFO note is handled. bfd/ * elf-bfd.h (elf_backend_data): Add `linux_prpsinfo64_ugid16' member. * elf-linux-core.h (elf_external_linux_prpsinfo64): Rename to... (elf_external_linux_prpsinfo64_ugid32): ... this. (swap_linux_prpsinfo32_out): Rename to... (swap_linux_prpsinfo32_ugid32_out): ... this. (elf_external_linux_prpsinfo64_ugid16): New structure. (swap_linux_prpsinfo64_ugid16_out): New function. * elfxx-target.h [!elf_backend_linux_prpsinfo64_ugid16] (elf_backend_linux_prpsinfo64_ugid16): Define. (elfNN_bed): Initialize `linux_prpsinfo64_ugid16' member. * elf.c (elfcore_write_linux_prpsinfo64): Handle both variants of the 64-bit Linux core PRPSINFO note. * elf64-sh64.c (elf_backend_linux_prpsinfo64_ugid16): Define.
* ELF/BFD,GDB: Handle both variants of the 32-bit Linux core PRPSINFO noteMaciej W. Rozycki2017-10-111-8/+61
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix commit 70a38d42c5b3 ("New entry points for writing Linux NT_PRPSINFO notes."), <https://sourceware.org/ml/binutils/2013-02/msg00023.html>, and commit b3ac9c77560a ("Put more info in NT_PRPSINFO Linux notes"), <https://sourceware.org/ml/binutils/2013-02/msg00024.html>, and handle both variants of the 32-bit Linux core PRPSINFO note across all targets. The 32-bit Linux core PRPSINFO note matches the 32-bit kernel structure, defined as follows: (gdb) ptype struct elf_prpsinfo type = struct elf_prpsinfo { char pr_state; char pr_sname; char pr_zomb; char pr_nice; unsigned long pr_flag; __kernel_uid_t pr_uid; __kernel_gid_t pr_gid; pid_t pr_pid; pid_t pr_ppid; pid_t pr_pgrp; pid_t pr_sid; char pr_fname[16]; char pr_psargs[80]; } (gdb) where the individual data types of most members are the same across all 32-bit Linux ports, with the exception of `__kernel_uid_t' and `__kernel_gid_t'. These are defined in <asm-generic/posix_types.h> as 32-bit `unsigned int' by default, however overridden as 16-bit `unsigned short' in port-specific <asm/posix_types.h> for a few targets, mostly earlier ports of Linux, specifically: ARM, CRIS, FR-V, M32R, m68k, MN10300/AM33, s390, SuperH, SPARC and i386. The default is the same as the PowerPC variant already handled, as from the commits referred. Make the special PowerPC case generic then, removing the GDB part, and provide a backend flag to switch between the two cases possible, with the 32-bit one being the default and the 16-bit one explicitly selected. Set the flag in the target backends affected. bfd/ * elf-bfd.h (elf_backend_data): Add `linux_prpsinfo32_ugid16' member. (elfcore_write_ppc_linux_prpsinfo32): Remove prototype. * elf32-ppc.c (elfcore_write_ppc_linux_prpsinfo32): Remove. (elf_external_ppc_linux_prpsinfo32) (swap_ppc_linux_prpsinfo32_out): Move to... * elf-linux-core.h (elf_external_linux_prpsinfo32_ugid32) (swap_linux_prpsinfo32_ugid32_out): ... these. (elf_external_linux_prpsinfo32): Rename to... (elf_external_linux_prpsinfo32_ugid16): ... this. (swap_linux_prpsinfo32_out): Rename to... (swap_linux_prpsinfo32_ugid16_out): ... this. * elfxx-target.h [!elf_backend_linux_prpsinfo32_ugid16] (elf_backend_linux_prpsinfo32_ugid16): Define. (elfNN_bed): Initialize `linux_prpsinfo32_ugid16' member. * elf.c (elfcore_write_linux_prpsinfo32): Handle both variants of the 32-bit Linux core PRPSINFO note. * elf32-am33lin.c (elf_backend_linux_prpsinfo32_ugid16): Define. * elf32-arm.c (elf_backend_linux_prpsinfo32_ugid16): Define. * elf32-cris.c (elf_backend_linux_prpsinfo32_ugid16): Define. * elf32-frv.c (elf_backend_linux_prpsinfo32_ugid16): Define. * elf32-i386.c (elf_backend_linux_prpsinfo32_ugid16): Define. * elf32-m32r.c (elf_backend_linux_prpsinfo32_ugid16): Define. * elf32-m68k.c (elf_backend_linux_prpsinfo32_ugid16): Define. * elf32-s390.c (elf_backend_linux_prpsinfo32_ugid16): Define. * elf32-sh.c (elf_backend_linux_prpsinfo32_ugid16): Define. * elf32-sparc.c (elf_backend_linux_prpsinfo32_ugid16): Define. gdb/ * ppc-linux-tdep.c (ppc_linux_init_abi): Remove call to `set_gdbarch_elfcore_write_linux_prpsinfo'.
* ELF/BFD: Fix padding in `elf_external_linux_prpsinfo64'Maciej W. Rozycki2017-10-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix commit 70a38d42c5b3 ("New entry points for writing Linux NT_PRPSINFO notes."), <https://sourceware.org/ml/binutils/2013-02/msg00023.html>, and move the padding of the `elf_external_linux_prpsinfo64' structure to match the corresponding 64-bit Linux kernel `elf_prpsinfo' structure. The 64-bit kernel structure is defined as follows: (gdb) ptype struct elf_prpsinfo type = struct elf_prpsinfo { char pr_state; char pr_sname; char pr_zomb; char pr_nice; unsigned long pr_flag; __kernel_uid_t pr_uid; __kernel_gid_t pr_gid; pid_t pr_pid; pid_t pr_ppid; pid_t pr_pgrp; pid_t pr_sid; char pr_fname[16]; char pr_psargs[80]; } (gdb) print /x &((struct elf_prpsinfo *)0)->pr_nice $1 = 0x3 (gdb) print /x &((struct elf_prpsinfo *)0)->pr_flag $2 = 0x8 (gdb) print /x &((struct elf_prpsinfo *)0)->pr_uid $3 = 0x10 (gdb) print sizeof(((struct elf_prpsinfo *)0)->pr_flag) $4 = 8 (gdb) with implicit padding present before the `pr_flag' member, to correctly align it to a multiple of 8. Conversely `elf_external_linux_prpsinfo64' has padding after its `pr_flag' member: (top-gdb) ptype struct elf_external_linux_prpsinfo64 type = struct elf_external_linux_prpsinfo64 { char pr_state; char pr_sname; char pr_zomb; char pr_nice; char pr_flag[8]; char gap[4]; char pr_uid[4]; char pr_gid[4]; char pr_pid[4]; char pr_ppid[4]; char pr_pgrp[4]; char pr_sid[4]; char pr_fname[16]; char pr_psargs[80]; } (top-gdb) print /x &((struct elf_external_linux_prpsinfo64 *)0)->pr_nice $1 = 0x3 (top-gdb) print /x &((struct elf_external_linux_prpsinfo64 *)0)->pr_flag $2 = 0x4 (top-gdb) print /x &((struct elf_external_linux_prpsinfo64 *)0)->pr_uid $3 = 0x10 (top-gdb) and consequently `pr_flag' is misplaced. Move `gap' ahead of `pr_flag' then. bfd/ * elf-linux-core.h (elf_external_linux_prpsinfo64): Move the `gap' member ahead of `pr_flag'.
* Update year range in copyright notice of all files.Alan Modra2017-01-021-1/+1
|
* Convert macros in elf-linux-core.h to inline functionsAlan Modra2016-01-211-50/+46
| | | | | | | | | | | | | | | Besides changing some macros into inline functions, this removes redundant memsets and uses bfd_put_* rather than H_PUT_*. * elf-linux-core.h (swap_linux_prpsinfo32_out): New function. (swap_linux_prpsinfo64_out): New function. (LINUX_PRPSINFO32_SWAP_FIELDS): Delete. (LINUX_PRPSINFO64_SWAP_FIELDS): Delete. * elf.c (elfcore_write_linux_prpsinfo32): Adjust. Don't memset. (elfcore_write_linux_prpsinfo64): Likewise. * elf32-ppc.c (swap_ppc_linux_prpsinfo32_out): New function. (PPC_LINUX_PRPSINFO32_SWAP_FIELDS): Delete. (elfcore_write_ppc_linux_prpsinfo32): Adjust. Don't memset.
* Rename elf-linux-psinfo.h to elf-linux-core.hAlan Modra2016-01-211-0/+127
Since it will sometime have more than just prpsinfo. Also, elf32-ppc.c needlessly includes this header. * elf-linux-core.h: Rename from elf-linux-psinfo.h. * elf.c: Adjust #include. * elf32-ppc.c: Don't #include elf-linux-psinfo.h * Makefile.am (SOURCE_HFILES): Update. * Makefile.in: Regenerate. * po/SRC-PORFILES.in: Regenerate.