libgccjit: Add support for packed struct #111

Open
antoyo wants to merge 1 commit from antoyo/gcc:gccjit/packed-type into trunk
Member
gcc/jit/ChangeLog:

	* docs/topics/compatibility.rst (LIBGCCJIT_ABI_36): New ABI tag.
	* docs/topics/types.rst: Document gcc_jit_type_add_attribute and
	gcc_jit_type_attribute.
	* dummy-frontend.cc (attr_aligned_exclusions): New variable.
	(handle_packed_attribute): New function.
	* jit-playback.cc: Handle type attributes.
	(type_attribute_to_string): New function.
	* jit-playback.h: New parameter attributes to new_compound_type.
	* jit-recording.cc (recording::type::add_attribute): New method.
	* jit-recording.h (recording::type::add_attribute): New method.
	(m_attributes): New field.
	* libgccjit.cc (gcc_jit_type_add_attribute): New function.
	* libgccjit.h (gcc_jit_type_add_attribute): New function.
	(gcc_jit_type_attribute): New enum.
	* libgccjit.map (LIBGCCJIT_ABI_36): New ABI tag.

gcc/testsuite/ChangeLog:

	* jit.dg/all-non-failing-tests.h: Mention new test.
	* jit.dg/test-packed-struct.c: New test.

CC: David Malcolm dmalcolm@redhat.com, jit@gcc.gnu.org

``` gcc/jit/ChangeLog: * docs/topics/compatibility.rst (LIBGCCJIT_ABI_36): New ABI tag. * docs/topics/types.rst: Document gcc_jit_type_add_attribute and gcc_jit_type_attribute. * dummy-frontend.cc (attr_aligned_exclusions): New variable. (handle_packed_attribute): New function. * jit-playback.cc: Handle type attributes. (type_attribute_to_string): New function. * jit-playback.h: New parameter attributes to new_compound_type. * jit-recording.cc (recording::type::add_attribute): New method. * jit-recording.h (recording::type::add_attribute): New method. (m_attributes): New field. * libgccjit.cc (gcc_jit_type_add_attribute): New function. * libgccjit.h (gcc_jit_type_add_attribute): New function. (gcc_jit_type_attribute): New enum. * libgccjit.map (LIBGCCJIT_ABI_36): New ABI tag. gcc/testsuite/ChangeLog: * jit.dg/all-non-failing-tests.h: Mention new test. * jit.dg/test-packed-struct.c: New test. ``` CC: David Malcolm <dmalcolm@redhat.com>, <jit@gcc.gnu.org>
Member

Welcome to Sourceware Forge

Hi @antoyo, and thanks for your PR. This bot helps you send your patch series to the mailing list.

Please follow these guidelines to ensure a smooth submission.

Writing a Good PR Description

  • If your PR has multiple commits, write a meaningful description. It becomes the cover letter.
  • For a single commit, you can leave the description empty if the commit message is clear.

To CC reviewers, add at the end of your PR description one or more lines like this:

CC: Revi Ewer <revi.ewer@example.com>, Ill Takalook <ill.takalook@example.net>

Avoid copy-pasting a CC list from a previous PR. Doing so may cause failure to send the emails properly.

We recommend reviewing your commit messages carefully before submitting.

This project expects a specific format.
See Submitting Patches for details

Submitting Your Patch

To submit, you must be authorized. Ask any permitted contributor to authorize you by commenting: /allow. This is anyone who has been /allowed before.

Once allowed, comment: /submit

Use /preview to see the emails before sending. (Requires a public forge email.)

Responding to Reviews

Watch for replies on the mailing list. If not subscribed, you can reply by:

  1. Visiting inbox.sourceware.org
  2. Clicking (raw) on the email
  3. Importing it into your mail client

For Gmail:

curl -g --user "<Email>:<Password>" \
  --url "imaps://imap.gmail.com/INBOX" -T /path/to/raw.txt

Updating Your PR

  1. Push new commits, rebase and force push changes to the same branch as needed
  2. Update the PR description with a “Changes since vX” section
  3. Comment again with: /submit

Need help?

Consider joining the gcc and gcc-patches mailing lists..
For real time communication, check the gcc irc channels.

