Commit Graph

106102 Commits

Author SHA1 Message Date
Nick Alcock
49da556c65 libctf, include: support an alternative encoding for nonrepresentable types
Before now, types that could not be encoded in CTF were represented as
references to type ID 0, which does not itself appear in the
dictionary. This choice is annoying in several ways, principally that it
forces generators and consumers of CTF to grow special cases for types
that are referenced in valid dicts but don't appear.

Allow an alternative representation (which will become the only
representation in format v4) whereby nonrepresentable types are encoded
as actual types with kind CTF_K_UNKNOWN (an already-existing kind
theoretically but not in practice used for padding, with value 0).
This is backward-compatible, because CTF_K_UNKNOWN was not used anywhere
before now: it was used in old-format function symtypetabs, but these
were never emitted by any compiler and the code to handle them in libctf
likely never worked and was removed last year, in favour of new-format
symtypetabs that contain only type IDs, not type kinds.

In order to link this type, we need an API addition to let us add types
of unknown kind to the dict: we let them optionally have names so that
GCC can emit many different unknown types and those types with identical
names will be deduplicated together.  There are also small tweaks to the
deduplicator to actually dedup such types, to let opening of dicts with
unknown types with names work, to return the ECTF_NONREPRESENTABLE error
on resolution of such types (like ID 0), and to print their names as
something useful but not a valid C identifier, mostly for the sake of
the dumper.

Tests added in the next commit.

include/ChangeLog
2021-05-06  Nick Alcock  <nick.alcock@oracle.com>

	* ctf.h (CTF_K_UNKNOWN): Document that it can be used for
	nonrepresentable types, not just padding.
	* ctf-api.h (ctf_add_unknown): New.

libctf/ChangeLog
2021-05-06  Nick Alcock  <nick.alcock@oracle.com>

	* ctf-open.c (init_types): Unknown types may have names.
	* ctf-types.c (ctf_type_resolve): CTF_K_UNKNOWN is as
	non-representable as type ID 0.
	(ctf_type_aname): Print unknown types.
	* ctf-dedup.c (ctf_dedup_hash_type): Do not early-exit for
	CTF_K_UNKNOWN types: they have real hash values now.
	(ctf_dedup_rwalk_one_output_mapping): Treat CTF_K_UNKNOWN types
	like other types with no referents: call the callback and do not
	skip them.
	(ctf_dedup_emit_type): Emit via...
	* ctf-create.c (ctf_add_unknown): ... this new function.
	* libctf.ver (LIBCTF_1.2): Add it.
2021-05-06 09:30:59 +01:00
Yoshinori Sato
15091ded14 sim: h8300 special case test
In "mov. [bwl] reg, @ -reg", added a special case test
using the same register.
2021-05-06 17:11:49 +09:00
Mike Frysinger
75070a4ede sim: m32c/rl78/rx: fix command parsing
Use buildargv to avoid writing to const memory and freeing invalid
pointers, and to avoid doing any string parsing ourselves.
2021-05-05 23:33:16 -04:00
H.J. Lu
4467df35a9 elf: Always append ".COUNT" to local symbols
Always append ".COUNT" to local symbols to avoid potential conflicts
with existing local symbol "XXX.COUNT".

bfd/

	PR ld/27825
	* elflink.c (elf_link_output_symstrtab): Always append ".COUNT"
	to local symbols.

ld/

	PR ld/27825
	* testsuite/ld-elf/pr27825-1.d: New file.
	* testsuite/ld-elf/pr27825-1a.s: Likewise.
	* testsuite/ld-elf/pr27825-1b.s: Likewise.
	* testsuite/ld-elf/pr27825-2.d: Likewise.
	* testsuite/ld-elf/pr27825-2a.s: Likewise.
	* testsuite/ld-elf/pr27825-2b.s: Likewise.
2021-05-05 20:29:01 -07:00
GDB Administrator
9311cd60e1 Automatic date update in version.in 2021-05-06 00:00:37 +00:00
Tom de Vries
2f000c80e2 [gdb/testsuite] Fix timeout in gdb.threads/detach-step-over.exp with readnow
When running test-case gdb.threads/detach-step-over.exp with target board
readnow, I run into:
...
Reading symbols from /lib64/libc.so.6...^M
Reading symbols from \
  /usr/lib/debug/lib64/libc-2.26.so-2.26-lp152.26.6.1.x86_64.debug...^M
