Hi!

On 2025-06-02T22:01:44+0530, Arijit Kumar Das <arijitkdgit.offic...@gmail.com> 
wrote:
>> Umm, I don't think so. I've been building crosses with gcc for decades.
>>  It should not be necessary, though it may sometimes be convenient.

Right.  Similarly to how it's, for example, documented on
<https://www.gnu.org/software/gcc/simtest-howto.html>, also the build
instructions for GCC '--target=nvptx-none' that I gave Arijit use a
combined tree (just GCC plus newlib).  You might indeed consider that's
just for convenience: let the top-level build system figure out at which
stage to build newlib, instead of manually doing C-only GCC
'--without-headers' etc., then build newlib with that, then rebuild full
GCC, etc.

>> If you feel there's a strong need, then you're going to have to make a
>> better case than what you've done above. Specifically you'd need to
>> start with why the standard cross build procedures don't work for nptx.

I'd consider the combined tree build one "standard cross build procedure"
(in addition to the "manual" one), but I also agree with Jeff that
special-casing just newlib isn't the way to go, given there are indeed
many more additional/optional packages that the top-level build system
can handle, as mentioned in
<https://inbox.sourceware.org/d463a70e-b586-40ce-b778-2e3d54b31...@gmail.com>.

(..., or, what about the long-standing idea that the top-level build
system should in fact be its own software package, instead of being
duplicated in GCC, binutils/GDB (and others?)...  But we digress...)

I've learned to live with:

    $ git status
    On branch [...]
    Your branch is ahead of 'upstream/master' by 69 commits.
      (use "git push" to publish your local commits)
    
    Untracked files:
      (use "git add <file>..." to include in what will be committed)
            newlib
    
    nothing added to commit but untracked files present (use "git add" to track)

;-)

> I think I'll defer to my mentors Thomas and Tobias for an explanation
> regarding this.
>
> I'm a new contributor to GCC and am currently working on a GSoC project
> for implementing a simple VRAM file system on an offload target device
> (nvptx-none) for running OpenMP/OpenACC related tests, along with
> modifying the stub syscalls in newlib to interface with this file system.
>
> Building the offload compiler requires newlib to be present in the GCC
> source tree root. My work would mainly be in newlib, so I thought adding
> newlib to gitignore would be a good idea in case new test cases for GCC
> might need to be added. In that case, I would need to remove and re-add
> the newlib symlink for every GCC patch submitted. This is my
> understanding. Please correct me if I'm wrong.

Actually, with Git, it's easier: you 'git add' only the files that you
care about, and just ignore 'newlib' in the top-level.


Either way: Arijit, even if this one didn't get accepted, you've
successfully executed the process: congratulations on your first GCC
patch submission, on your own initiative -- way to go!  :-D


Grüße
 Thomas


> On Mon, Jun 2, 2025 at 7:47 PM Jeff Law <jeffreya...@gmail.com> wrote:
>>
>>
>>
>> On 6/2/25 3:01 AM, Arijit Kumar Das wrote:
>> > Hi,
>> >
>> > When compiling GCC for targets like nvptx-none that require newlib, we
>> > need to put newlib-cygwin/newlib in the root directory of the source
>> > tree (either a copy or a symlink), which is then built by GCC when
>> > targeting offload devices like the above. Changes made in newlib
>> > shouldn't affect GCC, so I think we should include newlib in this case.
>> Umm, I don't think so.  I've been building crosses with gcc for decades.
>>   It should not be necessary, though it may sometimes be convenient.
>>
>> If you feel there's a strong need, then you're going to have to make a
>> better case than what you've done above.  Specifically you'd need to
>> start with why the standard cross build procedures don't work for nptx.
>>
>> jeff

Reply via email to