Skip to content
This repository was archived by the owner on Nov 12, 2020. It is now read-only.

Commit 0746566

Browse files
aantrongasche
authored andcommitted
Don't emit .loc with negative column numbers
The Clang assembler does not accept these. They can arise when using Location.none, for example in a PPX.
1 parent e26cd12 commit 0746566

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

Changes

+3
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,9 @@ Compilers:
273273
- GPR#132: Flambda: new intermediate language and "middle-end" optimizers
274274
(Pierre Chambart, Mark Shinwell, Leo White)
275275

276+
- GPR#212, PR#7226, GPR#542: emit column position in gas assembly `.loc`
277+
(Frédéric Bour, Anton Bachin)
278+
276279
- GPR#207: Colors in compiler messages (warnings, errors)
277280
configure with -color {auto|always|never} or TERM=dumb
278281
(Simon Cruanes, review by Gabriel Scherer)

asmcomp/x86_gas.ml

+3-1
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,9 @@ let print_line b = function
284284
file_num (X86_proc.string_of_string_literal file_name)
285285
| Indirect_symbol s -> bprintf b "\t.indirect_symbol %s" s
286286
| Loc (file_num, line, col) ->
287-
bprintf b "\t.loc\t%d\t%d\t%d" file_num line col
287+
(* PR#7726: Location.none uses column -1, breaks LLVM assembler *)
288+
if col >= 0 then bprintf b "\t.loc\t%d\t%d\t%d" file_num line col
289+
else bprintf b "\t.loc\t%d\t%d" file_num line
288290
| Private_extern s -> bprintf b "\t.private_extern %s" s
289291
| Set (arg1, arg2) -> bprintf b "\t.set %s, %a" arg1 cst arg2
290292
| Size (s, c) -> bprintf b "\t.size %s,%a" s cst c

0 commit comments

Comments
 (0)