llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28.77k stars 11.89k forks source link

missing FILE symbol for .(s|S) files #33366

Open llvmbot opened 7 years ago

llvmbot commented 7 years ago
Bugzilla Link 34019
Version unspecified
OS All
Reporter LLVM Bugzilla Contributor
CC @pogo59

Extended Description

Hello

When compiling .(s|S) files with clang, a FILE symbol is missing from the object file, unless explicitly setting one with the .file directive. Not using the integrated as, also fixes the issue:

$ clang -g bzero.S a.c && readelf -Ws a.out | grep FILE 33: 0000000000000000 0 FILE LOCAL DEFAULT ABS a.c

$ clang -no-integrated-as -g bzero.S a.c && readelf -Ws a.out | grep FILE 31: 0000000000000000 0 FILE LOCAL DEFAULT ABS bzero.S 33: 0000000000000000 0 FILE LOCAL DEFAULT ABS a.c

$ gcc -g bzero.S a.c && readelf -Ws a.out | grep FILE
31: 0000000000000000 0 FILE LOCAL DEFAULT ABS bzero.S 33: 0000000000000000 0 FILE LOCAL DEFAULT ABS a.c

This seems like a bug and the FILE symbol should be added with the integrated as as well.

Thank you!

llvmbot commented 6 years ago

I see no reason why using the integrated assembler vs gas should differ here so this is a bug.

Can you add your patch and a test case on phabricator (reviews.llvm.org)?

llvmbot commented 7 years ago

It's been more than a month now. Any input anyone?

llvmbot commented 7 years ago

emit file directive all the time Second patch makes sure to always emit the file directive even if -g is used and avoids adding an empty or an - (stdin) entry.

llvmbot commented 7 years ago

emit file directive if not generating dwarf The patch that I've attached works for me and generates the proper file directive for the non-dwarf case.

llvmbot commented 7 years ago

Is this a bug, undefined behaviour or intended?