| Summary: | LD creates invalid PLT instructions on CORTEX-M3 | ||
|---|---|---|---|
| Product: | binutils | Reporter: | Markus Mayer <lotharlutz> |
| Component: | ld | Assignee: | Tamar Christina <tnfchris> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | CC: | h.IrfanAhmad, lotharlutz, meadori, nickc, tnfchris |
| Priority: | P2 | ||
| Version: | 2.23 | ||
| Target Milestone: | 2.34 | ||
| Host: | Target: | ||
| Build: | Last reconfirmed: | ||
| Project(s) to access: | ssh public key: | ||
| Attachments: |
Patch for thumb plt entries
[Rev2] Patch for thumb plt entries 3rd version of patch v4 of patch, now with added mapping symbols Fix typo. Extend supported GOT offsets to 32-bits Fix another typo; remove assert |
||
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gdb and binutils".
The branch, master has been updated
via 57460bcf82df9e5e335be84ecc9bdef33dddc934 (commit)
from c7e8af9b3bc0881c59c999d7b78348d359383efe (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=57460bcf82df9e5e335be84ecc9bdef33dddc934
commit 57460bcf82df9e5e335be84ecc9bdef33dddc934
Author: Nick Clifton <nickc@redhat.com>
Date: Thu Nov 14 15:39:51 2013 +0000
PR ld/16017
* elf32-arm.c (elf32_arm_populate_plt_entry): Return a boolean
value, TRUE for success, FALSE for failure.
Fail if attempting to create a PLT entry for a thumb only target.
(elf32_arm_final_link_relocate): Check result of calling
elf32_arm_populate_plt_entry.
(elf32_arm_finish_dynamic_symbol): Likewise.
-----------------------------------------------------------------------
Summary of changes:
bfd/ChangeLog | 10 ++++++++++
bfd/elf32-arm.c | 31 ++++++++++++++++++++++++-------
2 files changed, 34 insertions(+), 7 deletions(-)
Hi Markus, I do not have a solution for this problem, but I have checked in a patch to make the linker fail, with a suitable error message if an attempt is made to generate a PLT entry for a thumb-only processor. Cheers Nick Hi Nick, thanks for your reply. I have tried to fix it myself, but I am not familiar enough with the code base. Is there anything I can do to help with this issue? e.g. providing assembler code for plt entries. Hi Markus,
> Is there anything I can do to help with this issue? e.g. providing assembler
> code for plt entries.
Yes please - that would help a lot.
Cheers
Nick
As I don't know what limitations exists for PLT entries I will provide different solutions.
Base assumptions:
- The IP register must contain the (absolute)address of the GOT entry (I think it is needed for lazy binding)
- If any register (except the IP register) is modified during the PLT execution, its state must be restored before the end of the PLT
- All PLT entries must have equal sizes
Solution 1:
1: b401 push {r0}
2: f8df 0010 ldr.w r0, [pc, #16] ; load GOT index
3: f8df c010 ldr.w ip, [pc, #16] ; load (relative) GOT address
4: 4484 add ip, r0
5: 44fc add ip, pc
6: bc01 pop {r0}
7: f8dc f000 ldr.w pc, [ip]
8: 00000000 ; GOT index
9: 00000000 ; GOT address relative to instruction in line 5
Pros: capable to handle arbitrary large GOT indexes as well as arbitrary offsets of the GOT
Cons: 28 Bytes per entry, 3 Load Instructions
Solution 2:
1: f8df c008 ldr.w ip, [pc, #8] ; load (relative)GOT entry address
2: 44fc add ip, pc
3: f8dc f000 ldr.w pc, [ip]
4: 0000 ; padding to make the address aligned
5: 00000000 ; (GOT + GOT index) relative to instruction in line 2
Pros: only 16 Bytes per entry
Cons: still 2 load instructions, GOT and GOT index must be combined (is this possible?)
Solution 3:
1: f04f 0c00 mov.w ip, #0
2: ea4f 3c0c mov.w ip, ip, lsl #12
3: f20f 0c00 addw ip, pc, #0
4: f8dc f000 ldr.w pc, [ip]
The GOT entry address is encoded in line 1 and line 3.
Pro: 16 Bytes per entry, only one load instruction
Con: only offsets up to 24 Bit are possible. (Note this limitation also exists for the current arm PLT)
I favour solution 3. I will provide code the generate a thumb plt later the day.
Created attachment 7285 [details]
Patch for thumb plt entries
I have attached a patch to create thumb plt entries. The patch has some issues: - The plt entries are using tumb-2 instructions. When on an thumb only thumb-1 device, an error should be emitted. - The plt0_entry for thumb-only is not converted yet. I will take care of it the next couple of days - The size of a plt entry is set the thumb-entry size (which breaks normal arm linking). The plt size must be set according to whether we are on thumb-only, or not. I have tried using 'using_thumb_only', but it seams like 'abfd' is not fully initialized inside 'elf32_arm_link_hash_table_create' to work with 'using_thumb_only'. Any help and feedback is welcome Hi Markus, > The size of a plt entry is set the thumb-entry size (which breaks > normal arm linking). Have you tried setting the entry size in elf32_arm_create_dynamic_sections() ? > The plt entries are using tumb-2 instructions. When on an thumb only > thumb-1 device, an error should be emitted. You can use "! using_thumb2()" for this. The patch itself looks good so far... Cheers Nick Created attachment 7291 [details]
[Rev2] Patch for thumb plt entries
Hi Nick, I have attached a new version of my previous patch. Changes: - convert pl0 to thumb - Show error when using thumb-1 thumb-only targets - Rename 'elf32_thumb_plt_entry' to 'elf32_thumb2_plt_entry' - Set 'plt_entry_size' inside 'elf32_arm_create_dynamic_sections' - Move 'using_thumb_only' and 'using_thumb2' upwards, to make it available inside 'elf32_arm_create_dynamic_sections' Open issues: - 'plt_entry_size' is still set incorrectly. 'using_thumb_only' return false inside 'elf32_arm_create_dynamic_sections' - When calling the plt entry from the .text segment a 'BLX <immediate>' instruction is used. This instruction is not available in thumb mode. 'BL <immediate>' must be used here. Can you help me out with these issues? Regards Markus Created attachment 7314 [details]
3rd version of patch
Hi Markus,
[Sorry for the delay in responding - I have been sidetracked by other tasks].
Re: Detecting thumb_only inside create_dynamic_sections(). You are right - the normal function does not work. This is because at the time that create_dynamic_sections is called the attributes have not been copied from the input bfd to the output bfd. But... the attributes are still present in the input bfd, so you can test those.
Re: Not converting BL into BLX - these was some code in final_link_relocate that assumed that PLT entries would always be in ARM mode, and so a BLX would always be needed.
I have uploaded a revised version of your v2 patch with fixes for both of these problems. Please try it out and let me know if it works for you.
Cheers
Nick
Hi Nick, I've applied your patch and check the disassembly of a create test library. As far as I can tell it looks correct. I haven't tested it on a real system, because my thumb-only system isn't available till late January. If there are any problems left, it's like an error in the plt-code (which I can fix myself). I will report my hardware test results as soon as there are available. Regards Markus This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gdb and binutils".
The annotated tag, hjl/linux/release/2.24.51.0.2 has been created
at bc64dc5b95aa848d7274e4648d667b9b1065d88c (tag)
tagging bbd7f545f1639be4573ba06ed688b8db670d4597 (commit)
replaces hjl/linux/release/2.24.51.0.1
tagged by H.J. Lu
on Fri Dec 13 08:44:03 2013 -0800
- Log -----------------------------------------------------------------
Linux binutils 2.24.51.0.2
Alan Modra (47):
daily update
daily update
daily update
daily update
daily update
Correct elf64-ppc.c handling of protected symbols
PowerPC64 ELFv2, allocate dynreloc space for ifunc
daily update
daily update
daily update
daily update
PowerPC64 ELFv2 trampoline match
Fixes to powerpc64 gold ELFv2 support
Add missing ChangeLog for 88b8e63904fda25c029deaf25d7b4e489b351470
daily update
daily update
daily update
daily update
daily update
daily update
daily update
Import config.sub and config.guess from upstream.
daily update
daily update
daily update
daily update
daily update
daily update
daily update
daily update
daily update
daily update
daily update
PowerPC64 linking of --just-symbols objects (klibc)
More PowerPC64 ELFv2 --just-symbols fixes
daily update
daily update
daily update
daily update
daily update
Fix --as-needed undefined symbol references from dynamic libraries.
correct file reference
daily update
daily update
daily update
daily update
daily update
Alexey Makhalov (1):
PR gas/16109
Andreas Arnez (3):
S390: Fix TDB regset recognition
Fix GDB crash with upstream GCC due to qsort(NULL, ...)
Fix GDB crash with upstream GCC due to memcpy(NULL, ...)
Andrew Burgess (6):
Mark entirely optimized out value as non-lazy.
Tighten regexp in gdb.base/setshow.exp
Make "set debug frame 1" use the standard print routine for optimized out values.
Print entirely unavailable struct/union values as a single <unavailable>.
Add support for DW_OP_bit_piece and DW_OP_plus_uconst to DWARF assembler.
Add call to get_compiler_info to gdb_compile_shlib.
Andrew Pinski (2):
ld/ChangeLog:
ld/ChangeLog:
Anthony Green (1):
Add software single step support to moxie port
Cary Coutant (6):
Fix assert failure with --emit-relocs and .eh_frame sections.
Fix race condition while building EH frame header.
Add --verify-only option to DWP.
Revert "Fix race condition while building EH frame header."
Use in-tree assembler for exception_x86_64_bnd_test.
Add check for which library is needed for dlopen.
Catherine Moore (4):
2013-11-11 Catherine Moore <clm@codesourcery.com>
Fix ChangeLog entries from earlier commit.
2013-11-19 Catherine Moore <clm@codesourcery.com>
2013-11-19 Catherine Moore <clm@codesourcery.com>
Chung-Lin Tang (1):
Separate emulations for nios2-elf and nios2-linux.
Conrad Hoffmann (1):
* gprof.c (inline_file_names): New variable.
Cory Fields (1):
* windres.c (define_resource): Use zero for timestamp, making
Doug Evans (42):
* gdb.python/py-arch.exp: Tweak test name for bad memory access test.
Add pretty-printing of .debug_gnu_pubnames, .debug_gnu_pubtypes.
PR 11786
Fix email address in earlier entry.
Change "set debug symtab-create" to take a verbosity level.
Change "set debug dwarf2-read" to take a verbosity level.
* gdb.arch/arm-bl-branch-dest.exp: Use gdb_test_file_name instead
Work around gold/15646.
* gdb.base/fileio.exp: Make $dir2 writable after the test is done
* breakpoint.c (bpstat_check_breakpoint_conditions): Assert
fix email address in earlier commit
* breakpoint.c (breakpoint_cond_eval): Fix and enhance comment.
* breakpoint.c (bpstat_check_breakpoint_conditions): For thread
* gdb.python/py-breakpoint.exp: Split up into several functions,
* gdb.python/py-breakpoint.exp: Reformat for 80 columns.
* gdb.python/py-breakpoint.exp: Make tests have unique names.
* linux-low.c (resume_status_pending_p): Tweak comment.
* linux-low.c (linux_set_resume_request): Fix comment.
Move types_deeply_equal from py-type.c to gdbtypes.c.
cli/cli-script.c (multi_line_command_p): New function.
* python/py-frame.c (frapy_block): Fix error message text.
* python/py-frame.c (gdbpy_initialize_frames): Remove FIRST_ERROR,
* gdb.python/python.exp: Don't call skip_python_tests, we still want
Fix long line in earlier entry.
* gdb.python/py-symbol.exp: Fix whitespace.
* gdb.python/py-symbol.exp: Add some comments. Make all test names unique.
* gdb.python/py-type.exp (test_enums): Fix typo.
Test name tweaks for py-value.exp.
* gdb.base/ena-dis-br.exp: Add missing quote to "step after continue
* configure.ac: Add comments delineating libpython and libmcheck.
fix spelling in previous entry
Rename breakpoint_object to gdbpy_breakpoint_object.
Remove trailing whitespace.
* python/py-auto-load.c (source_section_scripts): Move comment to
Move .debug_gdb_script processing to auto-load.c.
* auto-load.c (load_auto_scripts_for_objfile): Add some comments.
fix date in previous entry
* gdb.base/break.exp: Fix setting of $baz.
Delete interp_exec_p.
PR 16286
add missing PR# to previous entry
* dwarf2read.c (lookup_dwo_cutu): Include name of dwp file in
Edjunior Barbosa Machado (1):
Fix argument type on gdbsim_detach prototype.
Eli Zaretskii (2):
doc/gdb.texinfo (i386): Fix yesterday's commit.
Fix the manual more thoroughly.
H.J. Lu (45):
Add binutils-sharable.patch
Add binutils-lto-mixed.patch
Add binutils-pr12639.patch
Add binutils-secondary.patch
Mention hjl.tools@gmail.com in bug URL
Set BFD version to 2.24.51.0.1
Remove strayed entry
Remove CpuNop from CPU_K6_2_FLAGS
Merge remote-tracking branch 'origin/master' into hjl/linux/master
Update bfd version to 2.24.51.0.2
Merge remote-tracking branch 'origin/master' into hjl/linux/master
Merge remote-tracking branch 'origin/master' into hjl/linux/master
Make room for PLT0 directly
Add R_X86_64_PC32_BND and R_X86_64_PLT32_BND
Merge remote-tracking branch 'origin/master' into hjl/linux/master
Add R_X86_64_PC32_BND/R_X86_64_PLT32_BND suppor to gold
Add a dummy "int bnd_prefix" argument
Update x86 gas tests for mingw
Re-indent elf_x86_64_section_from_shdr
Add mpx1static, mpx2 and mpx2static tests
Add bnd-branch-1 test
Merge remote-tracking branch 'origin/master' into hjl/linux/master
Add HOSTING_SLIBS and use it for -pie
Merge remote-tracking branch 'origin/master' into hjl/linux/master
Fix a typo
Merge remote-tracking branch 'origin/master' into hjl/linux/master
Merge remote-tracking branch 'origin/master' into hjl/linux/master
Add the missing ChangeLog entry
Add -ffat-lto-objects to STAGE[23]_CFLAGS
Add -ldl to POSTSTAGE1_LDFLAGS
Add -B$$r/prev-$(TARGET_SUBDIR)/libsanitizer/
Remove -lpthread -ldl and add -B$$r/prev-$(TARGET_SUBDIR)/libsanitizer/
Merge remote-tracking branch 'origin/master' into hjl/linux/master
Add a test for --as-needed with symbol versioning
Remove shared object from -Ttext-segment
Set ET_EXEC for -pie -Ttext-segment=
Add "#..."
Remove bfd_elf32_bfd_set_private_bfd_flags
Also copy EI_OSABI field
Merge remote-tracking branch 'origin/master' into hjl/linux/master
Apply fixes for PRs 16317/16322
Merge remote-tracking branch 'origin/hjl/linux/master' into hjl/linux/applied
Apply binutils-pr16317.patch
Apply binutils-pr16322.patch
Update release note for 2.24.51.0.2
Jan Kratochvil (2):
gdb/NEWS: Fix typo
Record objfile->original_name as an absolute path
Jan-Benedict Glaw (1):
2013-11-08 Jan-Benedict Glaw <jbglaw@lug-owl.de
Joel Brobecker (42):
Minor reformatting in remote-sim.c (gdbsim_detach declaration).
Dandling memory pointers in Ada catchpoints with GDB/MI.
Add command to list Ada exceptions
Implement GDB/MI equivalent of "info exceptions" CLI command.
Document "info exceptions" and "-info-ada-exception" new commands.
Add missing ChangeLog entry for a7e332c24b77168bc61d4ee776bf29c831fbbc88
Small fix (first word of sentence to start with capital letter)
crash while re-reading symbols from objfile on ppc-aix.
Replace "info-ada-exceptions" by "ada-exceptions" in -list-features
language.h: Add "symtab.h" #include
New function cli-utils.c:extract_arg_const
GDB/MI: Add new "--language LANG" command option.
Fix DW_OP_GNU_regval_type with FP registers
Start inferior before running test listing Ada exceptions.
gdb.ada/info_exc.exp,mi_exc_info.exp: handle runtimes with full debug info.
gdb.ada/info_exc.exp,mi_exc_info.exp: Use more unique exception name.
Rename "read_reg" into "read_addr_from_reg" in struct dwarf_expr_context_funcs
Add "language-option" to -list-features
mi-language.exp: Check "langauge-option" in -list-features output.
gdb_ari.sh: Remove entries for dirent.h and stat.h.
Fix int() builtin with range type gdb.Value objects.
get rid of py-value.c:is_intlike (use is_integral_type instead)
Makefile.in (HFILES_NO_SRCDIR): Remove "common/gdb_string.h".
Remove last traces of gdb_stat.h.
Makefile.in (HFILES_NO_SRCDIR): Remove "common/gdb_dirent.h".
Fix filestuff.c build error if RLIMIT_NOFILE not defined.
New GDB/MI command "-info-gdb-mi-command"
Add "undefined-command" error code at end of ^error result...
Remove all trailing spaces in mi/mi-main.c.
Remove "ada-exceptions" from -list-features output.
NEWS: Extend documentation of the new GDB/MI --language option.
crash evaluating bogus exception condition expression (sparc-solaris)
Ada: Reserved word "all" should not need to be spelled in lowercase.
Minor coding-style fixes in ada-lex.l:find_dot_all.
Allow Windows UNWIND_INFO version 2.
Uninitialized variable "this_id" in frame.c:get_prev_frame_1.
Document the GDB 7.6.2 release in gdb/ChangeLog
Fix gdb/ChangeLog date in last entry.
nameless LOAD_DLL_DEBUG_EVENT causes ntdll.dll to be missing
GDB/MI: Document support for -exec-run --start in -list-features
Set language for Ada minimal symbols.
Add @cindex for section documenting the -list-features GDB/MI command.
Jose E. Marchesi (4):
2013-11-07 Jose E. Marchesi <jose.marchesi@oracle.com>
sparc: support single-stepping over longjmp calls.
testsuite: handle SIGLOST/SIGPWR conflict in sparc64-*-linux-gnu targets.
Fixed typo in date in testsuite/ChangeLog entry
Keith Seitz (4):
Fix regressions caused by const-ify linespec patch:
PR c++/7539
Fix PR # dyslexia in ChangeLog for previous commit. It should have
PR c++/14819: Explicit class:: inside class scope does not work
Keven Boell (1):
testsuite: introduce index in varobj child eval.
Kyrylo Tkachov (1):
[ld/testsuite/]
Luis Machado (2):
* lib/mi-support.exp (mi_gdb_test): Expect different formats
* gdb.base/callfuncs.c (main): Assign malloc's return value
Maciej W. Rozycki (1):
MIPS/opcodes: Add MFCR and MTCR data dependencies
Michael Zolotukhin (1):
Reorder invalid default mask check
Mike Frysinger (3):
gdb: testsuite: fix ksh shebang to use sh
strip off +x bits on non-executable/script files
sim: bfin: tests: make run-tests.sh executable
Nick Clifton (8):
* rescoff.c (write_coff_file): Use 64-bit alignment for resource
PR ld/16082
PR ld/16017
* config/tc-aarch64.c (parse_sys_reg): Do not issue error messages
* scripttempl/elf32msp430.sc (.data): Set the based on the next
PR ld/16192
* peXXigen.c (pe_print_resource_entries): New function: Displays
* s390-mkopc.c (dumpTable): Provide a format string to printf so
Omair Javaid (1):
testsuite/gdb.dwarf2: dw2-case-insensitive.exp: p fuNC_lang fails on arm
Pedro Alves (36):
infrun.c:handle_inferior_event: Don't fall through in TARGET_WAITKIND_LOADED handling.
infrun.c:handle_inferior_event: Move comment.
infrun.c: Don't set ecs->random_signal for "catchpoint" events (eliminate ecs->random_signal).
infrun.c:handle_inferior_event: Rework random signal checks.
Eliminate enum bpstat_signal_value, simplify random signal checks further.
infrun.c: Split handle_inferior_event further.
infrun.c:handle_signal_stop: Move initial connection/attachment handling code earlier.
Simplify dwarf2-frame.c:read_addr_from_reg.
Make the maint.exp:'maint print objfiles' test less fragile.
Add missing ChangeLog entry.
Don't let two frames with the same id end up in the frame chain.
Make use of the frame stash to detect wider stack cycles.
Eliminate dwarf2_frame_cache recursion, don't unwind from the dwarf2 sniffer (move dwarf2_tailcall_sniffer_first elsewhere).
Revert "Eliminate dwarf2_frame_cache recursion, don't unwind from the dwarf2 sniffer (move dwarf2_tailcall_sniffer_first elsewhere)."
Revert "Make use of the frame stash to detect wider stack cycles."
Revert "Don't let two frames with the same id end up in the frame chain."
Eliminate dwarf2_frame_cache recursion, don't unwind from the dwarf2 sniffer (move dwarf2_tailcall_sniffer_first elsewhere).
Don't let two frames with the same id end up in the frame chain.
Make use of the frame stash to detect wider stack cycles.
Rename gdb.dwarf2/dw2-bad-cfi.* to gdb.dwarf2/dw2-unspecified-ret-addr.*.
Make "set debug frame 1" output print <not saved> instead of <optimized out>.
Fix type of not saved registers.
Fix PR 16152's ChangeLog entry.
register: "optimized out" -> "not saved".
get_prev_frame, UNWIND_NULL_ID -> UNWIND_OUTERMOST
get_prev_frame, outer_frame_id and unwind->stop_reason checks are redundant.
get_prev_frame, stop_reason != UNWIND_NO_REASON, add frame debug output.
Plug target side conditions and commands leaks.
UNWIND_NULL_ID is no longer used anywhere. Update comments.
Handle 'k' packet TARGET_CLOSE_ERROR gracefully.
gnulib's sys/stat.h always defines S_IRGRP, S_IXGRP, S_IXOTH.
Add new target_read_raw_memory function, and consolidate comments.
New OPTIMIZED_OUT_ERROR error code.
Fix "info frame" in the outermost frame.
Eliminate UNSUPPORTED_ERROR.
breakpoint.c:insert_bp_location: Constify local.
Phil Muldoon (4):
2013-11-07 Phil Muldoon <pmuldoon@redhat.com>
2013-11-07 Phil Muldoon <pmuldoon@redhat.com>
2013-11-07 Phil Muldoon <pmuldoon@redhat.com>
2013-11-11 Phil Muldoon <pmuldoon@redhat.com>
Pierre Muller (1):
Fix completion for pascal language.
Richard Sandiford (1):
binutils/testsuite/
Roland McGrath (4):
Set CPU type in BFD backend for x86_64-nacl* and i?86-nacl* targets
Fix references to __ehdr_start when it cannot be defined
Fix *-nacl* target objcopy/strip of binary made with custom linker script
Use $(INSTALL_PROGRAM_ENV) consistently.
Samuel Bronson (2):
MAINTAINERS (Write After Approval): Add myself to the list.
Resurrect gdb-add-index as a contrib script
Sanimir Agovic (1):
test: test eval routines with EVAL_AVOID_SIDE_EFFECTS flag set
Senthil Kumar Selvaraj (1):
* scripttempl/avr.sc: Set .data section's LMA to next available
Sergio Durigan Junior (2):
Remove gdb_string.h from gdbarch.sh
Sanitize access to gdbarch on the SDT probe API (and fix ARM bug)
Siva Chandra (1):
2013-12-12 Siva Chandra Reddy <sivachandra@google.com>
Steffen Sledz (1):
gdb: fix cygwin check in configure script
Sterling Augustine (2):
2013-11-22 Sterling Augustine <saugustine@google.com>
2013-11-22 Sterling Augustine <saugustine@google.com>
Steve Ellcey (1):
2013-11-25 Steve Ellcey <sellcey@mips.com>
Tom Tromey (42):
constify to_detach
introduce common.m4
remove link.h checks
use gdb_string.h in m32c-tdep.c
gdb configure updates
fix a comment in configure.ac
remove unused gdbserver configury
fix "tkill" check
fix multi-arch-exec for parallel mode
off-by-one fix for py-linetable.c
fix grammar oddity in the manual
print summary from "make check"
fix PR c++/16117
link gdbreplay against gnulib
change how list of modules is computed
import strstr and strerror modules
remove gdb_string.h
don't check for string.h or strings.h
import gnulib dirent module
remove gdb_dirent.h
don't check for stddef.h
stdlib.h is universal too
don't check for unistd.h
sys/types.h cleanup
import gnulib sys/stat.h module
remove gdb_stat.h
remove strerror module
Detect infinite loop in value_fetch_lazy's lval_register handling.
handle an unspecified return address column
update comment in dw2-bad-cfi.S.
revert patch from 2013-11-22
add "dir" menu item for gdbserver
add @kindex for catchpoints
remove some sym_probe_fns methods
make symtab::filename const
make symtab::dirname const
put the psymtab filename in the filename bcache
fix a couple of FIXMEs
pack partial_symtab for space
remove unnecessary declaration
remove objfile_to_front
update free_objfile comment
Tristan Gingold (5):
Fix version.dll binutils test on non native platforms
Improve dump of xdata/pdata on x86_64.
Fix crash on intelbad.
Clear allocated target data.
Add epilog unwind for x86_64 pe/coff
Walfred Tedeschi (9):
Fix conditions in creating a bitfield.
Add MPX registers XML files.
Add MPX support for i386
MPX for amd64
Add MPX support to gdbserver.
Add pretty-printer for MPX bnd registers.
Add MPX registers tests.
Fix PR16193 - gdbserver aborts.
Documentation for MPX.
Will Newton (8):
sim/arm: Prevent NULL pointer dereference in sim_create_inferior.
sim/arm: Prevent crash when running sim with no binary.
sim/ChangeLog: Correct bug number in previous commit.
ld/ARM: Fix script-type testsuite failure.
gdb/arm-tdep.c: Remove "Infinite loop detected" error message.
bfd/elfnn-aarch64.c: Fix miscalculation of GOTPLT offset for ifunc syms.
bfd/elfnn-aarch64.c: Handle static links with ifunc correctly.
ld/testsuite/ld-aarch64: Fixup IFUNC tests to work on all targets
Yao Qi (36):
Constify 'la_name' in struct language_defn
New field 'la_natural_name' in struct language_defn
Remove varobj_language_string, languages and varobj_languages
Fix typo
Remove 'whatever' in lib/mi-support.exp
Fix format issues in lib/mi-support.exp
Remove unnecessary '\'.
Move changelog entry to the right ChangeLog
Remove last_cache
Don't update target_dcache if it is not initialized
Move target-dcache out of target.c
Don't stress 'remote' in "Data Caching" in doc
Add REGISTRY for struct address_space.
Associate target_dcache to address_space.
set_address_space_data if dcache is NULL.
s/see @pxref/@pxref in doc
Doc 'dynamic' for command -var-list-children
Use mi_create_floating_varobj
Check has_more in mi_create_dynamic_varobj
Update doc on displayhint in command -var-list-children
Write "ON" and "OFF" in lower case in GDB doc.
GDB perf test on single step
Renaming in target-dcache.c
set/show code-cache
Use target_read_code in disassemble.
GDB perf test on backtrace
GDB perf test on disassemble
Delegate to target_ops->beneath for TARGET_OBJECT_RAW_MEMORY
Fix typo "checksm"
Fix PR remote/15974
Avoid "may be used uninitialized" warning
Use gdb_produce_source
Invalidate target cache before starting to handle event.
Use target_read_code in skip_prologue (i386)
Use target_read_code in skip_prologue (amd64)
Fix a bug in matching notifications.
Yufeng Zhang (8):
* elfxx-aarch64.c (_bfd_aarch64_elf_grok_prstatus): Fix hard-coded
bfd/
gas/
Revert "Add support for AArch64 trace unit registers."
gas/
Add support for armv7ve to gas.
Revert "Do not issue error messages when parsing a PSTATE register".
gas/testsuite/
bviyer (2):
Added Cilk runtime library (libcilkrts) into GCC.
Disable libcilkrts when C++ is not used.
ccoutant (1):
Fix demangler to handle conversion operators correctly.
gary (1):
libiberty/ 2013-10-25 Gary Benson <gbenson@redhat.com>
gerald (3):
Fix up ChangeLog entries (name, e-mail, formatting, otherwise).
* testsuite/test-expandargv.c: Include unistd.h.
* testsuite/test-demangle.c: Include unistd.h.
glisse (1):
2013-10-29 Marc Glisse <marc.glisse@inria.fr>
jason (1):
/ * Makefile.tpl (STAGE1_CONFIGURE_FLAGS): Pass --disable-build-format-warnings. gcc/ * configure.ac (loose_warn): Add -Wno-format if --disable-build-format-warnings.
law (1):
* Makefile.def (target_modules): Remove libmudflap (languages): Remove check-target-libmudflap). * Makefile.in: Rebuilt. * Makefile.tpl (check-target-libmudflap-c++): Remove. * configure.ac (target_libraries): Remove target-libmudflap. Remove checks which disabled libmudflap on some systems. * configure: Rebuilt. * libmudflap: Directory removed.
rsandifo (1):
include/ * longlong.h: New file.
schwab (1):
config/ * picflag.m4 (m68k-*-*): Use default PIC flag.
sterling (1):
2013-10-22 Sterling Augustine <saugustine@google.com>
tschwinge (2):
* Makefile.tpl: Fix typo. * Makefile.in: Regenerate.
* Makefile.in: Regenerate.
uros (1):
* cp-demangle.c (d_copy_templates): Cast result of malloc to (struct d_print_template *). (d_print_comp): Cast result of realloc to (struct d_saved scope *).
-----------------------------------------------------------------------
I have a need for these patches as well. While testing them, we noticed that the current PLT stubs have a bug: 0x0c00f240, /* movw ip, #0xNNNN */ 0x3c0cea4f, /* lsl ip, #12 */ 0x0c00f20f, /* addw ip, pc, #0xNNN */ 0xf000f8dc, /* ldr pc, [ip] */ The third instructions clobbers 'ip'. Thus for non-zero 'ip' values this will not work. One problem in coming up with a compact PLT, in present case, is that PC is not allowed to be a source operand in ADD (and OR) instructions that take register parameters (e.g. - add ip, pc - is illegal). So an intermediate register is needed. I suggest the following variant:
1: b401 push {r0}
2: f20f 0000 addw r0, pc, #0
3: f240 0c00 movw ip, #0x0000 ; Lower 16 bits of GOT entry offset from PC
4: f2c0 0c00 movt ip, #0x0000 ; Upper 16 bits of GOT entry offset from PC
5: 4484 add ip, r0
6: bc01 pop {r0}
7: f8dc f000 ldr.w pc, [ip]
This comes to 22 bytes but has the plus side that 32-bit offsets can be handled allowing GOT to be anywhere in the 32-bit address space.
Will thinking about it, I came to the following conclusion (only line 2 differs). It safes 2 byte.
1: push {r0}
2: mov r0, pc
3: movw ip, #0x0000 ; Lower 16 bits of GOT entry offset from PC
4: movt ip, #0x0000 ; Upper 16 bits of GOT entry offset from PC
5: add ip, r0
6: pop {r0}
7: ldr.w pc, [ip]
I missed an && in the ARM reference manual, :( add ip, pc Should be legal addw ip, pc, #0 is not. So we can rework my suggestion to: 1: f240 0c00 movw ip, #0x0000 ; Lower 16 bits of GOT entry offset 2: f2c0 0c00 movt ip, #0x0000 ; Upper 16 bits of GOT entry offset 3: 44fc add ip, pc 4: f8dc f000 ldr.w pc, [ip] This will result in the same size as in the Solution 3 by Markus. Right, my reading of the ARM manuals suggest that with 'ADD <Rdn>, <Rm>' (T2 encoding) that Rm can be PC. Only things like 'ADD PC, Rm' and 'ADD PC, PC' are unpredictable. I came up with a similar encoding: 0: f240 0c00 movw ip, #0 4: f2c0 0c00 movt ip, #0 8: 44fc add ip, pc a: f8dc f000 ldr.w pc, [ip] e: bf00 nop We might need the nop to group things into a multiple of 4. Created attachment 7414 [details]
v4 of patch, now with added mapping symbols
Hi Guys,
I have uploaded a revised version of the patch containing the fixed PLT entry code. If someone can confirm that this works I will be happy to check it in.
Note - this version of the patch also adds in setting the mapping symbols correctly so that the .plt section can be disassembled correctly.
Cheers
Nick
Hi Nick,
Thanks for the update. A few questions/observations:
1. I think the third mask on 'elf32_thumb2_plt_entry[1]' when applying
the constants should be '0x08000000' instead of '0x08000800'.
2. Why do we limit the offset to 24 bits? It seems the encoding allows
for a full 32 bits, e.g. a fourth line that does:
| ((got_displacement & 0xf0000000) >> 28)
I understand why the 'elf32_arm_plt_entry' has this limitation.
Created attachment 7415 [details]
Fix typo. Extend supported GOT offsets to 32-bits
Hi Meadori,
Ooops - you are right. The mask was a typo, and the lack of full 32-bit GOT offset support was just plain laziness. Please try out this revised version instead.
Cheers
Nick
Hi Nick, I just noticed that the mask for 'elf32_thumb2_plt_entry[0]' has the same typo, but the upper 8 needs to be removed instead. I had to squint to see it :-) Also, we should remove the 'BFD_ASSERT ((got_displacement & 0xf0000000) == 0)' assert now that 32-bit support is there. Other than that, looks good to me! Created attachment 7416 [details]
Fix another typo; remove assert
Hi Meadori,
Thanks again for checking the patch. I have uploaded another version. This time it will work and no-one will have to be nailed to anything. (Sorry - old quote...)
Cheers
Nick
Thanks Nick! The last version looks good. We will try some runtime testing on it. Hi Nick, The runtime testing we did with this patch worked for our use cases. Thanks again. This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gdb and binutils".
The branch, master has been updated
via eed94f8f8eddbd2268fc317508044bedc81a4e70 (commit)
from 1a8a700e3a6fd88bcd5b3988a1f738da463f5b1b (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=eed94f8f8eddbd2268fc317508044bedc81a4e70
commit eed94f8f8eddbd2268fc317508044bedc81a4e70
Author: Nick Clifton <nickc@redhat.com>
Date: Tue Mar 4 15:25:53 2014 +0000
Install patch for PR ld/16017. This adds support for generating PLT entries
using Thumb2 instructions for those cores which do not support the ARM ISA.
* elf32-arm.c (elf32_thumb2_plt0_entry): New array.
(elf32_thumb2_plt_entry): New array.
(elf32_arm_create_dynamic_sections): Set PLT entry sizes when
using thumb2 based PLT.
(elf32_arm_populate_plt_entry): Handle generating Thumb2 based PLT
entries.
(elf32_arm_final_link_relocate): Do not bias jumps to Thumb based
PLT entries.
(elf32_arm_finish_dynamic_sections): Handle creation of Thumb2
based PLT 0-entry.
(elf32_arm_output_plt_map_1): Handle creation of local symbols for
Thumb2 based PLT 0-entry.
(elf32_arm_output_arch_local_syms): Handle creation of local
symbols for Thumb2 based PLT entries.
-----------------------------------------------------------------------
Summary of changes:
bfd/ChangeLog | 18 +++++
bfd/elf32-arm.c | 188 ++++++++++++++++++++++++++++++++++++++++++------------
2 files changed, 164 insertions(+), 42 deletions(-)
I have checked in the final version of the patch. Looks like the initial GOT entries pointing to PLT0 are missing Thumb bit being set. The current version will transition out of Thumb mode and crash. The master branch has been updated by Tamar Christina <tnfchris@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=a7618269b727da9cf56727c22cb538ff5f0e4d25 commit a7618269b727da9cf56727c22cb538ff5f0e4d25 Author: Tamar Christina <tamar.christina@arm.com> Date: Wed Apr 1 10:47:18 2020 +0100 Arm: Fix LSB of GOT for Thumb2 only PLT. When you have a Thumb only PLT then the address in the GOT for PLT0 needs to have the Thumb bit set since the instruction used in PLTn to get there is `ldr.w pc` which is an inter-working instruction: the PLT sequence in question is 00000120 <foo@plt>: 120: f240 0c98 movw ip, #152 ; 0x98 124: f2c0 0c01 movt ip, #1 128: 44fc add ip, pc 12a: f8dc f000 ldr.w pc, [ip] 12e: e7fc b.n 12a <foo@plt+0xa> Disassembly of section .text: 00000130 <bar>: 130: b580 push {r7, lr} 132: af00 add r7, sp, #0 134: f7ff fff4 bl 120 <foo@plt> and previously the linker would generate Hex dump of section '.got': ... 0x000101b8 40010100 00000000 00000000 10010000 @............... Which would make it jump and transition out of thumb mode and crash since you only have thumb mode on such cores. Now it correctly generates Hex dump of section '.got': ... 0x000101b8 40010100 00000000 00000000 11010000 @............... Thanks to Amol for testing patch and to rgujju for reporting it. bfd/ChangeLog: PR ld/16017 * elf32-arm.c (elf32_arm_populate_plt_entry): Set LSB of the PLT0 address in the GOT if in thumb only mode. ld/ChangeLog: PR ld/16017 * testsuite/ld-arm/arm-elf.exp (thumb-plt-got): New. * testsuite/ld-arm/thumb-plt-got.d: New test. The master branch has been updated by Tamar Christina <tnfchris@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=3ce23ca1de4c769c4b7247f0724a10ef5fb24a11 commit 3ce23ca1de4c769c4b7247f0724a10ef5fb24a11 Author: Tamar Christina <tamar.christina@arm.com> Date: Wed Apr 1 18:31:22 2020 +0100 Arm: Skip Thumb2 PLT tests on NaCL. NaCL does not support dynamic linking and so these tests should be skipped under it. ld/ChangeLog: PR ld/16017 * testsuite/ld-arm/arm-elf.exp (thumb-plt, thumb-plt-got): Skip for NaCL. The binutils-2_34-branch branch has been updated by Tamar Christina <tnfchris@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=aaf3f0599a210699a76767c07a7d7f62d7633d71 commit aaf3f0599a210699a76767c07a7d7f62d7633d71 Author: Tamar Christina <tamar.christina@arm.com> Date: Wed Apr 1 10:47:18 2020 +0100 Arm: Fix LSB of GOT for Thumb2 only PLT. When you have a Thumb only PLT then the address in the GOT for PLT0 needs to have the Thumb bit set since the instruction used in PLTn to get there is `ldr.w pc` which is an inter-working instruction: the PLT sequence in question is 00000120 <foo@plt>: 120: f240 0c98 movw ip, #152 ; 0x98 124: f2c0 0c01 movt ip, #1 128: 44fc add ip, pc 12a: f8dc f000 ldr.w pc, [ip] 12e: e7fc b.n 12a <foo@plt+0xa> Disassembly of section .text: 00000130 <bar>: 130: b580 push {r7, lr} 132: af00 add r7, sp, #0 134: f7ff fff4 bl 120 <foo@plt> and previously the linker would generate Hex dump of section '.got': ... 0x000101b8 40010100 00000000 00000000 10010000 @............... Which would make it jump and transition out of thumb mode and crash since you only have thumb mode on such cores. Now it correctly generates Hex dump of section '.got': ... 0x000101b8 40010100 00000000 00000000 11010000 @............... Thanks to Amol for testing patch and to rgujju for reporting it. bfd/ChangeLog: PR ld/16017 * elf32-arm.c (elf32_arm_populate_plt_entry): Set LSB of the PLT0 address in the GOT if in thumb only mode. ld/ChangeLog: PR ld/16017 * testsuite/ld-arm/arm-elf.exp (thumb-plt-got): New. * testsuite/ld-arm/thumb-plt-got.d: New test. (cherry picked from commit a7618269b727da9cf56727c22cb538ff5f0e4d25) (cherry picked from commit 3ce23ca1de4c769c4b7247f0724a10ef5fb24a11) fixed in master and 2.34 The master branch has been updated by Alan Modra <amodra@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=bd8942a0e049a466f9b649364bf53445fb47dd0c commit bd8942a0e049a466f9b649364bf53445fb47dd0c Author: Alan Modra <amodra@gmail.com> Date: Mon May 11 09:17:42 2026 +0930 arm: delay setting of plt header and entry size elf32_arm_create_dynamic_sections was used to set plt_header_size and plt_entry_size. This necessitated a hack for using_thumb_only() as the output file attributes used by that function are not set until lang_check calls bfd_merge_private_bfd_data. Now the earliest use of plt_header_size and plt_entry_size is in elf32_arm_late_size_sections, called from bfd_elf_size_dynamic_sections. So this patch moves the initialisation of these variables to elf32_arm_late_size_sections. Initialising them there is after lang_check runs, and also guarantees they are initialised for all later uses too. The patch also moves initialisation of htab->stub_bfd earlier, and calls to add_glue_sections_to_bfd and get_bfd_for_interworking from ld/armelf.em to bfd/elf32-arm.c. I removed an abort in elf32_arm_create_dynamic_sections too. It really doesn't improve confidence that much to check that a function you have just called to create dynamic sections has done its job. PR 16017 bfd/ * elf32-arm.c (elf32_arm_plt_needs_thumb_stub_p): Formatting. (elf32_arm_create_dynamic_sections): Remove abort. Move initialisation of plt_header_size and plt_entry_size to.. (elf32_arm_late_size_sections): ..here. (bfd_elf32_arm_add_glue_sections_to_bfd), (bfd_elf32_arm_get_bfd_for_interworking): Make static. (bfd_elf32_arm_set_target_params): Add stub_bfd param. Remove output_bfd param. Make params const. Init globals->stub_bfd. Set flags and EI_CLASS for stub_bfd. Call add_glue_sections_to_bfd and get_bfd_for_interworking. * elf32-arm.h (bfd_elf32_arm_add_glue_sections_to_bfd), (bfd_elf32_arm_get_bfd_for_interworking): Delete declarations. (bfd_elf32_arm_set_target_params): Update prototype. ld/ * emultempl/armelf.em (arm_elf_create_output_section_statements): Don't set stub bfd flags here, or call add_glue_sections_to_bfd and get_bfd_for_interworking. Pass stub bfd to set_target_params. |
When compiling a shared library for cortex-M3, ld creates ARM instructions for jumping to the plt and the plt itself. But the cortex only supports thumb instructions, which results in a runtime error. Test case: compile test.c with arm-none-eabi-gcc -fPIC -nostartfiles -nostdlib -mcpu=cortex-m3 -mthumb -shared -o libtest.so test.c test.c: int foo(); int bar() { return foo(); } Result: Disassembly of section .plt: 00000238 <.plt>: 238: e52de004 push {lr} ; (str lr, [sp, #-4]!) 23c: e59fe004 ldr lr, [pc, #4] ; 248 <bar-0x10> 240: e08fe00e add lr, pc, lr 244: e5bef008 ldr pc, [lr, #8]! 248: 00008098 muleq r0, r8, r0 24c: e28fc600 add ip, pc, #0, 12 250: e28cca08 add ip, ip, #8, 20 ; 0x8000 254: e5bcf098 ldr pc, [ip, #152]! ; 0x98 Disassembly of section .text: 00000258 <bar>: 258: b580 push {r7, lr} 25a: af00 add r7, sp, #0 25c: f7ff eff6 blx 24c <bar-0xc> 260: 4603 mov r3, r0 262: 4618 mov r0, r3 264: bd80 pop {r7, pc} 266: bf00 nop 24c, 250, 254 as well as 25c are ARM instructions and therefore invalid on cortex-m3 cores. Possible related bugs: bz#13320: Similar issue on gold bz#13867: maybe related bz#15628: similar issue in cortex-m4