Bug 47047 - Support for path translation in __FILE__
Summary: Support for path translation in __FILE__
Status: RESOLVED DUPLICATE of bug 70268
Alias: None
Product: gcc
Classification: Unclassified
Component: preprocessor (show other bugs)
Version: 4.1.3
: P3 enhancement
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-12-23 02:12 UTC by Joerg Sonnenberger
Modified: 2024-03-15 04:00 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
Implement cpp -iremap (2.99 KB, patch)
2010-12-23 02:12 UTC, Joerg Sonnenberger
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Joerg Sonnenberger 2010-12-23 02:12:13 UTC
Created attachment 22841 [details]
Implement cpp -iremap

__FILE__ expands to full path names in some situation, e.g. if it is used in a header found via -I/some/where. The resulting leak of the header location into the file binary is undesirable in certain situations.

For NetBSD, two relevant cases are the visiblity protection in pkgsrc, which effectively turns /usr/pkg/include/foo into /.../work/.buildlink/include/foo and cross-compiling the system, which would leak /.../usr/include/foo instead of /usr/include/foo or the location of the source tree.

The attached patch implements a CPP option to match the file path against a list of prefixes and substitute the prefix on match. With this patch, most references to the src and obj locations in NetBSD can be translated into the canonical positions.

The patch is the version included in NetBSD against the system gcc, it can be updated if necessary.
Comment 1 jsm-csl@polyomino.org.uk 2010-12-23 12:16:37 UTC
On Thu, 23 Dec 2010, joerg at netbsd dot org wrote:

> The patch is the version included in NetBSD against the system gcc, it can be
> updated if necessary.

Who are the authors of this patch?  It's large enough that it can't be 
considered without a copyright assignment on file with the FSF (and given 
such an assignment a version against trunk would then need to be 
submitted).
Comment 2 joerg 2010-12-23 12:51:33 UTC
On Thu, Dec 23, 2010 at 12:16:40PM +0000, joseph at codesourcery dot com wrote:
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47047
> 
> --- Comment #1 from joseph at codesourcery dot com <joseph at codesourcery dot com> 2010-12-23 12:16:37 UTC ---
> On Thu, 23 Dec 2010, joerg at netbsd dot org wrote:
> 
> > The patch is the version included in NetBSD against the system gcc, it can be
> > updated if necessary.
> 
> Who are the authors of this patch?  It's large enough that it can't be 
> considered without a copyright assignment on file with the FSF (and given 
> such an assignment a version against trunk would then need to be 
> submitted).

I am the author of the text. Where can I find the papers for the FSF?

Joerg
Comment 3 jsm-csl@polyomino.org.uk 2010-12-23 16:13:53 UTC
On Thu, 23 Dec 2010, joerg at britannica dot bec.de wrote:

> > On Thu, 23 Dec 2010, joerg at netbsd dot org wrote:
> > 
> > > The patch is the version included in NetBSD against the system gcc, it can be
> > > updated if necessary.
> > 
> > Who are the authors of this patch?  It's large enough that it can't be 
> > considered without a copyright assignment on file with the FSF (and given 
> > such an assignment a version against trunk would then need to be 
> > submitted).
> 
> I am the author of the text. Where can I find the papers for the FSF?

Please fill in the form at
http://gcc.gnu.org/wiki/CopyrightAssignment
and send it to fsf-records@gnu.org and they will then send you the 
appropriate assignment form.
Comment 4 Joerg Sonnenberger 2011-02-06 04:10:12 UTC
(In reply to comment #3)
> Please fill in the form at
> http://gcc.gnu.org/wiki/CopyrightAssignment
> and send it to fsf-records@gnu.org and they will then send you the 
> appropriate assignment form.

Done and processed.
Comment 5 dank 2013-04-07 21:29:20 UTC
What's the status of this patch?
Comment 6 Joerg Sonnenberger 2013-04-08 08:11:45 UTC
Nothing has changed. It likely needs updates to apply to GCC 4.8+, but the general functionality is still desirable, IMO.
Comment 7 Boris Kolpackov 2018-01-19 07:35:48 UTC
I believe this is a duplicate of #70268 that has been fixed.

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70268
Comment 8 Andrew Pinski 2024-03-15 04:00:37 UTC
Yes this is a dup.

*** This bug has been marked as a duplicate of bug 70268 ***