Expanding full symbols from \
  /usr/lib/debug/lib64/libc-2.26.so-2.26-lp152.26.6.1.x86_64.debug...^M
FAIL: gdb.threads/detach-step-over.exp: \
  breakpoint-condition-evaluation=host: target-non-stop=on: non-stop=on: \
  displaced=off: iter 2: attach (timeout)
...

Fix this by doing exp_continue when encountering the "Reading symbols" or
"Expanding full symbols" lines.

This is still fragile and times out with a higher load, similated f.i. by
stress -c 5.  Fix that by using a timeout factor of 2.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2021-05-05  Tom de Vries  <tdevries@suse.de>

	* gdb.threads/detach-step-over.exp: Do exp_continue when encountering
	"Reading symbols" or "Expanding full symbols" lines.  Using timeout
	factor of 2 for attach.
2021-05-05 15:13:17 +02:00
Tom de Vries
09f83f79f7 [gdb/testsuite] Fix gdb.threads/fork-plus-threads.exp with readnow
When running test-case gdb.threads/fork-plus-threads.exp with target board
readnow, I run into:
...
[LWP 9362 exited]^M
[New LWP 9365]^M
[New LWP 9363]^M
[New LWP 9364]^M
FAIL: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: \
  inferior 1 exited (timeout)
...

There is code in the test-case to prevent timeouts with readnow:
...
       -re "Thread \[^\r\n\]+ exited" {
           # Avoid timeout with check-read1
           exp_continue
       }
       -re "New Thread \[^\r\n\]+" {
           # Avoid timeout with check-read1
           exp_continue
       }
...
but this doesn't trigger because we get LWP rather than Thread.

Fix this by making these regexps accept LWP as well.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2021-05-05  Tom de Vries  <tdevries@suse.de>

	* gdb.threads/fork-plus-threads.exp: Handle "New LWP <n>" and
	"LWP <n> exited" messages.
2021-05-05 09:07:27 +02:00
Alan Modra
c38c6234f2 asan: stack-buffer-overflow vms-lib.c:367
* vms-lib.c (vms_traverse_index): Account for vms_kbn size when
	sanity checking keylen.
2021-05-05 13:35:45 +09:30
Mike Frysinger
5318ba65f8 sim: rl78: clean up various warnings
A random grab bag of minor fixes to enable -Werror for this port.

Fix local prototypes for a bunch of functions (e.g. adding static).
Add missing includes for missing prototypes.
Move local variable decls from the middle of functions to the top
of the scope.
Fix a logic error when processing commands where p was reassigned
to cmd and then has its leading whitespace scanned a 2nd time.
Handle short reads with fread().
2021-05-04 23:05:02 -04:00
Simon Marchi
fa94b3a7c8 gdb: update Type.fields doc based on actual GDB behavior
I noticed two errors in the Type.fields documentation:

1. It is possible to call `fields` on an array type, in which case it
   returns one field representing the array's range.  It is not
   mentioned.

2. When calling `fields` on a type that doesn't have fields (by nature,
   like an int), GDB raises a TypeError.  It does not return an empty
   sequence, as currently documented.

Fix these, and change the text into a bullet list.  I find it easier to
read than one big paragraph.

The first issue is already tested in gdb.python/py-type.exp, but the
second one doesn't seem tested.  Add a test in gdb.python/py-type.exp
for it.

gdb/doc/ChangeLog:

	* python.texi (Types In Python): Re-organize Type.fields doc.
	Mention handling of array types.  Correct doc for when calling
	the method on another type.

gdb/testsuite/ChangeLog:

	* gdb.python/py-type.exp (test_fields): Test calling fields on
	an int type.

