[Bug gas/30277] GNU as produce '.symtab' entries with incorrect order for 32-bit MIPS target

2023-03-27 Thread msl0000023508 at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=30277

WHR  changed:

   What|Removed |Added

 Target|mips64-none-elfabi64|mips64-none-elfabi64
   ||(actually using extra
   ||target mips-none-elf)

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug gas/30277] GNU as produce '.symtab' entries with incorrect order for 32-bit MIPS target

2023-03-27 Thread msl0000023508 at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=30277

WHR  changed:

   What|Removed |Added

   Host||powerpc64-unknown-linux-gnu
 Target||mips64-none-elfabi64
  Build||powerpc64-unknown-linux-gnu

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug gas/30277] New: GNU as produce '.symtab' entries with incorrect order for 32-bit MIPS target

2023-03-27 Thread msl0000023508 at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=30277

Bug ID: 30277
   Summary: GNU as produce '.symtab' entries with incorrect order
for 32-bit MIPS target
   Product: binutils
   Version: 2.40
Status: UNCONFIRMED
  Severity: normal
  Priority: P2
 Component: gas
  Assignee: unassigned at sourceware dot org
  Reporter: msl023508 at gmail dot com
  Target Milestone: ---

I have written a simple assembly code to test this issue:

$ cat sym-order-test.s
.text
.global func2, func4, func6
func1:
nop
func2:
nop
func3:
nop
func4:
nop
func5:
nop
func6:
nop
func7:
nop
$ mips64-none-elfabi64-as -mabi=32 sym-order-test.s -o sym-order-test.o   
$ readelf --symbols sym-order-test.o

Symbol table '.symtab' contains 15 entries:
   Num:Value  Size TypeBind   Vis  Ndx Name
 0:  0 NOTYPE  LOCAL  DEFAULT  UND 
 1:  0 SECTION LOCAL  DEFAULT1 .text
 2:  0 SECTION LOCAL  DEFAULT2 .data
 3:  0 SECTION LOCAL  DEFAULT3 .bss
 4:  0 SECTION LOCAL  DEFAULT4 .reginfo
 5:  0 SECTION LOCAL  DEFAULT5 .MIPS.abiflags
 6:  0 SECTION LOCAL  DEFAULT6 .pdr
 7:  0 SECTION LOCAL  DEFAULT7 .gnu.attributes
 8: 0004 0 NOTYPE  GLOBAL DEFAULT1 func2
 9: 000c 0 NOTYPE  GLOBAL DEFAULT1 func4
10: 0014 0 NOTYPE  GLOBAL DEFAULT1 func6
11:  0 NOTYPE  LOCAL  DEFAULT1 func1
12: 0008 0 NOTYPE  LOCAL  DEFAULT1 func3
13: 0010 0 NOTYPE  LOCAL  DEFAULT1 func5
14: 0018 0 NOTYPE  LOCAL  DEFAULT1 func7
$ mips64-none-elfabi64-as --version
GNU assembler (GNU Binutils) 2.40
Copyright (C) 2023 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or later.
This program has absolutely no warranty.
This assembler was configured for a target of `mips64-none-elfabi64'.


As shown by readelf(1), there are some LOCAL symbols follow the last GLOBAL
symbol, this is not allowed by ELF specification.

This issue was raised by ld(1), which rejects the problematical object file
under some conditions:

$ mips64-none-elfabi64-ld -m elf32btsmip sym-order-test.o
mips64-none-elfabi64-ld: sym-order-test.o: .symtab local symbol at index 11 (>=
sh_info of 8)
mips64-none-elfabi64-ld: sym-order-test.o: error adding symbols: bad value

-- 
You are receiving this mail because:
You are on the CC list for the bug.