Or join #overseers on Libera Chat, particularly if this automation is not working (stay online to get replies, IRC does not save messages if people are not online).

<!-- pr-welcome --> # Welcome to Sourceware Forge Hi @antoyo, and thanks for your PR. This bot helps you send your patch series to the mailing list. Please follow these guidelines to ensure a smooth submission. ## Writing a Good PR Description - If your PR has **multiple commits**, write a meaningful description. It becomes the cover letter. - For **a single commit**, you can leave the description empty if the commit message is clear. To CC reviewers, add at the end of your PR description one or more lines like this: ```text CC: Revi Ewer <revi.ewer@example.com>, Ill Takalook <ill.takalook@example.net> ``` Avoid copy-pasting a CC list from a previous PR. Doing so may cause failure to send the emails properly. We recommend reviewing your commit messages carefully before submitting. This project expects a specific format. See [Submitting Patches](https://gcc.gnu.org/contribute.html#patches) for details ## Submitting Your Patch To submit, you must be authorized. Ask any permitted contributor to authorize you by commenting: `/allow`. This is anyone who has been `/allow`ed before. Once allowed, comment: `/submit` Use `/preview` to see the emails before sending. (Requires a public forge email.) ## Responding to Reviews Watch for replies on the mailing list. If not subscribed, you can reply by: 1. Visiting [inbox.sourceware.org](https://inbox.sourceware.org) 2. Clicking `(raw)` on the email 3. Importing it into your mail client For Gmail: ```sh curl -g --user "<Email>:<Password>" \ --url "imaps://imap.gmail.com/INBOX" -T /path/to/raw.txt ``` ## Updating Your PR 1. Push new commits, rebase and force push changes to the same branch as needed 2. Update the PR description with a “Changes since vX” section 3. Comment again with: `/submit` ## Need help? Consider joining the [gcc and gcc-patches mailing lists.](https://gcc.gnu.org/lists.html). For real time communication, check the [gcc irc channels](https://gcc.gnu.org/wiki/GCConIRC). Or join [`#overseers`](https://web.libera.chat/#overseers) on Libera Chat, particularly if this automation is not working (stay online to get replies, IRC does not save messages if people are not online).
antoyo force-pushed gccjit/packed-type from 5209f558bc to 293f9f9690 2025-10-17 16:17:50 +00:00 Compare
Author
Member

/submit

/submit
Member

Version 1 of this pull request has been stored. It includes the following commits:

  • libgccjit: Add support for packed struct - 293f9f9690
<!-- pr-new-version --> Version 1 of this pull request has been stored. It includes the following commits: - libgccjit: Add support for packed struct - 293f9f9690960fdd984a993ed77132ca6dccccf5
Member

Pull Request versions:

# Base Head
1 7cd91c7c42 293f9f9690 (diff)

In order to compare , clone this repository and run

PR=111
git fetch origin "refs/versioned_pull/${PR}/*:refs/versioned_pull/${PR}/*"
PRV1=1
PRV2=2
git range-diff "refs/versioned_pull/${PR}/${PRV1}/base..refs/versioned_pull/${PR}/${PRV1}/head"  "refs/versioned_pull/${PR}/${PRV2}/base..refs/versioned_pull/${PR}/${PRV2}/head"
<!-- pr-versions --> Pull Request versions: | # | Base | Head | | | - | ---- | ---- | - | | 1 | 7cd91c7c42eec894c8c13fa68ccc12ec3a047c9a | 293f9f9690960fdd984a993ed77132ca6dccccf5 | [(diff)](https://forge.sourceware.org/gcc/gcc-TEST.git/compare/7cd91c7c42eec894c8c13fa68ccc12ec3a047c9a...293f9f9690960fdd984a993ed77132ca6dccccf5) | In order to compare , clone this repository and run ``` PR=111 git fetch origin "refs/versioned_pull/${PR}/*:refs/versioned_pull/${PR}/*" PRV1=1 PRV2=2 git range-diff "refs/versioned_pull/${PR}/${PRV1}/base..refs/versioned_pull/${PR}/${PRV1}/head" "refs/versioned_pull/${PR}/${PRV2}/base..refs/versioned_pull/${PR}/${PRV2}/head" ```
Member