Change-Id: I11c688177504cb070b81a4446ac91dec50b56a22
2021-05-04 22:19:05 -04:00
Mike Frysinger
bf06b2a2f9 sim: m68hc11: tweak types to fix warnings
The hw attach API wants unsigned addresses.
The write API wants signed chars.
2021-05-04 22:06:23 -04:00
Mike Frysinger
77c0fdb7ff sim: mips: include stdlib.h for memory prototypes
This file uses free() and friends, so include it to fix missing
prototype warnings.
2021-05-04 22:04:01 -04:00
Mike Frysinger
9b1af85c78 sim: mips: always enable device models
There's no need to restrict these to only specific targets as the user
can select them at runtime if they want them.  Always build them so we
can improve build coverage too.
2021-05-04 22:02:37 -04:00
Mike Frysinger
d97ba9c60c sim: mips: delete unused constant variables
Since these never change, inline and delete them.
2021-05-04 22:00:46 -04:00
Mike Frysinger
91eea12156 sim: mcore: fix build time warnings
Once we fix a minor const warning we can enable -Werror in here.
2021-05-04 21:57:49 -04:00
Mike Frysinger
a147f3ff8c sim: remove sys/times.h in most places
The v850 port used this, and then it got copied to other ports even
though it wasn't needed.  Clean it up to avoid portability issues on
platforms not providing this (e.g. mingw64 for Windows).
2021-05-04 21:56:38 -04:00
Mike Frysinger
4df817de57 sim: mips: fix qh_acc table
The AccAddLQH func was unused, and looking at this table, it looks
like it's due to a typo.
2021-05-04 21:54:36 -04:00
Mike Frysinger
2849d28d96 sim: hw: localize init callback
Now that we don't need to hardcode the module init list in a single
place, move the hw init logic out to the sim-hw file.
2021-05-04 21:52:38 -04:00
Mike Frysinger
4d47dcfcf1 sim: microblaze: enable some basic trace points
This isn't super complete, but it's useful enough as-is.
2021-05-04 21:49:11 -04:00
Mike Frysinger
cd09ab7c74 sim: microblaze: hook up libgloss syscalls
When in the virtual environment, have brki 8 trigger libgloss syscalls
like other ports.  This also matches the ABI that Linux uses for its
syscalls (ignoring the syscall table differences).
2021-05-04 21:47:10 -04:00
Alan Modra
13ffdac36f PowerPC undefweak testcase
Test for commit 4916030821 and b293661219.

	* testsuite/ld-powerpc/empty.s: New file.
	* testsuite/ld-powerpc/undefweak.d,
	* testsuite/ld-powerpc/undefweak.s: New testcase.
	* testsuite/ld-powerpc/powerpc.exp: Run it.
2021-05-05 10:35:31 +09:30
GDB Administrator
3897046fe0 Automatic date update in version.in 2021-05-05 00:00:35 +00:00
Tom Tromey
be7547b077 Add missing stdlib.h includes to sim
This updates the various "mloop.in" files to emit an include of
stdlib.h, to avoid warnings about 'abort' being undeclared.

One such warning now remains, in mn10300.igen.  I don't know offhand
the best way to fix this one.

2021-05-04  Tom Tromey  <tromey@adacore.com>

	* mloop.in: Include <stdlib.h>.

sim/iq2000/ChangeLog
2021-05-04  Tom Tromey  <tromey@adacore.com>

	* mloop.in: Include <stdlib.h>.

sim/lm32/ChangeLog
2021-05-04  Tom Tromey  <tromey@adacore.com>

	* mloop.in: Include <stdlib.h>.

sim/m32r/ChangeLog
2021-05-04  Tom Tromey  <tromey@adacore.com>

	* mloop.in: Include <stdlib.h>.

sim/or1k/ChangeLog
2021-05-04  Tom Tromey  <tromey@adacore.com>

	* mloop.in: Include <stdlib.h>.
2021-05-04 13:19:33 -06:00
Tom Tromey
a0c4531a55 Fix igen build
The igen build fails for me like:

gcc  -g -O2 -c ../../binutils-gdb/sim/igen/igen.c -o igen/igen.o
In file included from ../../binutils-gdb/sim/igen/igen.c:26:
../../binutils-gdb/sim/igen/lf.h:22:10: fatal error: ansidecl.h: No such file or directory

This patch fixes the problem by arranging for igen to find the
libiberty includes.

This seems slightly hacky to me, because libiberty is not a "build"
library, so it can't be linked against.  However, since igen currently
only includes the header, it seems relatively safe.

