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

--- Comment #1 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Dimitar Dimitrov <[email protected]>:

https://gcc.gnu.org/g:2948d12f92d1d2e22f8c0c639d720cda84d327ef

commit r16-4017-g2948d12f92d1d2e22f8c0c639d720cda84d327ef
Author: Dimitar Dimitrov <[email protected]>
Date:   Sat Oct 19 23:40:35 2024 +0300

    pru: Reject bit-fields for TI ABI

    TI ABI has non-conventional requirements for bit-fields, which cannot
    be implemented with the current target hooks in GCC.

    Target hooks are focused on packing and alignment.  But PRU uses packed
    structs by default, and has 1 byte alignment for all types.  As an
    example, this makes it difficult to implement the TI ABI requirement
    for the following struct to be sized to 4 bytes, per the bit-field type:

      struct S { int i : 1; }

    Instead of introducing new target hooks and making risky changes to
    common GCC code, simply declare bit-fields as not supported in TI ABI
    mode.

    PRU is a baremetal target.  It has neither support for interrupts nor an
    RTOS.  Hence ABI compatibility is not that critical.  I have not seen
    any projects which rely on ABI compatibility in order to mix object
    files from GCC and the TI proprietary compiler.

    The target-specific pass to scan for TI ABI compatibility was rewritten
    as an IPA pass.  This allowed scanning not only of function bodies, but
    also global variable declarations.  Diagnostic locations should now be
    more accurate.  Thus some test cases had to be adjusted.

            PR target/116205

    gcc/ChangeLog:

            * config/pru/pru-passes.cc (class pass_pru_tiabi_check): Make
            this an IPA pass.
            (chkp_type_has_function_pointer): Remove.
            (check_type_tiabi_compatibility): New function.
            (chk_function_decl): Rename.
            (check_function_decl): Simplify.
            (check_op_callback): Rework to use
            check_type_tiabi_compatibility.
            (pass_pru_tiabi_check::execute): Rework to scan all symbols and
            gimple contents of all defined functions.
            * config/pru/pru-passes.def (INSERT_PASS_AFTER): Move after
            pass_ipa_auto_profile_offline.
            * config/pru/pru-protos.h (make_pru_tiabi_check): New
            declaration to mark as IPA pass.
            (make_pru_minrt_check): Specify it is making a gimple pass.
            * doc/invoke.texi: Document that bit-fields are now rejected for
            TI ABI.

    gcc/testsuite/ChangeLog:

            * gcc.target/pru/mabi-ti-1.c: Adjust diagnostic location.
            * gcc.target/pru/mabi-ti-2.c: Ditto.
            * gcc.target/pru/mabi-ti-3.c: Ditto.
            * gcc.target/pru/mabi-ti-5.c: Ditto.
            * gcc.target/pru/mabi-ti-6.c: Ditto.
            * gcc.target/pru/mabi-ti-7.c: Adjust diagnostic locations and
            add global variables for checking.
            * gcc.target/pru/mabi-ti-11.c: New test.
            * gcc.target/pru/mabi-ti-12.c: New test.
            * gcc.target/pru/mabi-ti-8.c: New test.
            * gcc.target/pru/mabi-ti-9.c: New test.

    Signed-off-by: Dimitar Dimitrov <[email protected]>

Reply via email to