Bug 21333 - s390x GNU as uses symbol relocations for .debug_info
Summary: s390x GNU as uses symbol relocations for .debug_info
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: gas (show other bugs)
Version: 2.27
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-03-30 09:18 UTC by Richard Biener
Modified: 2017-03-31 11:57 UTC (History)
2 users (show)

See Also:
Host:
Target: s390x
Build:
Last reconfirmed:


Attachments
Proposed patch (386 bytes, patch)
2017-03-31 11:00 UTC, Nick Clifton
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Richard Biener 2017-03-30 09:18:54 UTC
I see

Relocation section '.rela.debug_info' at offset 0xf460 contains 852 entries:
  Offset          Info           Type           Sym. Value    Sym. Name + Addend
000000000006  001d00000004 R_390_32          0000000000000000 .debug_abbrev + 0
00000000000c  006d00000004 R_390_32          0000000000000d9a .LASF336 + 0
000000000011  006e00000004 R_390_32          000000000000001c .LASF337 + 0
000000000015  006f00000004 R_390_32          000000000000069a .LASF338 + 0
000000000019  002000000004 R_390_32          0000000000000000 .debug_ranges + 570
000000000025  002100000004 R_390_32          0000000000000000 .debug_line + 0
00000000002a  007000000004 R_390_32          000000000000003d .LASF8 + 0
00000000003c  007100000004 R_390_32          00000000000005ab .LASF0 + 0
00000000004a  007200000004 R_390_32          0000000000000260 .LASF1 + 0
000000000051  007300000004 R_390_32          00000000000006f3 .LASF2 + 0
000000000058  007400000004 R_390_32          000000000000035b .LASF3 + 0

instead of

000000000058  007400000004 R_390_32          0000000000000000 .debug_str + 35b

that needlessly increases .symtab size plus it confuses elflint (tools/21332).
Comment 1 Nick Clifton 2017-03-31 11:00:33 UTC
Created attachment 9958 [details]
Proposed patch

Hi Richard,

  This patch will achieve the effect you want, although I worry that it might
break something else in the s390 toolchain.  I'll ping the s390 maintainers
and see what they say.

Cheers
  Nick
Comment 2 Andreas Krebbel 2017-03-31 11:21:31 UTC
Should be ok for s390 as well.  Given that we mimic the i386 binutils code in many other situations I don't see why we should stop here ;)

Thanks for having a look!
Comment 3 rguenther 2017-03-31 11:31:08 UTC
On Fri, 31 Mar 2017, nickc at redhat dot com wrote:

> https://sourceware.org/bugzilla/show_bug.cgi?id=21333
> 
> Nick Clifton <nickc at redhat dot com> changed:
> 
>            What    |Removed                     |Added
> ----------------------------------------------------------------------------
>                  CC|                            |nickc at redhat dot com
> 
> --- Comment #1 from Nick Clifton <nickc at redhat dot com> ---
> Created attachment 9958 [details]
>   --> https://sourceware.org/bugzilla/attachment.cgi?id=9958&action=edit
> Proposed patch
> 
> Hi Richard,
> 
>   This patch will achieve the effect you want, although I worry that it might
> break something else in the s390 toolchain.  I'll ping the s390 maintainers
> and see what they say.

Looks like ppc for example instead does

  /* Always adjust symbols in debugging sections.  */
  if (bfd_get_section_flags (stdoutput, symseg) & SEC_DEBUGGING)
    return 1;

eventually gas should simply do that globally...

But thanks for the fix!
Comment 4 Sourceware Commits 2017-03-31 11:56:03 UTC
The master branch has been updated by Nick Clifton <nickc@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=dc1e4d6dedcb8ee3bb195f0db711f6aa164b8ab4

commit dc1e4d6dedcb8ee3bb195f0db711f6aa164b8ab4
Author: Nick Clifton <nickc@redhat.com>
Date:   Fri Mar 31 12:54:38 2017 +0100

    Reduce the size of s390 symbol tables by allowing relocations in mergeable string sections (eg .debug_str) to be made section relative rather than symbol relative.
    
    	PR gas/21333
    	* config/tc-s390.c (tc_s390_fix_adjustable): Allow non pc-relative
    	fixups in mergeable sections to be adjusted.
Comment 5 Nick Clifton 2017-03-31 11:57:36 UTC
Well it looks like the patch should be OK, so I have gone ahead and applied it.