2021-05-04  Tom Tromey  <tromey@adacore.com>

	* Makefile.in: Rebuild.
	* Makefile.am (AM_CPPFLAGS): New variable.
2021-05-04 13:19:33 -06:00
Tom Tromey
937a049c95 Add config.h to generated_files for sim
I noticed that config.h isn't in 'generated_files' in the sim
subdirectories.  This causes it to sometimes be rebuilt too late.

2021-05-04  Tom Tromey  <tromey@adacore.com>

	* Make-common.in (generated_files): Add config.h.
2021-05-04 13:19:33 -06:00
Mike Frysinger
4aaaa4e03b gnulib: import gendocs
This will be used to generate more complete docs for the binutils site.
2021-05-04 13:50:33 -04:00
Mike Frysinger
c17253b974 gnulib: import getline
We use getline in sim today which breaks on older systems that are
not compliant with the latest POSIX standard.  For example, mingw64
for Windows omits getline so we fail to build there.
2021-05-04 13:33:32 -04:00
Simon Marchi
858c8f2c1b gdb/testsuite: adjust gdb.python/flexible-array-member.exp expected pattern
The `Type.range ()` tests in gdb.python/flexible-array-member.exp pass
when the test is compiled with gcc 9 or later, but not with gcc 8 or
earlier:

    $ make check TESTS="gdb.python/flexible-array-member.exp" RUNTESTFLAGS="CC_FOR_TARGET='gcc-8'"

    python print(zs['items'].type.range())^M
    (0, 0)^M
    (gdb) FAIL: gdb.python/flexible-array-member.exp: python print(zs['items'].type.range())
    python print(zso['items'].type.range())^M
    (0, 0)^M
    (gdb) FAIL: gdb.python/flexible-array-member.exp: python print(zso['items'].type.range())

The value that we get for the upper bound of a flexible array member
declared with a "0" size is 0 with gcc <= 8 and is -1 for gcc >= 9.
This is due to different debug info.  For this member, gcc 8 does:

    0x000000d5:   DW_TAG_array_type
                    DW_AT_type [DW_FORM_ref4]       (0x00000034 "int")
                    DW_AT_sibling [DW_FORM_ref4]    (0x000000e4)

    0x000000de:     DW_TAG_subrange_type
                      DW_AT_type [DW_FORM_ref4]     (0x0000002d "long unsigned int")

For the same type, gcc 9 does:

    0x000000d5:   DW_TAG_array_type
                    DW_AT_type [DW_FORM_ref4]       (0x00000034 "int")
                    DW_AT_sibling [DW_FORM_ref4]    (0x000000e5)

    0x000000de:     DW_TAG_subrange_type
                      DW_AT_type [DW_FORM_ref4]     (0x0000002d "long unsigned int")
                      DW_AT_count [DW_FORM_data1]   (0x00)

Ideally, GDB would present a consistent and documented value for an
array member declared with size 0, regardless of how the debug info
looks like.  But for now, just change the test to accept the two
values, to get rid of the failure and make the test in sync

I also realized (by looking at the py-type.exp test) that calling the
fields method on an array type yields one field representing the "index"
of the array.  The type of that field is of type range
(gdb.TYPE_CODE_RANGE).  When calling `.range()` on that range type, it
yields the same range tuple as when calling `.range()` on the array type
itself.  For completeness, add some tests to access the range tuple
through that range type as well.

gdb/testsuite/ChangeLog:

	* gdb.python/flexible-array-member.exp: Adjust expected range
	value for member declared with 0 size.  Test accessing range
	tuple through range type.

Change-Id: Ie4e06d99fe9315527f04577888f48284d649ca4c
2021-05-04 11:20:19 -04:00
Nick Clifton
bd6d8601f3 Define bfd_realloc(ptr,0) to return allocated memory, whilst bfd_realloc_or_free(ptr,0) frees ptr.
* libbfd.c (bfd_malloc): Provide some documenation.  Treat a size
	of 0 as 1.
	(bfd_realloc): Likewise.
	(bfd_zmalloc): Likewise.
	(bfd_realloc_or_free): Provide some documentation.  Treat a size
	of 0 as a request to free.
	* libbfd-in.h (bfd_realloc): Remove prototype.
	(bfd_realloc_or_free): Remove prototype.
	(bfd_zmalloc): Remove prototype.
	* libbfd.h: Regenerate.
