[patch] Add "-iremap src:dst" option to gcc

Erik Cederstrand erik at cederstrand.dk
Wed May 16 20:27:11 UTC 2012


Hi folks,

I found this patch by Joerg Sonnenberger to NetBSD's gcc which adds an "-iremap src:dst" option to gcc (http://www.mail-archive.com/source-changes-full@netbsd.org/msg08590.html).

The option rewrites the prefix to __FILE__ which is stored in the object file. My use-case is to make __FILE__ a relative path instead of an absolute one, e.g. "src/foo/bar.c" instead of "/home/erik/freebsd/gcc_iremap/src/foo/bar.c". This is one of the requisites to create identical binaries from source code in different locations on my system.

The option can be used in e.g. make.conf as:

CFLAGS += -iunwrap=${.IMPSRC}:src

Patch against HEAD is attached. Is anyone willing to review this and possibly commit?

Thanks,
Erik

-------------- next part --------------
A non-text attachment was scrubbed...
Name: iremap.diff
Type: application/octet-stream
Size: 9147 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-toolchain/attachments/20120516/c9a20c91/iremap.obj


More information about the freebsd-toolchain mailing list