Bug 69821 - -fdebug-prefix-map doesn't affect gcc command line switches in DWARF DW_AT_producer.
Summary: -fdebug-prefix-map doesn't affect gcc command line switches in DWARF DW_AT_pr...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: other (show other bugs)
Version: 5.3.0
: P3 normal
Target Milestone: 6.0
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-02-15 06:38 UTC by hongxu jia
Modified: 2016-02-16 01:16 UTC (History)
3 users (show)

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


Attachments
add option (1.35 KB, patch)
2016-02-15 07:16 UTC, hongxu jia
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description hongxu jia 2016-02-15 06:38:15 UTC
Hi all,

I come from OpenEmbedded community (https://www.yoctoproject.org/),
thanks the powerful gcc, it helps us to do lots of compiling staff.
While cross compilation, we add '-g' to record debugging info,
and lots of build path existed in debugging info. We do not want to
expose the build path to others. So add '-fdebug-prefix-map=old=new'
to replace the build path with target path.

But the option '-fdebug-prefix-map=old=new' itself which included
build path still exists in gcc command line switches in DWARF
DW_AT_producer. I know we could use '-gno-record-gcc-switches' to
not record all gcc command line switches in DWARF DW_AT_producer.
But we would like to keep the others and only remove
'-fdebug-prefix-map=old=new'.

So I suggested to add a new option '-gno-record-debug-prefix-map'
which don't record '-fdebug-prefix-map' in gcc command line switches
in DWARF DW_AT_producer.

Thanks
Hongxu
Comment 1 hongxu jia 2016-02-15 07:16:23 UTC
Created attachment 37691 [details]
add option

Compile without this fix:
objdump -g packages-split/lib32-glibc-dev/usr/lib/gcrt1.o
...
|    <5f>   DW_AT_producer    : (indirect string, offset: 0x1b): GNU C99 5.3.0
-m32-march=core2 -mtune=core2 -msse3 -mfpmath=sse -mpreferred-stack-boundary=4
-g -O2 -std=gnu99 -fgnu89-inline -fdebug-prefix-map=/buildarea/raid0/hjia/buil
d-20160127-yocto-buildpath-2/tmp/sysroots/lib32-qemux86-64=
-feliminate-unused-debug-types -fmerge-all-constants -frounding-math
-ftls-model=initial-exec
...

Compile with this fix:
objdump -g packages-split/lib32-glibc-dev/usr/lib/gcrt1.o
...
|    <5f>   DW_AT_producer    : (indirect string, offset: 0xa1): GNU C99 5.3.0
-m32 -march=core2 -mtune=core2 -msse3 -mfpmath=sse -mpreferred-stack-boundary=4
-g -O2 -std=gnu99 -fgnu89-inline -feliminate-unused-debug-types -fmerge-all-constants
-frounding-math -ftls-model=initial-exec
...
Comment 2 Andrew Pinski 2016-02-15 07:25:56 UTC
Patches should be sent to gcc-patches@.
Comment 3 hongxu jia 2016-02-15 08:10:47 UTC
(In reply to Andrew Pinski from comment #2)
> Patches should be sent to gcc-patches@.

Got it

//Hongxu
Comment 4 Richard Biener 2016-02-15 12:49:58 UTC
I think it makes sense to omit this by default.  In fact it is already in GCC 6.

      case OPT_fdebug_prefix_map_:
        /* Ignore these.  */
Comment 5 Jakub Jelinek 2016-02-15 13:18:15 UTC
Indeed.  This has been fixed with r231835.
Comment 6 Bernd Schmidt 2016-02-15 14:43:27 UTC
Should we backport this to 5?
Comment 7 Jakub Jelinek 2016-02-15 14:52:05 UTC
It is not a regression and is user visible change, so I think changing it just in GCC 6 is sufficient.
Comment 8 hongxu jia 2016-02-16 01:16:09 UTC
(In reply to Jakub Jelinek from comment #7)
> It is not a regression and is user visible change, so I think changing it
> just in GCC 6 is sufficient.

Got it, thanks for pointing it out.
I will backport to our Yocto.

//Hongxu