36 lines
1.4 KiB
Plaintext
36 lines
1.4 KiB
Plaintext
$OpenBSD: patch-lib_MC_MCParser_AsmParser_cpp,v 1.4 2018/04/07 14:55:42 ajacoutot Exp $
|
|
|
|
make clang include a FILE symbol for .(s|S) files
|
|
|
|
This is mostly needed by syspatch at the moment to be
|
|
to be able to re-link in the same order as the original
|
|
libraries were linked with by relying on the readelf(1)
|
|
and without this .(s|S) assembly files were not getting
|
|
a file directive.
|
|
|
|
Index: lib/MC/MCParser/AsmParser.cpp
|
|
--- lib/MC/MCParser/AsmParser.cpp.orig
|
|
+++ lib/MC/MCParser/AsmParser.cpp
|
|
@@ -835,6 +835,8 @@ bool AsmParser::Run(bool NoInitialTextSection, bool No
|
|
AsmCond StartingCondState = TheCondState;
|
|
SmallVector<AsmRewrite, 4> AsmStrRewrites;
|
|
|
|
+ StringRef Filename = getContext().getMainFileName();
|
|
+
|
|
// If we are generating dwarf for assembly source files save the initial text
|
|
// section and generate a .file directive.
|
|
if (getContext().getGenDwarfForAssembly()) {
|
|
@@ -848,8 +850,11 @@ bool AsmParser::Run(bool NoInitialTextSection, bool No
|
|
assert(InsertResult && ".text section should not have debug info yet");
|
|
(void)InsertResult;
|
|
getContext().setGenDwarfFileNumber(getStreamer().EmitDwarfFileDirective(
|
|
- 0, StringRef(), getContext().getMainFileName()));
|
|
+ 0, StringRef(), Filename));
|
|
}
|
|
+
|
|
+ if (!Filename.empty() && (Filename.compare(StringRef("-")) != 0))
|
|
+ Out.EmitFileDirective(Filename);
|
|
|
|
// While we have input, parse each statement.
|
|
while (Lexer.isNot(AsmToken::Eof)) {
|