Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ Next version
- GPR#164: Recognize `-mwindows` and `-mconsole` for greater compatibility (with
`pkg-config` in particular).
(Nicolás Ojeda Bär, review by David Allsopp)
- GRP#169: Drop the .llvm_addrsig section from rewritten objects.
(Antonin Décimo, review by David Allsopp)

Version 0.44
- GPR#127: Recognise hyphens in option names in the COFF .drectve section.
Expand Down
18 changes: 18 additions & 0 deletions reloc.ml
Original file line number Diff line number Diff line change
Expand Up @@ -926,6 +926,23 @@ let build_dll link_exe output_file files exts extra_args =

List.iter (fun s -> exported := StrSet.add (usym s) !exported) !defexports;

(* Drop the .llvm_addrsig section (an optional hint for the linker's
identical-code-folding pass, emitted by clang) from rewritten objects:
its payload consists of symbol table indices which become stale when
the symbol table is rewritten, and lld-link rejects objects with an
invalid address-significance table. *)
let drop_addrsig obj =
let addrsig s = s.sec_name = ".llvm_addrsig" in
obj.sections <- List.filter (fun s -> not (addrsig s)) obj.sections;
obj.symbols <-
List.filter
(fun s ->
match s.section with
| `Section sec -> not (addrsig sec)
| `Num _ -> true)
obj.symbols
in

let record_obj obj =
if !builtin_linker then ""
else begin
Expand Down Expand Up @@ -959,6 +976,7 @@ let build_dll link_exe output_file files exts extra_args =
let close_obj name imps obj =
error_imports name imps;
add_reloc name obj imps;
drop_addrsig obj;
record_obj obj
in

Expand Down