2021-05-04 14:29:04 +01:00
Nick Clifton
a8d6316b67 Replace AC_PROG_CC with AC_PROG_CC_C99 in top level configure file.
2021-05-04  Nick Clifton  <nickc@redhat.com>

	* configure.ac (AC_PROG_CC): Replace with AC_PROG_CC_C99.
	* configure: Regenerate.
2021-05-04 13:40:34 +01:00
Mike Frysinger
aa0fca163e sim: add support for build-time ar & ranlib
This is needed when building for a target whose ar & ranlib are
incompatible with the current build system.  For example, building
for Windows on a Linux system.

Then manually import the automake rule for libigen.a, but tweak the
tool variables to use the FOR_BUILD variants.
2021-05-04 08:22:07 -04:00
Mike Frysinger
5ee0bc23a6 sim: clean up bfd_vma printing
A lot of this code predates the bfd_vma format define, so we have a
random mix of casts to known types so we can printf the value.  Use
the BFD_VMA_FMT that now exists to simplify and reliability output
across different build configs.
2021-05-04 08:13:45 -04:00
Tom de Vries
225bda24db [gdb/guile] Don't allow libguile to change libgmp mem fns
Since gdb commit 880ae75a2b "gdb delay guile initialization until
gdbscm_finish_initialization" I'm running into:
...
(gdb) print My_Var > 10.0^M
free(): invalid pointer^M
ERROR: GDB process no longer exists
GDB process exited with wait status 5995 exp9 0 0 CHILDKILLED SIGABRT SIGABRT
UNRESOLVED: gdb.ada/fixed_cmp.exp: gnat_encodings=all: print My_Var > 10.0
...

The problem is that both gdb and libguile try to set the libgmp memory functions,
and since the gdb commit the ones from libguile are effective, which results
in gdb freeing some memory in a way that is not compatible with the way that
memory was actually allocated.

The fact that libguile tries to set the libgmp memory functions is a bug which
should be fixed starting version v3.0.6.

Meanwhile, work around this in gdb by not allowing libguile to set the libgomp
memory functions.

Tested on x86_64-linux.

gdb/ChangeLog:

2021-05-04  Tom de Vries  <tdevries@suse.de>

	PR guile/27806
	* guile/guile.c	(gdbscm_initialize): Don't let guile change libgmp
	memory functions.
2021-05-04 10:26:16 +02:00
GDB Administrator
ae0373ce07 Automatic date update in version.in 2021-05-04 00:00:34 +00:00
Jim Wilson
7b06fcf566 RISC-V: PR27764, Add tests for A extension
ChangeLog entry for last patch.
2021-05-03 16:19:17 -07:00
Christoph Muellner
6bdf164fc5 RISC-V: PR27764, Add tests for A extension
gas/
    PR 27764
    * testsuite/gas/riscv/a-ext-64.d: New testcase.
    * testsuite/gas/riscv/a-ext-64.s: Likewise.
    * testsuite/gas/riscv/a-ext.d: Likewise.
    * testsuite/gas/riscv/a-ext.s: Likewise.

Signed-off-by: Christoph Muellner <cmuellner@gcc.gnu.org>
2021-05-03 15:33:58 -07:00
Tom Tromey
8228833924 Fix x86_64 mingw build
PR build/27807 points out that my recent changes to the Windows port
missed a spot in win32-i386-low.cc -- a call to
win32_Wow64GetThreadContext remained, causing link errors in
gdbserver.  This happened because I tested an i686 build, but this
code is only used on an x86_64 build.

This patch fixes the bug.  I am checking it in.

gdbserver/ChangeLog
2021-05-03  Tom Tromey  <tromey@adacore.com>

	PR build/27807:
	* win32-i386-low.cc (i386_get_thread_context): Call
	Wow64GetThreadContext, not win32_Wow64GetThreadContext.
