Skip to content
  • Maciej W. Rozycki's avatar
    LD: Convert `%P: %H:' to `%H:' in error messages · a5990ada
    Maciej W. Rozycki authored
    Similarly to commit 174d0a74 ("PowerPC/BFD: Convert `%P: %H:' to
    `%H:' in error messages") convert linker relocation error messages to
    use `%H:' rather `%P: %H:', removing inconsistent message composition
    like:
    
    $ cat reloc-j.s
    	.text
    	.globl	foo
    	.ent	foo
    foo:
    	j	bar
    	j	bar
    	.end	foo
    $ cat reloc-j.ld
    SECTIONS
    {
      bar = 0x12345678;
      .text : { *(.text) }
      /DISCARD/ : { *(*) }
    }
    $ as -o reloc-j.o reloc-j.s
    $ ld -T reloc-j.ld -o reloc-j reloc-j.o
    ld: tmpdir/reloc-j.o: in function `foo':
    (.text+0x0): relocation truncated to fit: R_MIPS_26 against `bar'
    ld: (.text+0x8): relocation truncated to fit: R_MIPS_26 against `bar'
    $
    
    where subsequent lines referring to issues within a single function have
    the name of the linker executable prepended, but the first one does not.
    
    As noted with the commit referred this breaks a GNU Coding Standard's
    requirement that error messages from compilers should look like this:
    
    source-file-name:lineno: message
    
    also quoted in `vfinfo' code handling these specifiers.
    
    Remove the linker name prefix then, making the messages now look like:
    
    $ ld -T reloc-j.ld -o reloc-j reloc-j.o
    tmpdir/reloc-j.o: in function `foo':
    (.text+0x0): relocation truncated to fit: R_MIPS_26 against `bar'
    (.text+0x8): relocation truncated to fit: R_MIPS_26 against `bar'
    $
    
    instead.
    
    	ld/
    	* ldmain.c (reloc_overflow): Use `%H:' rather than `%P: %H:'
    	with `einfo'.
    	(reloc_dangerous): Likewise.
    	(unattached_reloc): Likewise.
    a5990ada
To find the state of this project's repository at the time of any of these versions, check out the tags.