[llvm-bugs] [Bug 48062] New: STB_LOCAL symbol found at index >= .symtab's sh_info

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Nov 3 10:24:14 PST 2020


https://bugs.llvm.org/show_bug.cgi?id=48062

            Bug ID: 48062
           Summary: STB_LOCAL symbol found at index >= .symtab's sh_info
           Product: lld
           Version: unspecified
          Hardware: Other
                OS: other
            Status: NEW
          Severity: release blocker
          Priority: P
         Component: ELF
          Assignee: unassignedbugs at nondot.org
          Reporter: xavi.dcr at tutanota.com
                CC: llvm-bugs at lists.llvm.org, smithp352 at googlemail.com

I am using llvm-project commit 8fc424f26bf1ea1471bd770a1b4eee4545c2bc96 with
two additional patches for preliminary MIPS I support (see
https://github.com/llvm/llvm-project/compare/release/11.x...XaviDCR92:release/11.x)
and zig (https://github.com/ziglang/zig) commit
b30a765b95cf666409c1e5324718a7c8c60af4af for an application targeted to the
FPU-less MIPS R3000A featured on the original Sony PlayStation.
The application uses mipsel-unknown-elf-as for the assembly files, which are
later linked by lld when calling zig. The application used to build on
llvm-10.x (plus the experimental patches) and older versions of zig, but does
no longer build on llvm-11.x and latest zig. After some discussion on the #zig
channel, I was encouraged to report this issue here based on the "lld:error: "
messages shown below.

As an alternative, I have tried to assemble the assembly files directly from
zig, but unfortunately the assembler does not recognize the "rfe" (return from
exception) MIPS I instruction for some unknown reason:

This is the output when building everything from zig:
-----------------------------------------------------------------------------------------------
$ make
zig build-exe src/main.zig -Ddprintf=printf -L.
-I/home/xavier/psxsdk-src/libpsx/include
-I/home/xavier/psxsdk-src/libpsx/include/sys
/home/xavier/psxsdk-src/libpsx/src/atexit.c
/home/xavier/psxsdk-src/libpsx/src/cdrom.c
/home/xavier/psxsdk-src/libpsx/src/cop.c
/home/xavier/psxsdk-src/libpsx/src/exception.c
/home/xavier/psxsdk-src/libpsx/src/gpu.c
/home/xavier/psxsdk-src/libpsx/src/libc.c
/home/xavier/psxsdk-src/libpsx/src/memcard.c
/home/xavier/psxsdk-src/libpsx/src/memory.c
/home/xavier/psxsdk-src/libpsx/src/pad.c
/home/xavier/psxsdk-src/libpsx/src/psxsdk.c
/home/xavier/psxsdk-src/libpsx/src/setup.c
/home/xavier/psxsdk-src/libpsx/src/sio.c
/home/xavier/psxsdk-src/libpsx/src/spu.c
/home/xavier/psxsdk-src/libpsx/src/util.c
/home/xavier/psxsdk-src/libpsx/src/libc/error.c
/home/xavier/psxsdk-src/libpsx/src/libc/misc.c
/home/xavier/psxsdk-src/libpsx/src/libc/printf.c
/home/xavier/psxsdk-src/libpsx/src/libc/qsort.c
/home/xavier/psxsdk-src/libpsx/src/libc/scanf.c
/home/xavier/psxsdk-src/libpsx/src/libc/stat.c
/home/xavier/psxsdk-src/libpsx/src/libc/string.c
/home/xavier/psxsdk-src/libpsx/src/libc/strings.c
/home/xavier/psxsdk-src/libpsx/src/libc/unistd.c
/home/xavier/psxsdk-src/libpsx/src/cdromh.s
/home/xavier/psxsdk-src/libpsx/src/exc1.s
/home/xavier/psxsdk-src/libpsx/src/syscalls.s
/home/xavier/psxsdk-src/libpsx/src/start/start.s
/home/xavier/psxsdk-src/libpsx/src/runexe/stage2.s -target
mipsel-freestanding-none --single-threaded -mcpu mips1+soft_float -Tpsx.ld
error(compilation): clang failed with stderr: zig: warning: argument unused
during compilation: '-fno-caret-diagnostics' [-Wunused-command-line-argument]
zig: warning: argument unused during compilation: '-ffreestanding'
[-Wunused-command-line-argument]
zig: warning: argument unused during compilation: '-D dprintf=printf'
[-Wunused-command-line-argument]
/home/xavier/psxsdk-src/libpsx/src/exc1.s:95:2: error: unknown instruction, did
you mean: rem?
        rfe
        ^

/home/xavier/psxsdk-src/libpsx/src/exc1.s:1:1: error: unable to build C object:
clang exited with code 1
/home/xavier/psxsdk/bin/elf2exe main cdimg/main.exe -mark_eur
mipsel-unknown-elf-objcopy: 'main': No such file
Could not open objcopy output at main.bin. Check your permissions. Aborting.
make: *** [Makefile:32: cdimg/main.exe] Error 255
-----------------------------------------------------------------------------------------------

And this is the output when assembling with mipsel-unknown-elf-as and compiling
and linking from zig:
-----------------------------------------------------------------------------------------------
$ make
mipsel-unknown-elf-as /home/xavier/psxsdk-src/libpsx/src/cdromh.s -o
obj/cdromh.o -msoft-float -march=mips1 -mabi=32
mipsel-unknown-elf-as /home/xavier/psxsdk-src/libpsx/src/exc1.s -o obj/exc1.o
-msoft-float -march=mips1 -mabi=32
mipsel-unknown-elf-as /home/xavier/psxsdk-src/libpsx/src/syscalls.s -o
obj/syscalls.o -msoft-float -march=mips1 -mabi=32
mipsel-unknown-elf-as /home/xavier/psxsdk-src/libpsx/src/start/start.s -o
obj/start.o -msoft-float -march=mips1 -mabi=32
mipsel-unknown-elf-as /home/xavier/psxsdk-src/libpsx/src/runexe/stage2.s -o
obj/stage2.o -msoft-float -march=mips1 -mabi=32
zig build-exe src/main.zig -Ddprintf=printf -L.
-I/home/xavier/psxsdk-src/libpsx/include
-I/home/xavier/psxsdk-src/libpsx/include/sys
/home/xavier/psxsdk-src/libpsx/src/atexit.c
/home/xavier/psxsdk-src/libpsx/src/cdrom.c
/home/xavier/psxsdk-src/libpsx/src/cop.c
/home/xavier/psxsdk-src/libpsx/src/exception.c
/home/xavier/psxsdk-src/libpsx/src/gpu.c
/home/xavier/psxsdk-src/libpsx/src/libc.c
/home/xavier/psxsdk-src/libpsx/src/memcard.c
/home/xavier/psxsdk-src/libpsx/src/memory.c
/home/xavier/psxsdk-src/libpsx/src/pad.c
/home/xavier/psxsdk-src/libpsx/src/psxsdk.c
/home/xavier/psxsdk-src/libpsx/src/setup.c
/home/xavier/psxsdk-src/libpsx/src/sio.c
/home/xavier/psxsdk-src/libpsx/src/spu.c
/home/xavier/psxsdk-src/libpsx/src/util.c
/home/xavier/psxsdk-src/libpsx/src/libc/error.c
/home/xavier/psxsdk-src/libpsx/src/libc/misc.c
/home/xavier/psxsdk-src/libpsx/src/libc/printf.c
/home/xavier/psxsdk-src/libpsx/src/libc/qsort.c
/home/xavier/psxsdk-src/libpsx/src/libc/scanf.c
/home/xavier/psxsdk-src/libpsx/src/libc/stat.c
/home/xavier/psxsdk-src/libpsx/src/libc/string.c
/home/xavier/psxsdk-src/libpsx/src/libc/strings.c
/home/xavier/psxsdk-src/libpsx/src/libc/unistd.c obj/cdromh.o obj/exc1.o
obj/syscalls.o obj/start.o obj/stage2.o -target mipsel-freestanding-none
--single-threaded -mcpu mips1+soft_float -ffunction-sections -Tpsx.ld
warning: MIPS-I support is experimental
lld: error: obj/cdromh.o: STB_LOCAL symbol (9) found at index >= .symtab's
sh_info (8)
lld: error: obj/cdromh.o: STB_LOCAL symbol (10) found at index >= .symtab's
sh_info (8)
lld: error: obj/cdromh.o: STB_LOCAL symbol (12) found at index >= .symtab's
sh_info (8)
lld: error: obj/cdromh.o: STB_LOCAL symbol (14) found at index >= .symtab's
sh_info (8)
lld: error: obj/syscalls.o: STB_LOCAL symbol (13) found at index >= .symtab's
sh_info (8)
lld: error: obj/start.o: STB_LOCAL symbol (24) found at index >= .symtab's
sh_info (8)
lld: error: obj/start.o: STB_LOCAL symbol (25) found at index >= .symtab's
sh_info (8)
lld: error: obj/start.o: STB_LOCAL symbol (27) found at index >= .symtab's
sh_info (8)
lld: error: obj/start.o: STB_LOCAL symbol (28) found at index >= .symtab's
sh_info (8)
lld: error: obj/start.o: STB_LOCAL symbol (29) found at index >= .symtab's
sh_info (8)
lld: error: obj/start.o: STB_LOCAL symbol (30) found at index >= .symtab's
sh_info (8)
lld: error: obj/start.o: STB_LOCAL symbol (31) found at index >= .symtab's
sh_info (8)
lld: error: obj/start.o: STB_LOCAL symbol (32) found at index >= .symtab's
sh_info (8)
lld: error: obj/start.o: STB_LOCAL symbol (33) found at index >= .symtab's
sh_info (8)
lld: error: obj/start.o: STB_LOCAL symbol (34) found at index >= .symtab's
sh_info (8)
lld: error: obj/start.o: STB_LOCAL symbol (35) found at index >= .symtab's
sh_info (8)
lld: error: obj/start.o: STB_LOCAL symbol (36) found at index >= .symtab's
sh_info (8)
lld: error: obj/start.o: STB_LOCAL symbol (37) found at index >= .symtab's
sh_info (8)
lld: error: obj/stage2.o: STB_LOCAL symbol (10) found at index >= .symtab's
sh_info (8)
lld: error: obj/stage2.o: STB_LOCAL symbol (11) found at index >= .symtab's
sh_info (8)
lld: error: obj/stage2.o: STB_LOCAL symbol (12) found at index >= .symtab's
sh_info (8)
attempt to unwrap error: LLDReportedFailure
/home/xavier/zig/src/link/Elf.zig:716:9: 0x5621554252e6 in link.Elf.flush
(zig1)
        return self.linkWithLLD(comp);
        ^
/home/xavier/zig/src/link.zig:354:21: 0x5621553e1d37 in link.File.flush (zig1)
            .elf => return @fieldParentPtr(Elf, "base", base).flush(comp),
                    ^
/home/xavier/zig/src/Compilation.zig:1100:5: 0x5621553dac4a in
Compilation.update (zig1)
    try self.bin_file.flush(self);
    ^
/home/xavier/zig/src/main.zig:1843:5: 0x562155392314 in main.updateModule
(zig1)
    try comp.update();
    ^
/home/xavier/zig/src/main.zig:1710:5: 0x5621552e99a2 in main.buildOutputType
(zig1)
    try updateModule(gpa, comp, zir_out_path, hook);
    ^
/home/xavier/zig/src/main.zig:159:9: 0x5621552c30e5 in main.mainArgs (zig1)
        return buildOutputType(gpa, arena, args, .{ .build = .Exe });
        ^
/home/xavier/zig/lib/std/heap.zig:83:5: 0x5621552bf2f9 in std.heap.cResize
(zig1)
    return error.OutOfMemory;
    ^
/home/xavier/zig/lib/std/heap.zig:83:5: 0x5621552bf2f9 in std.heap.cResize
(zig1)
    return error.OutOfMemory;
    ^
/home/xavier/zig/lib/std/heap.zig:83:5: 0x5621552bf2f9 in std.heap.cResize
(zig1)
    return error.OutOfMemory;
    ^
/home/xavier/zig/lib/std/heap.zig:83:5: 0x5621552bf2f9 in std.heap.cResize
(zig1)
    return error.OutOfMemory;
    ^
/home/xavier/zig/lib/std/heap.zig:83:5: 0x5621552bf2f9 in std.heap.cResize
(zig1)
    return error.OutOfMemory;
    ^
/home/xavier/zig/lib/std/heap.zig:83:5: 0x5621552bf2f9 in std.heap.cResize
(zig1)
    return error.OutOfMemory;
    ^
/home/xavier/zig/lib/std/heap.zig:83:5: 0x5621552bf2f9 in std.heap.cResize
(zig1)
    return error.OutOfMemory;
    ^
/home/xavier/zig/lib/std/heap.zig:83:5: 0x5621552bf2f9 in std.heap.cResize
(zig1)
    return error.OutOfMemory;
    ^
/home/xavier/zig/lib/std/heap.zig:83:5: 0x5621552bf2f9 in std.heap.cResize
(zig1)
    return error.OutOfMemory;
    ^
/home/xavier/zig/lib/std/heap.zig:83:5: 0x5621552bf2f9 in std.heap.cResize
(zig1)
    return error.OutOfMemory;
    ^
/home/xavier/zig/lib/std/heap.zig:83:5: 0x5621552bf2f9 in std.heap.cResize
(zig1)
    return error.OutOfMemory;
    ^
/home/xavier/zig/lib/std/heap.zig:83:5: 0x5621552bf2f9 in std.heap.cResize
(zig1)
    return error.OutOfMemory;
    ^
/home/xavier/zig/lib/std/heap.zig:83:5: 0x5621552bf2f9 in std.heap.cResize
(zig1)
    return error.OutOfMemory;
    ^
/home/xavier/zig/lib/std/heap.zig:83:5: 0x5621552bf2f9 in std.heap.cResize
(zig1)
    return error.OutOfMemory;
    ^
/home/xavier/zig/lib/std/heap.zig:83:5: 0x5621552bf2f9 in std.heap.cResize
(zig1)
    return error.OutOfMemory;
    ^
/home/xavier/zig/lib/std/heap.zig:83:5: 0x5621552bf2f9 in std.heap.cResize
(zig1)
    return error.OutOfMemory;
    ^
/home/xavier/zig/lib/std/heap.zig:83:5: 0x5621552bf2f9 in std.heap.cResize
(zig1)
    return error.OutOfMemory;
    ^
/home/xavier/zig/lib/std/mem/Allocator.zig:319:16: 0x5621554cf809 in
std.mem.Allocator.resize (zig1)
    const rc = try self.resizeFn(self, old_byte_slice, Slice.alignment,
new_byte_count, 0, @returnAddress());
               ^
/home/xavier/zig/lib/std/heap.zig:83:5: 0x5621552bf2f9 in std.heap.cResize
(zig1)
    return error.OutOfMemory;
    ^
/home/xavier/zig/lib/std/heap.zig:83:5: 0x5621552bf2f9 in std.heap.cResize
(zig1)
    return error.OutOfMemory;
    ^
/home/xavier/zig/lib/std/heap.zig:83:5: 0x5621552bf2f9 in std.heap.cResize
(zig1)
    return error.OutOfMemory;
    ^
/home/xavier/zig/lib/std/heap.zig:83:5: 0x5621552bf2f9 in std.heap.cResize
(zig1)
    return error.OutOfMemory;
    ^
/home/xavier/zig/lib/std/mem/Allocator.zig:319:16: 0x5621554cf809 in
std.mem.Allocator.resize (zig1)
    const rc = try self.resizeFn(self, old_byte_slice, Slice.alignment,
new_byte_count, 0, @returnAddress());
               ^
/home/xavier/zig/lib/std/heap.zig:83:5: 0x5621552bf2f9 in std.heap.cResize
(zig1)
    return error.OutOfMemory;
    ^
/home/xavier/zig/lib/std/mem/Allocator.zig:319:16: 0x5621554cf809 in
std.mem.Allocator.resize (zig1)
    const rc = try self.resizeFn(self, old_byte_slice, Slice.alignment,
new_byte_count, 0, @returnAddress());
               ^
/home/xavier/zig/src/link/Elf.zig:1652:9: 0x562155435c4a in
link.Elf.linkWithLLD (zig1)
        return error.LLDReportedFailure;
        ^
???:?:?: 0x5621552c4305 in ??? (???)
/home/xavier/zig/src/stage1.zig:45:43: 0x5621552c2c2d in main (zig1)
        stage2.mainArgs(gpa, arena, args) catch unreachable;
                                          ^
???:?:?: 0x7f9a89b2c0b2 in ??? (???)
make: *** [Makefile:35: main] Aborted (core dumped)
-----------------------------------------------------------------------------------------------

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20201103/aaa48671/attachment-0001.html>


More information about the llvm-bugs mailing list