2021-05-03 12:40:19 -06:00
Simon Marchi
f08708cbf5 sim: add ATTRIBUTE_PRINTF / ATTRIBUTE_NULL_PRINTF where necessary
I finally got the all-targets sim building with Clang, these are all the
instances where an ATTRIBUTE_PRINTF or ATTRIBUTE_NULL_PRINTF attribute
needed to be added to avoid errors like:

    /home/simark/src/binutils-gdb/sim/aarch64/../common/sim-profile.c:464:19: error: format string is not a string literal [-Werror,-Wformat-nonliteral]
        vfprintf (fp, fmt, ap);
                      ^~~
There are more fixes needed to get everything building, but adding these
attributes is trivial enough, so I send them all in a single patch.

Adding the format attributes introduces some format string errors when
building with GCC (because now format strings are checked), so
corresponding changes are needed to avoid breaking the build.  Other
than simple format string specified changes, there is this one:

    /home/simark/src/binutils-gdb/sim/aarch64/../common/hw-events.c: In function 'hw_event_queue_schedule':
    /home/simark/src/binutils-gdb/sim/aarch64/../common/hw-events.c:95:15: error: too many arguments for format [-Werror=format-extra-args]
       95 |         NULL, dummy);
          |               ^~~~~

We can fix it and avoid using a dummy variable by simply calling
hw_event_queue_schedule_tracef instead of
hw_event_queue_schedule_vtracef.

sim/arm/ChangeLog:

	* armdefs.h (ARMul_ConsolePrint): Use format attribute.
	* wrapper.c (op_printf): Likewise.

sim/bfin/ChangeLog:

	* interp.c (sim_open): Adjust format string specifier.

sim/common/ChangeLog:

	* hw-events.h (hw_event_queue_schedule_tracef): Use format attribute.
	(hw_event_queue_schedule_vtracef): Likewise.
	* hw-tree.h (hw_tree_vparse): Likewise.
	* sim-profile.c (profile_vprintf): Likewise.
	* sim-trace.c (dis_printf): Likewise.
	* sim-trace.h (trace_printf): Likewise.
	(trace_vprintf): Likewise.
	* sim-utils.h (sim_do_commandf): Likewise.
	* hw-events.c (hw_event_queue_schedule): Use
	hw_event_queue_schedule_tracef.

sim/rx/ChangeLog:

	* trace.c (op_printf): Likewise.

sim/v850/ChangeLog:

	* interp.c (sim_open): Adjust format string specifier.

Change-Id: I1445115ce57db15bb8e35dca93014555e7555794
2021-05-03 10:55:25 -04:00
Jan Beulich
5e0a033bd2 x86: allow @secrel32 also in data definitions
Now that lex_got() is uniform for all targets using it, permit COFF
targets to also use @secrel32 with, in particular, .long. This is more
natural than the custom .secrel32 directive, and also allows more
flexibility (the "+six" form of the two added test lines doesn't work
with a .secrel32 equivalent, in that it silently produces an unintended
relocation type).

As an extra benefit this also makes sure that data definitions in Intel
syntax mode would get treated like they do for e.g. ELF targets.
2021-05-03 13:28:30 +02:00
Jan Beulich
3e301ce0b5 x86: use UNIX EOL in secrel testcase
For some reason these were using Windows EOL.
2021-05-03 13:27:47 +02:00
Jan Beulich
deea497309 x86: fold both instances of lex_got()
I see no reason at all for us to carry two copies of almost identical
code. The differences, apart from the table entries, are benign. And
the #ifdef-ary doesn't really get any worse.
2021-05-03 13:26:41 +02:00
Jan Beulich
4c398cc06d x86: don't request useless overflow checking
Relocations with a bitsize matching the architecture's address width
can't usefully use an overflow checking approach other than "dont" or
"signed": All others involve perhaps complex calculations in
_bfd_relocate_contents() (or, not as severe, in bfd_check_overflow())
without ever finding anything to complain about - because of the address
width masking applied. Avoid this unnecessary overhead and switch all
such reloc types to "dont".

