public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/107201] New: [avr] -nodevicelib not working for devices -mmcu=avr...
@ 2022-10-10 14:37 gjl at gcc dot gnu.org
  2022-10-11 17:25 ` [Bug target/107201] " gjl at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: gjl at gcc dot gnu.org @ 2022-10-10 14:37 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107201

            Bug ID: 107201
           Summary: [avr] -nodevicelib not working for devices
                    -mmcu=avr...
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gjl at gcc dot gnu.org
  Target Milestone: ---

The -nodevicelib option can be used so that the executable is not linked
against -l<device> when a device is specified as -mmcu=<device>.  This is
useful if such a library is not avilable.

This is achieved by the following spec in the device-specs file specs-<device>:

*avrlibc_devicelib:
        %{!nodevicelib:-lavr64dd64}

However, in a spec function, the driver in
./gcc/config/avr/driver-avr.c[c]::avr_devicespecs_file() removes that option
because it thinks that -mmcu=avr* is a device *family* like avr25 or avrxmega2
etc.:

#if defined (WITH_AVRLIBC)
                 " %{mmcu=avr*:" X_NODEVLIB "} %{!mmcu=*:" X_NODEVLIB "}",
#else

where X_NODEVLIB resolves to "%<nodevicelib %<nodevicespecs"

This means that -nodevicelib is removed also for -mmcu=avr* devices, not only
for -mmcu=avr* cores.

All this worked because up to now, no AVR devices where named "avr*", so that
"avr*" worked to identify cores.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug target/107201] [avr] -nodevicelib not working for devices -mmcu=avr...
  2022-10-10 14:37 [Bug target/107201] New: [avr] -nodevicelib not working for devices -mmcu=avr gjl at gcc dot gnu.org
@ 2022-10-11 17:25 ` gjl at gcc dot gnu.org
  2024-01-15 15:17 ` cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: gjl at gcc dot gnu.org @ 2022-10-11 17:25 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107201

--- Comment #1 from Georg-Johann Lay <gjl at gcc dot gnu.org> ---
Created attachment 53691
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53691&action=edit
pr107201.diff: Proposed patch.

This proposed patch (effectively) sets macro X_NODEVLIB to "" in all of
./config/avr/driver-avr.cc.

-nodevicelib is a known driver option from avr.opt, so there should be no need
to explicitly remove it by hand by means of %<nodevicelib etc. like with
previous X_NODEVLIB.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug target/107201] [avr] -nodevicelib not working for devices -mmcu=avr...
  2022-10-10 14:37 [Bug target/107201] New: [avr] -nodevicelib not working for devices -mmcu=avr gjl at gcc dot gnu.org
  2022-10-11 17:25 ` [Bug target/107201] " gjl at gcc dot gnu.org
@ 2024-01-15 15:17 ` cvs-commit at gcc dot gnu.org
  2024-01-16  7:42 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-01-15 15:17 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107201

--- Comment #2 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Georg-Johann Lay <gjl@gcc.gnu.org>:

https://gcc.gnu.org/g:86fac7ee1688bdec245a43f6d2ab49fb238892e4

commit r14-7247-g86fac7ee1688bdec245a43f6d2ab49fb238892e4
Author: Georg-Johann Lay <avr@gjlay.de>
Date:   Mon Jan 15 13:25:59 2024 +0100

    AVR: target/107201: Make -nodevicelib work for all devices.

            driver-avr.cc contains a spec that discriminates bwtween cores
            and devices by means of a mmcu=avr* spec pattern.  This does not
            work for new devices like AVR128* which also start with mmcu=avr
            like all cores do.  The patch uses a new spec function in order to
            tell apart cores from devices.

    gcc/
            PR target/107201
            * config/avr/avr.h (EXTRA_SPEC_FUNCTIONS): Add no-devlib,
avr_no_devlib.
            * config/avr/driver-avr.cc (avr_no_devlib): New function.
            (avr_devicespecs_file): Use it to remove -nodevicelib from the
            options for cores only.
            * config/avr/avr-arch.h (avr_get_parch): New prototype.
            * config/avr/avr-devices.cc (avr_get_parch): New function.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug target/107201] [avr] -nodevicelib not working for devices -mmcu=avr...
  2022-10-10 14:37 [Bug target/107201] New: [avr] -nodevicelib not working for devices -mmcu=avr gjl at gcc dot gnu.org
  2022-10-11 17:25 ` [Bug target/107201] " gjl at gcc dot gnu.org
  2024-01-15 15:17 ` cvs-commit at gcc dot gnu.org
@ 2024-01-16  7:42 ` cvs-commit at gcc dot gnu.org
  2024-01-16  8:16 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-01-16  7:42 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107201

--- Comment #3 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-13 branch has been updated by Georg-Johann Lay
<gjl@gcc.gnu.org>:

https://gcc.gnu.org/g:3f6efe203484f7fb29c048d024dd8205e9e0f193

