Skip to content
Snippets Groups Projects
  1. Mar 11, 2023
  2. Mar 10, 2023
    • Vladimir Mezentsev's avatar
      gprofng: PR30195 [display text] Source code location can not be found · f4bcff7c
      Vladimir Mezentsev authored
      gprofng/ChangeLog
      2023-03-10  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>
      
      	PR gprofng/30195
      	gprofng/src/DwarfLib.cc (DwrLineRegs::reset): Set 'file = 1;'.
      f4bcff7c
    • John Baldwin's avatar
      PR gdb/30214: Prefer local include paths to system include paths · a2fbb690
      John Baldwin authored
      Some systems may install binutils headers into a system location
      (e.g. /usr/local/include on FreeBSD) which may also include headers
      for other external packages used by GDB such as zlib or zstd.  If a
      system include path such as /usr/local/include is added before local
      include paths to directories within a clone or release tarball, then
      headers from the external binutils package are used which can result
      in build failures if the external binutils package is out of sync with
      the version of GDB being built.
      
      To fix, sort the include paths in INTERNAL_CFLAGS_BASE to add CFLAGS
      for "local" componenets before external components.
      
      Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30214
      
      
      Reviewed-By: default avatarTom Tromey <tom@tromey.com>
      a2fbb690
    • Fangrui Song's avatar
      ld: Allow R_386_GOT32 for call *__tls_get_addr@GOT(%reg) · 2cef4842
      Fangrui Song authored
      Similar to d58854b6 for x86_64.
      
      _Thread_local int a;
      int main() { return a; }
      
      % gcc -m32 -fno-plt -fpic a.c -fuse-ld=bfd -Wa,-mrelax-relocations=no
      /usr/bin/ld.bfd: /tmp/ccR8Yexy.o: TLS transition from R_386_TLS_GD to R_386_TLS_IE_32 against `a' at 0x15 in section `.text' failed
      /usr/bin/ld.bfd: failed to set dynamic section sizes: bad value
      collect2: error: ld returned 1 exit status
      
      This commit fixes the issue.
      
      There is an argument that the -fno-plt TLS sequence was added after
      R_386_GOT32X was required for call *func@GOT(%ebx), so R_386_GOT32 was
      intended to be unsupported.
      
      Unfortunately this standpoint has caused interop difficulty: some
      projects specify -mrelax-relocations=no to build relocatable object
      files compatible with older linkers (e.g.
      https://github.com/IHaskell/IHaskell/issues/636) or do so by accident
      (e.g. https://github.com/rust-lang/rust/pull/106511 not addressed as of
      today).  Many uses have not been cleaned up in practice, and compiling
      with -fno-plt will lead to the `TLS transition from R_386_TLS_GD ...`
      error which is hard to reason about.
      
      It seems easier to apply this simple change to prevent the footgun.
      
          PR ld/24784
          * bfd/elf32-i386.c (elf_i386_check_tls_transition): Allow R_386_GOT32.
      2cef4842
    • Fangrui Song's avatar
      ld: Allow R_X86_64_GOTPCREL for call *__tls_get_addr@GOTPCREL(%rip) · d58854b6
      Fangrui Song authored
      _Thread_local int a;
      int main() { return a; }
      
      % gcc -fno-plt -fpic a.c -fuse-ld=bfd -Wa,-mrelax-relocations=no
      /usr/bin/ld.bfd: /tmp/ccSSBgrg.o: TLS transition from R_X86_64_TLSGD to R_X86_64_GOTTPOFF against `a' at 0xd in section `.text' failed
      /usr/bin/ld.bfd: failed to set dynamic section sizes: bad value
      collect2: error: ld returned 1 exit status
      
      This commit fixes the issue.
      
      There is an argument that the -fno-plt TLS sequence was added after
      R_X86_64_GOTPCRELX was required for call, so R_X86_64_GOTPCREL was
      intended to be unsupported.
      
      Unfortunately this standpoint has caused interop difficulty: some
      projects specify -mrelax-relocations=no to build relocatable object
      files compatible with older linkers (e.g.
      https://github.com/IHaskell/IHaskell/issues/636) or do so by accident
      (e.g. https://github.com/rust-lang/rust/pull/106511 not addressed as of
      today).  Many uses have not been cleaned up in practice, and compiling
      with -fno-plt will lead to the `TLS transition from R_X86_64_TLSGD ...`
      error which is hard to reason about.
      
      There is another argument which may be weaker but relevant to the
      necessity of -mrelax-relocations=no: HWAddressSanitizer x86-64 will
      likely need some assembler support to disable relaxation.  Without the
      support and if the compiler needs to support many gas version, the
      simplest solution would be to use -Wa,-mrelax-relocations=no.
      
          PR ld/24784
          * bfd/elf64-x86-64.c (elf_x86_64_check_tls_transition): Allow
            R_X86_64_GOTPCREL.
      d58854b6
    • Tom de Vries's avatar
      [gdb/testsuite] Fix gdb.python/py-completion.exp · 7f3294a9
      Tom de Vries authored
      With test-case gdb.python/py-completion.exp and target board
      native-extended-gdbserver I get this warning:
      ...
      (gdb) PASS: gdb.python/py-completion.exp: discard #2
      completefilecommandcond $outputs/gdb.python/py-completion/py-completion-t^G\
        PASS: gdb.python/py-completion.exp: completefilecommandcond completion
      Remote debugging from host ::1, port 53346^M
      monitor exit^M
      not implemented^M
      (gdb) WARNING: Timed out waiting for EOF in server after monitor exit
      ...
      
      Fix this by adding the missing "discard #3", such that we have instead:
      ...
      (gdb) PASS: gdb.python/py-completion.exp: discard #2
      completefilecommandcond $outputs/gdb.python/py-completion/py-completion-t^G\
        PASS: gdb.python/py-completion.exp: completefilecommandcond completion
       ^M
      not implemented^M
      (gdb) PASS: gdb.python/py-completion.exp: discard #3
      Remote debugging from host ::1, port 36278^M
      monitor exit^M
      (gdb)
      ...
      
      Tested on x86_64-linux.
      7f3294a9
    • Tom de Vries's avatar
      [gdb/testsuite] Fix gdb.python/py-cmd.exp · 254de262
      Tom de Vries authored
      [ Using $pp as shorthand for the pagination prompt
      "--Type <RET> for more, q to quit, c to continue without paging--". ]
      
      The test-case gdb.python/py-cmd.exp passes, but the handling of the
      test_multiline command output looks a bit odd:
      ...
      (gdb) test_multiline
      test_multiline output
        ...
      test_multiline output
      $ppPASS: gdb.python/py-cmd.exp: verify pagination from test_multiline
      q
      test_multiline
      Quit
      (gdb) test_multiline
      test_multiline output
        ...
      test_multiline output
      $ppPASS: gdb.python/py-cmd.exp: verify pagination from test_multiline: q
      ...
      
      What happens is:
      - a test_multiline command is issued
      - some output is printed, followed by a pagination prompt
      - the test-case concludes that pagination occurred, and produces a PASS
      - "q\n" is replied to the pagination prompt
      - without waiting for response to the "q\n", another test_multiline command is
        issued
      - in response to the "q\n" we get "Quit\n(gdb) "
      - some output is printed, followed by a pagination prompt
      - the test-case concludes that there's a valid response to the "q\n", and
        produces a PASS, consuming the second pagination prompt, but without a reply.
      
      My conclusion is that the second test_multiline command is unintentional, so fix
      this by removing it.
      
      Without it, we have the more straightforward:
      ...
      (gdb) test_multiline
      test_multiline output
        ...
      test_multiline output
      $ppPASS: gdb.python/py-cmd.exp: verify pagination from test_multiline
      q
      Quit
      (gdb) PASS: gdb.python/py-cmd.exp: verify pagination from test_multiline: q
      ...
      
      This also fixes the following warning with target board native-gdbserver:
      ...
      WARNING: Timed out waiting for EOF in server after monitor exit
      ...
      
      Tested on x86_64-linux.
      254de262
    • Tom de Vries's avatar
      [gdb/testsuite] Fix py-autoloaded-pretty-printers-in-newobjfile-event.exp for remote target · ddc003b7
      Tom de Vries authored
      With test-case gdb.python/py-autoloaded-pretty-printers-in-newobjfile-event.exp
      and target board remote-gdbserver-on-localhost, I run into:
      ...
      FAIL: $exp: runto: run to main
      ...
      
      I can easily fix this using "gdb_load_shlib $binfile_lib", but then run into:
      ...
      (gdb) print all_good^M
      $1 = false^M
      (gdb) FAIL: $exp: print all_good
      info pretty-printer^M
      ...
      
      Sysroot is set to "target:", so gdb downloads the shared library from the target
      (Using $so as shorthand for
      libpy-autoloaded-pretty-printers-in-newobjfile-event.so):
      ...
      Reading /home/remote-target/$so from remote target...^M
      ...
      and internally refers to it as "target:/home/remote-target/$so".
      
      In load_auto_scripts_for_objfile, gdb gives up trying to auto-load scripts
      for $so once it checks for is_target_filename.
      
      Fix this by declaring auto-load unsupported if sysroot starts with "target:".
      
      Tested on x86_64-linux.
      ddc003b7
    • Tom de Vries's avatar
      [gdb/testsuite] Fix gdb.python/py-event-load.exp for remote target · 69b956fb
      Tom de Vries authored
      Fix test-case gdb.python/py-event-load.exp for target board
      remote-gdbserver-on-localhost using gdb_download_shlib.
      
      Tested on x86_64-linux.
      69b956fb
    • Tom Tromey's avatar
      Use require with test_compiler_info · 6349d27e
      Tom Tromey authored
      One spot that checks test_compiler_info can be switched to use
      'require'.
      
      
      6349d27e
    • Tom Tromey's avatar
      More uses of require with istarget · 24d59b55
      Tom Tromey authored
      I found a few more spots that check istarget that can be switched to
      use 'require'.
      
      
      24d59b55
    • Tom Tromey's avatar
      Use require with gdb_skip_stdio_test · b8d7ef3f
      Tom Tromey authored
      One use of gdb_skip_stdio_test can use 'require'.
      
      
      b8d7ef3f
    • Tom Tromey's avatar
      Use require with target_info · 450d26c8
      Tom Tromey authored
      This changes many tests to use 'require' when checking target_info.
      In a few spots, the require is hoisted to the top of the file, to
      avoid doing any extra work when the test is going to be skipped
      anyway.
      
      
      450d26c8
    • Tom Tromey's avatar
      Move allocate_stub_method to stabsread.c · 1cd0716e
      Tom Tromey authored
      allocate_stub_method is only called from stabsread.c, and I don't
      think it will be needed anywhere else.  So, move it and make it
      static.  Tested by rebuilding.
      
      1cd0716e
    • Alan Modra's avatar
      Revert ld ASCII support · a4d5aec7
      Alan Modra authored
      Revert "Prevent the ASCII linker script directive from generating huge amounts of padding if the size expression is not a constant."
      This reverts commit adbe951f.
      
      Revert "ld test asciz and ascii fails"
      This reverts the ascii.d part of commit 5f497256.
      
      Revert "Add support for the ASCII directive inside linker scripts."
      This mostly reverts commit 9fe129a4
      leaving the asciz.d and asciz.t changes in place.
      a4d5aec7
    • Alan Modra's avatar
      Revert ld DIGEST support · 75bd292b
      Alan Modra authored
      This is a hopefully temporary reversion of new ld features for
      embedded processors by Ulf Samuelsson, plus some followup patches.
      
      Squashed together from the following:
      
      Revert "lddigest 32-bit support and gcc-4 compile errors"
      This reverts commit d7ee19be87110a8f5342cec6e323d83d01c641d1.
      
      Revert "ld: Use correct types for crc64 calculations"
      This reverts commit 9a534b9f.
      
      Revert "Re: DIGEST: testsuite"
      This reverts commit c8e85484.
      
      Revert "Regen potfiles"
      This reverts commit 4d98c966.
      
      Revert "DIGEST: Makefile.*"
      This reverts commit 78ef6ab0.
      
      Revert "DIGEST: calculation"
      This reverts commit 52439901.
      
      Revert "DIGEST: ldlang.*: add timestamp"
      This reverts commit bd9466d4.
      
      Revert "DIGEST: ldmain.c"
      This reverts commit c8f8653f.
      
      Revert "DIGEST: ldgram.y"
      This reverts commit d73c01be.
      
      Revert "DIGEST: ldlex.l"
      This reverts commit 48b5163a.
      
      Revert "DIGEST: testsuite"
      This reverts commit a4135d1a.
      
      Revert "DIGEST: Documentation"
      This reverts commit 3ec28966.
      
      Revert "DIGEST: NEWS"
      This reverts commit 099bf292.
      
      Revert "DIGEST: LICENSING"
      This reverts commit 5c8a0c66.
      75bd292b
    • Jan Beulich's avatar
      Arm64/gas: drop redundant feature prereqs · 36ba37c0
      Jan Beulich authored
      Logic exists to deal with prereqs or prereqs, and in many cases
      transitive prereqs are already not spelled out explicitly. Drop further
      ones:
      - FP is already a prereq to F16,
      - SIMD and F16 are already prereqs to COMPNUM, and
      - SVE2 and BFLOAT16 are already prereqs to SME.
      36ba37c0
    • Jan Beulich's avatar
      Arm64/gas: add missing prereq features · 96a3eed7
      Jan Beulich authored
      A number of newer features are really SIMD or FP extensions, but don't
      have this properly specified.
      96a3eed7
    • Jan Beulich's avatar
      x86: decouple broadcast type and bytes fields · 9b345ce8
      Jan Beulich authored
      Keep both representing exclusively what was parsed from input, to avoid
      the need for (potentially bogus) calculations when processing .insn.
      9b345ce8
    • Jan Beulich's avatar
      x86-64: adjust REX-prefix part of SSE2AVX test · e959ac94
      Jan Beulich authored
      Before altering how build_modrm_byte() works, arrange for this part of
      the testcase to actually use distinguishable source and destination
      register numbers, such that incorrect propagation of, in particular, the
      high bit encodings (from REX to VEX) can be noticed (in turn
      specifically assertions [not] triggering in the respective code).
      e959ac94
    • Jan Beulich's avatar
      x86: move more disp processing out of md_assemble() · 0de704b9
      Jan Beulich authored
      Put it in optimize_disp() such that it can then be re-used by .insn
      handling. The movement makes it necessary (or at least very desirable,
      to avoid introducing a fragile cast) to convert to local variable to
      "unsigned", which in turn requires an adjustment to the pre-existing
      loop header.
      
      Having the caller pass in the specific template under consideration has
      another benefit then: We can replace the two uses of current_templates
      in the function as well, thus no longer looking at some merely "related"
      template. (This may allow further tightening, but if so that's to be the
      subject of another change.)
      0de704b9
    • Jan Beulich's avatar
      x86: use set_rex_vrex() also for short-form handling · 0a3eba42
      Jan Beulich authored
      This is benign for all existing insns, but is going to be needed for
      handling of .insn operands. The earlier use requires moving up the
      function, to avoid the need for a forward declaration.
      0a3eba42
    • Alan Modra's avatar
      eh static data · 4148b4fe
      Alan Modra authored
      Fix another case of oss-fuzz tripping over gas static state,
      ie. starting over testing another input file with rubbish left
      uncleared in bss.  size_end_sym pointed at garbage.
      
      	* ehopt.c (get_cie_info): Delete forward declaration.
      	(struct frame_data): Move to file scope.
      	(frame): New static, packaged..
      	(check_eh_frame): ..eh_frame_data and debug_frame_data.
      	(eh_begin): New function.
      	* as.c (gas_init): Call eh_begin.
      	* as.h (eh_begin): Declare.
      4148b4fe
    • GDB Administrator's avatar
      Automatic date update in version.in · 8325b42c
      GDB Administrator authored
      8325b42c
  3. Mar 09, 2023
    • Simon Marchi's avatar
      gdb, gdbserver, gdbsupport: fix whitespace issues · 287de656
      Simon Marchi authored
      Replace spaces with tabs in a bunch of places.
      
      Change-Id: If0f87180f1d13028dc178e5a8af7882a067868b0
      287de656
    • Tom de Vries's avatar
      [gdb/testsuite] Fix gdb.threads/pending-fork-event-detach.exp for remote target · 2562954e
      Tom de Vries authored
      Fix test-case gdb.threads/pending-fork-event-detach.exp for target board
      remote-gdbserver-on-localhost using gdb_remote_download for $touch_file_bin.
      
      Then, fix the test-case for target board remote-stdio-gdbserver with
      REMOTE_TMPDIR=~/tmp.remote-stdio-gdbserver by creating $touch_file_path
      on target using remote_download, and using the resulting path.
      
      Tested on x86_64-linux.
      2562954e
    • Alan Modra's avatar
      objdump: report no section contents · 093b5677
      Alan Modra authored
      objdump's read_section is never used for bss-style sections, so to
      plug a hole that fuzzers have found, exclude sections without
      SEC_HAS_CONTENTS.
      
      	* objdump.c (read_section): Report and return an error on
      	a no contents section.
      093b5677
    • Alan Modra's avatar
      gas: allow frag address wrapping in absolute section · 2dc2dfa7
      Alan Modra authored
      This:
      	 .struct -1
      	x:
      	 .fill 1
      	y:
      results in an internal error in frag_new due to abs_section_offset
      wrapping from -1 to 0.  Frags in the absolute section don't do much so
      I think we can allow the address wrap.
      
      	* frags.c (frag_new): Allow address wrap in absolute section.
      2dc2dfa7
    • Tom de Vries's avatar
      [gdb/testsuite] Fix gdb.threads/multiple-successive-infcall.exp on native-gdbserver · f2be4eeb
      Tom de Vries authored
      With test-case gdb.threads/multiple-successive-infcall.exp and target board
      native-gdbserver I run into:
      ...
      (gdb) continue^M
      Continuing.^M
      [New Thread 758.759]^M
      ^M
      Thread 1 "multiple-succes" hit Breakpoint 2, main () at \
        multiple-successive-infcall.c:97^M
      97            thread_ids[tid] = tid + 2; /* prethreadcreationmarker */^M
      (gdb) FAIL: gdb.threads/multiple-successive-infcall.exp: thread=5: \
        created new thread
      ...
      
      The problem is that the new thread message doesn't match the regexp, which
      expects something like this instead:
      ...
      [New Thread 0x7ffff746e700 (LWP 570)]^M
      ...
      
      Fix this by accepting this form of new thread message.
      
      Tested on x86_64-linux.
      f2be4eeb
    • Tom de Vries's avatar
      [gdb/testsuite] Fix gdb.threads/thread-specific-bp.exp on native-gdbserver · 89702edd
      Tom de Vries authored
      With test-case gdb.threads/thread-specific-bp.exp and target board
      native-gdbserver I run into:
      ...
      (gdb) PASS: gdb.threads/thread-specific-bp.exp: non_stop=off: thread 1 selected
      continue^M
      Continuing.^M
      Thread-specific breakpoint 3 deleted - thread 2 no longer in the thread list.^M
      ^M
      Thread 1 "thread-specific" hit Breakpoint 4, end () at \
        thread-specific-bp.c:29^M
      29      }^M
      (gdb) FAIL: gdb.threads/thread-specific-bp.exp: non_stop=off: \
        continue to end (timeout)
      ...
      
      The problem is that the test-case tries to match the "[Thread ... exited]"
      message which we do see with native testing:
      ...
      Continuing.^M
      [Thread 0x7ffff746e700 (LWP 7047) exited]^M
      Thread-specific breakpoint 3 deleted - thread 2 no longer in the thread list.^M
      ...
      
      The fact that the message is missing was reported as PR remote/30129.
      
      We could add a KFAIL for this, but the functionality the test-case is trying
      to test has nothing to do with the message, so it should pass.  I only added
      matching of the message in commit 2e5843d8 ("[gdb/testsuite] Fix
      gdb.threads/thread-specific-bp.exp") to handle a race, not realizing doing so
      broke testing on native-gdbserver.
      
      Fix this by matching the "Thread-specific breakpoint $decimal deleted" message
      instead.
      
      Tested on x86_64-linux.
      89702edd
    • Tom de Vries's avatar
      [gdb/testsuite] Fix gdb.server/*.exp for remote target · 64c9b639
      Tom de Vries authored
      Fix test-cases for target board remote-gdbserver-on-localhost by using
      gdb_remote_download.
      
      Tested on x86_64-linux.
      64c9b639
    • Tom de Vries's avatar
      [gdb/testsuite] Fix gdb.server/unittest.exp for remote target · b40b8fac
      Tom de Vries authored
      With test-case gdb.server/unittest.exp and a build with --disable-unit-tests I
      get:
      ...
      (gdb) builtin_spawn /data/vries/gdb/leap-15-4/build/gdbserver/gdbserver \
        --selftest^M
      Selftests have been disabled for this build.^M
      UNSUPPORTED: gdb.server/unittest.exp: unit tests
      ...
      but with target board remote-stdio-gdbserver I get instead:
      ...
      (gdb) builtin_spawn /usr/bin/ssh -t -l vries localhost \
        /data/vries/gdb/leap-15-4/build/gdbserver/gdbserver --selftest^M
      Selftests have been disabled for this build.^M
      Connection to localhost closed.^M^M
      FAIL: gdb.server/unittest.exp: unit tests
      ...
      
      Fix this by making the regexp less strict.
      
      Tested on x86_64-linux.
      b40b8fac
    • Tom de Vries's avatar
      [gdb/testsuite] Fix gdbserver path in remote-stdio-gdbserver.exp · 593dda18
      Tom de Vries authored
      With test-case gdb.server/unittest.exp and target board remote-stdio-gdbserver
      I run into:
      ...
      (gdb) builtin_spawn /usr/bin/ssh -t -l vries localhost /usr/bin/gdbserver \
        --selftest^M
      Selftests have been disabled for this build.^M
      UNSUPPORTED: gdb.server/unittest.exp: unit tests
      ...
      due to using the system gdbserver /usr/bin/gdbserver rather than the one from
      the build.
      
      Fix this by removing the hard-coding of /usr/bin/gdbserver in
      remote-stdio-gdbserver, allowing find_gdbserver to do its work, such that we
      have instead:
      ...
      (gdb) builtin_spawn /usr/bin/ssh -t -l vries localhost \
        /data/vries/gdb/leap-15-4/build/gdbserver/gdbserver --selftest^M
      Running selftest remote_memory_tagging.^M
      Ran 1 unit tests, 0 failed^M
      Connection to localhost closed.^M^M
      PASS: gdb.server/unittest.exp: unit tests
      ...
      
      Tested on x86_64-linux.
      593dda18
    • Tom de Vries's avatar
      [gdb/testsuite] Fix gdb.server/sysroot.exp for remote target · 6407713f
      Tom de Vries authored
      Fix test-case gdb.server/sysroot.exp with target board
      remote-gdbserver-on-localhost, by:
      - using gdb_remote_download, and
      - disabling the "local" scenario for remote host.
      
      Tested on x86_64-linux.
      6407713f
    • Tom de Vries's avatar
      [gdb/testsuite] Fix gdb.server/multi-ui-errors.exp for remote target · ed32754a
      Tom de Vries authored
      Test-case gdb.server/multi-ui-errors.exp fails for target board
      remote-gdbserver-on-localhost with REMOTE_TARGET_USERNAME=remote-target:
      ...
      (gdb) PASS: gdb.server/multi-ui-errors.exp: interact with GDB's main UI
      Executing on target: kill -9 6447    (timeout = 300)
      builtin_spawn [open ...]^M
      XYZ1ZYX
      sh: line 0: kill: (6447) - Operation not permitted
      ...
      
      The problem is that the kill command:
      ...
      remote_exec target "kill -9 $gdbserver_pid"
      ...
      intended to kill gdbserver instead tries to kill the ssh client session in
      which the gdbserver runs, and fails because it's trying as the remote target
      user (remote-target on localhost) to kill a pid owned by the the build user
      ($USER on localhost).
      
      Fix this by getting the gdbserver pid using the ppid trick from
      server-kill.exp.
      
      Likewise in gdb.server/server-kill-python.exp.
      
      Tested on x86_64-linux.
      ed32754a
Loading