Note that "signed" checking with rela relocations (i.e. x86-64 here) is
only going to be useful if the addend actually got passed to
_bfd_relocate_contents() (and maybe others) instead of bogusly adding in
prior section contents (which apparently is assumed to be zero, and
hence again no overflow would ever be detected). See
https://sourceware.org/pipermail/binutils/2021-April/116164.html.
2021-05-03 13:25:12 +02:00
Andrew Burgess
d389a1a769 gdb/testsuite: update expected results in gdb.python/py-startup-opt.exp
The test gdb.python/py-startup-opt.exp checks the behaviour of GDB's:

  set python dont-write-bytecode on

This flag (when on) stops Python creating .pyc files.  The test first
checks that .pyc files will be created, then turns this option on and
checks .pyc files will not be created.

However, if the user has PYTHONDONTWRITEBYTECODE set in their
environment then this will prevent Python from creating .pyc files, as
such the first test, that .pyc files are being created, currently
fails.

We could unset PYTHONDONTWRITEBYTECODE, however, until Python 3.8
there is no way to control where Python writes the .pyc files.  As the
GDB developer clearly doesn't want .pyc files created in their
file-system it feels wrong to silently unset this environment
variable.

My proposal then, is that we just spot when this environment variable
is set and adjust the expected results.  My hope is that across all
GDB developers some will be running with PYTHONDONTWRITEBYTECODE
unset, so this feature will be fully tested at least some of the time.

gdb/testsuite/ChangeLog:

	PR testsuite/27788
	* gdb.python/py-startup-opt.exp (test_python_settings): Change the
	expected results when environment variable PYTHONDONTWRITEBYTECODE
	is set.
2021-05-03 12:21:00 +01:00
Alan Modra
4916030821 PPC: undefweak dynamic relocs
This makes the default for ppc to keep dynamic relocs on undefweak
symbols when the code won't cause DT_TEXTREL (for instance when -fPIE
or -fPIC).  If ld is given -z dynamic-undefined-weak then dynamic
relocations will be created for non-PIC at the expense of possibly
causing DT_TEXTREL to be set on ppc32.  Note that DT_TEXTREL and GNU
indirect functions are incompatible.

	* elf32-ppc.c (allocate_dynrelocs): Keep dyn_relocs for undefweak
	symbols when -z dynamic-undefined-weak or when there are no
	dynamic relocs in read-only sections and -z nodynamic-undefined-weak
	is not given.
	* elf64-ppc.c (allocate_dynrelocs): Likewise.
2021-05-03 15:34:17 +09:30
Alan Modra
b293661219 PPC: ensure_undef_dynamic on weak undef only in plt
It's slightly weird to have a call to a weak function not protected by
a test of that function being non-NULL, but the non-NULL test might be
covered by a test of another function.  For example:
  if (func1)
    {
      func1 ();
      func2 ();
    }
where func2 is known to exist if func1 exists.

	* elf32-ppc.c (allocate_dynrelocs): Call ensure_undef_dynamic for
	weak undefined symols that only appear on PLT relocs.
	* elf64-ppc.c (allocate_dynrelocs): Likewise.
2021-05-03 15:34:17 +09:30
Alan Modra
337d0bf887 PR27755, powerpc-ld infinite loop
PR 27755
	* elf32-ppc.c (ppc_elf_inline_plt): Do increment rel in loop.
2021-05-03 15:34:17 +09:30
Alan Modra
5072b52d28 csky: fix annobin test fails
* elf32-csky.c (is_mapping_symbol_name): New function.
	(csky_elf_is_target_special_symbol): Likewise.
	(csky_elf_maybe_function_sym): Likewise.
	(bfd_elf32_bfd_is_target_special_symbol): Define.
	(elf_backend_maybe_function_sym): Define.
2021-05-03 15:34:17 +09:30
Alan Modra
db543a7de3 testsuite: Don't start directives in first column
Fixes fails on hppa64-hp-hpux11.23

	* testsuite/gas/elf/section25.s: Don't start directives in first
	column.
	* testsuite/gas/elf/section26.s: Likewise.
2021-05-03 15:34:07 +09:30
Alan Modra
df6fbc21a5 Re: section symbols without a name
commit 2335639744 changed this file but missed one place.

	* testsuite/ld-s390/tlspic_64.rd: Adjust expected output for
	named section symbols.
2021-05-03 12:42:03 +09:30
GDB Administrator
d68fbfe75d Automatic date update in version.in 2021-05-03 00:00:35 +00:00