Sent patch series version 1 containing 1 patches to gcc-patches mailing list test-list@sourceware.org and cc'd David Malcolm dmalcolm@redhat.com, jit@gcc.gnu.org.
Cover letter

Sent patch series version 1 containing 1 patches to gcc-patches mailing list <test-list@sourceware.org> and cc'd David Malcolm <dmalcolm@redhat.com>, <jit@gcc.gnu.org>. [Cover letter](https://inbox.sourceware.org/test-list/176071819122.1193.9848651491117142013.batrachomyomachia.gcc.gcc-TEST.111.1.0@forge-test.rdfm.org)
@ -558,0 +572,4 @@
.. macro:: GCC_JIT_TYPE_ATTRIBUTE_PACKED
Packed structures or union have each of its members placed to
minimize the memory required.
Member

This definition of the packed attribute is incorrect. Rather it does not describe the reality of things. Because to me it says the order of the fields could be reorded.
And if anything should point to the GCC documentation on the attribute:
https://gcc.gnu.org/onlinedocs/gcc/Common-Type-Attributes.html#index-packed-type-attribute .

This definition of the packed attribute is incorrect. Rather it does not describe the reality of things. Because to me it says the order of the fields could be reorded. And if anything should point to the GCC documentation on the attribute: https://gcc.gnu.org/onlinedocs/gcc/Common-Type-Attributes.html#index-packed-type-attribute .
Author
Member

The sentence I wrote here was actually a shortened version of the first sentence of the doc you linked…
I can link to the doc, though.

The sentence I wrote here was actually a shortened version of the first sentence of the doc you linked… I can link to the doc, though.
@ -41,2 +41,4 @@
using namespace gcc::jit;
#define DECL_C_BIT_FIELD(NODE) \
(DECL_LANG_FLAG_4 (FIELD_DECL_CHECK (NODE)) == 1)
Member

Why add this if you don't set DECL_LANG_FLAG_4 at all?

Why add this if you don't set DECL_LANG_FLAG_4 at all?
Author
Member

DECL_LANG_FLAG_4 comes from tree.h.

`DECL_LANG_FLAG_4` comes from `tree.h`.
First-time contributor
<!-- linaro-ci-status CI bot https://ci.linaro.org/job/tcwg_gnu_cross_build--master-aarch64-precommit/89/ --> CI state: fail :x: CI bot https://ci.linaro.org/job/tcwg_gnu_cross_build--master-aarch64-precommit/89/ : CI bot tcwg_gnu_cross_build--master-aarch64: Patch failed to apply See: https://ci.linaro.org/job/tcwg_gnu_cross_build--master-aarch64-precommit/89/artifact/artifacts/jenkins/precommit-forge-apply.log
First-time contributor
<!-- linaro-ci-status CI bot https://ci.linaro.org/job/tcwg_gnu_cross_build--master-arm-precommit/117/ --> CI state: fail :x: CI bot https://ci.linaro.org/job/tcwg_gnu_cross_build--master-arm-precommit/117/ : CI bot tcwg_gnu_cross_build--master-arm: Patch failed to apply See: https://ci.linaro.org/job/tcwg_gnu_cross_build--master-arm-precommit/117/artifact/artifacts/jenkins/precommit-forge-apply.log
This pull request has changes conflicting with the target branch.
  • gcc/jit/docs/topics/compatibility.rst
  • gcc/jit/libgccjit.h
  • gcc/jit/libgccjit.map
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u gccjit/packed-type:antoyo-gccjit/packed-type
git switch antoyo-gccjit/packed-type

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch trunk
git merge --no-ff antoyo-gccjit/packed-type
git switch antoyo-gccjit/packed-type
git rebase trunk
git switch trunk
git merge --ff-only antoyo-gccjit/packed-type
git switch antoyo-gccjit/packed-type
git rebase trunk
git switch trunk
git merge --no-ff antoyo-gccjit/packed-type
git switch trunk
git merge --squash antoyo-gccjit/packed-type
git switch trunk
git merge --ff-only antoyo-gccjit/packed-type
git switch trunk
git merge antoyo-gccjit/packed-type
git push origin trunk
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
4 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
gcc/gcc-TEST!111
No description provided.