[PATCH] D99078: [LLD] Implement /guard:[no]ehcont

Pengfei Wang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 24 08:30:35 PDT 2021


pengfei added a comment.

In D99078#2645963 <https://reviews.llvm.org/D99078#2645963>, @rnk wrote:

> In D99078#2644001 <https://reviews.llvm.org/D99078#2644001>, @pengfei wrote:
>
>> Hi @rnk , I'm implementing EHCont guard in LLD referring to your longjmp patch. Currently the binary's EHCont table always be null. I guess it results from I haven't told lld where's the place it should put the EHCont table in the load config table.
>> But I didn't find any related code in longjmp patch. Could you point me where the code is? Or I misunderstood something?
>
> The CRT is actually responsible for providing a struct defining the load configuration. You can see in the LLD gfids tests that they all have a blob like this:
>
>           .section .rdata,"dr"
>   .globl _load_config_used
>   _load_config_used:
>           .long 256
>           .fill 124, 1, 0
>           .quad __guard_fids_table
>           .quad __guard_fids_count
>           .long __guard_flags
>           .fill 128, 1, 0
>
> To add ehcont tests, you will need to provide a similar load config that llvm-readobj can parse. Hopefully that answers your question.

Yes. It solves my problems. Thanks very much.
Now, the last question: I found it works with a given load configuration in the test (That's why I'm sure it's the right direction), but still doesn't work when using clang-cl or/and lld-link to build a cpp file. I guess it maybe related to the lld-link that doesn't use the latest CRT. Do you know how to fix this problem?



================
Comment at: lld/test/COFF/pdb-natvis.test:17
 
-CHECK-FIRST:      {{.*}}natvis-1.natvis (16 bytes): obj=<null>, vname={{.*}}natvis-1.natvis, crc=355285096, compression=None
+CHECK-FIRST:      {{.*}}natvis-1.natvis (17 bytes): obj=<null>, vname={{.*}}natvis-1.natvis, crc=3974675339, compression=None
 CHECK-FIRST-NEXT: 1st Natvis Test
----------------
I have no idea how this been affected by this patch.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D99078/new/

https://reviews.llvm.org/D99078



More information about the llvm-commits mailing list