commit r13-8227-g3f6efe203484f7fb29c048d024dd8205e9e0f193
Author: Georg-Johann Lay <avr@gjlay.de>
Date:   Mon Jan 15 13:25:59 2024 +0100

    AVR: target/107201: Make -nodevicelib work for all devices.

            driver-avr.cc contains a spec that discriminates between cores
            and devices by means of a mmcu=avr* spec pattern.  This does not
            work for new devices like AVR128* which also start with mmcu=avr
            like all cores do.  The patch uses a new spec function in order to
            tell apart cores from devices.

    gcc/
            PR target/107201
            * config/avr/avr.h (EXTRA_SPEC_FUNCTIONS): Add no-devlib,
avr_no_devlib.
            * config/avr/driver-avr.cc (avr_no_devlib): New function.
            (avr_devicespecs_file): Use it to remove -nodevicelib from the
            options for cores only.
            * config/avr/avr-arch.h (avr_get_parch): New prototype.
            * config/avr/avr-devices.cc (avr_get_parch): New function.

    (cherry picked from commit 86fac7ee1688bdec245a43f6d2ab49fb238892e4)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug target/107201] [avr] -nodevicelib not working for devices -mmcu=avr...
  2022-10-10 14:37 [Bug target/107201] New: [avr] -nodevicelib not working for devices -mmcu=avr gjl at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2024-01-16  7:42 ` cvs-commit at gcc dot gnu.org
@ 2024-01-16  8:16 ` cvs-commit at gcc dot gnu.org
  2024-01-16  8:18 ` gjl at gcc dot gnu.org
  2024-01-16  8:40 ` gjl at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-01-16  8:16 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107201

--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Georg-Johann Lay
<gjl@gcc.gnu.org>:

https://gcc.gnu.org/g:ebdc3aae0a4705d0b72b69a37fdafa5613343d5d

commit r12-10100-gebdc3aae0a4705d0b72b69a37fdafa5613343d5d
Author: Georg-Johann Lay <avr@gjlay.de>
Date:   Mon Jan 15 13:25:59 2024 +0100

    AVR: target/107201: Make -nodevicelib work for all devices.

            driver-avr.cc contains a spec that discriminates between cores
            and devices by means of a mmcu=avr* spec pattern.  This does not
            work for new devices like AVR128* which also start with mmcu=avr
            like all cores do.  The patch uses a new spec function in order to
            tell apart cores from devices.

    gcc/
            PR target/107201
            * config/avr/avr.h (EXTRA_SPEC_FUNCTIONS): Add no-devlib,
avr_no_devlib.
            * config/avr/driver-avr.cc (avr_no_devlib): New function.
            (avr_devicespecs_file): Use it to remove -nodevicelib from the
            options for cores only.
            * config/avr/avr-arch.h (avr_get_parch): New prototype.
            * config/avr/avr-devices.cc (avr_get_parch): New function.

    (cherry picked from commit 86fac7ee1688bdec245a43f6d2ab49fb238892e4)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug target/107201] [avr] -nodevicelib not working for devices -mmcu=avr...
  2022-10-10 14:37 [Bug target/107201] New: [avr] -nodevicelib not working for devices -mmcu=avr gjl at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2024-01-16  8:16 ` cvs-commit at gcc dot gnu.org
@ 2024-01-16  8:18 ` gjl at gcc dot gnu.org
  2024-01-16  8:40 ` gjl at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: gjl at gcc dot gnu.org @ 2024-01-16  8:18 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107201

Georg-Johann Lay <gjl at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
   Target Milestone|---                         |13.3
           Priority|P3                          |P4
           Keywords|patch                       |
         Resolution|---                         |FIXED

--- Comment #5 from Georg-Johann Lay <gjl at gcc dot gnu.org> ---
Fixed in v12.4 and v13.3+.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug target/107201] [avr] -nodevicelib not working for devices -mmcu=avr...
  2022-10-10 14:37 [Bug target/107201] New: [avr] -nodevicelib not working for devices -mmcu=avr gjl at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2024-01-16  8:18 ` gjl at gcc dot gnu.org
@ 2024-01-16  8:40 ` gjl at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: gjl at gcc dot gnu.org @ 2024-01-16  8:40 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107201

--- Comment #6 from Georg-Johann Lay <gjl at gcc dot gnu.org> ---
As a work around, one can use an adjusted device-specs file with the
avrlibc_devicelib removed.  The spec looks like this:

*avrlibc_devicelib:
        %{!nodevicelib:-lavr128da32}

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-01-16  8:40 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-10 14:37 [Bug target/107201] New: [avr] -nodevicelib not working for devices -mmcu=avr gjl at gcc dot gnu.org
2022-10-11 17:25 ` [Bug target/107201] " gjl at gcc dot gnu.org
2024-01-15 15:17 ` cvs-commit at gcc dot gnu.org
2024-01-16  7:42 ` cvs-commit at gcc dot gnu.org
2024-01-16  8:16 ` cvs-commit at gcc dot gnu.org
2024-01-16  8:18 ` gjl at gcc dot gnu.org
2024-01-16  8:40 ` gjl at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).