LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 47348 - [x86 asm] Assertion failed: (Type == RT32_32), function getRelocType32, file llvm/lib/Target/X86/MCTargetDesc/X86ELFObjectWriter.cpp, line 260.
Summary: [x86 asm] Assertion failed: (Type == RT32_32), function getRelocType32, file ...
Status: NEW
Alias: None
Product: libraries
Classification: Unclassified
Component: Backend: X86 (show other bugs)
Version: trunk
Hardware: PC All
: P normal
Assignee: Unassigned LLVM Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-08-28 13:45 PDT by Dimitry Andric
Modified: 2020-08-30 01:41 PDT (History)
6 users (show)

See Also:
Fixed By Commit(s):


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dimitry Andric 2020-08-28 13:45:11 PDT
Building the FreeBSD port graphics/vulkan-loader [1] results in an assertion:

Assertion failed: (Type == RT32_32), function getRelocType32, file /usr/src/contrib/llvm-project/llvm/lib/Target/X86/MCTargetDesc/X86ELFObjectWriter.cpp, line 260.
PLEASE submit a bug report to https://bugs.freebsd.org/submit/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0.      Program arguments: clang -cc1as -triple i386-unknown-freebsd13.0 -filetype obj -main-file-name unknown_ext_chain_gas.s -target-cpu i686 -mrelocation-model static unknown_ext_chain_gas.s

This is caused by a @GOT relocation in the .s file [2]; minimized test case:

# clang -cc1as -triple i386-- -filetype obj unknown_ext_chain_gas-min.s
.intel_syntax noprefix
push offset termin_error_string@GOT

I could not find any version of clang that was able to compile this without asserting! GNU as has no problems, obviously:

% as -v unknown_ext_chain_gas-min.s -o unknown_ext_chain_gas-min.o
GNU assembler version 2.33.1 (i386-portbld-freebsd13.0) using BFD version (GNU Binutils) 2.33.1

% objdump -d -r unknown_ext_chain_gas-min.o

unknown_ext_chain_gas-min.o:     file format elf32-i386-freebsd


Disassembly of section .text:

00000000 <.text>:
   0:   68 00 00 00 00          push   $0x0
                        1: R_386_GOT32  termin_error_string

[1] https://github.com/KhronosGroup/Vulkan-Loader
[2] https://github.com/KhronosGroup/Vulkan-Loader/blob/master/loader/unknown_ext_chain_gas.S#L103