Bug 188699 - Adjust CMAKE_MODULE_LINKER_FLAGS for asan
Summary: Adjust CMAKE_MODULE_LINKER_FLAGS for asan
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: Other
Hardware: PC Linux
: P2 Normal
Assignee: Michael Catanzaro
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2018-08-17 10:01 PDT by Michael Catanzaro
Modified: 2018-08-18 08:03 PDT (History)
6 users (show)

See Also:


Attachments
Patch (1.26 KB, patch)
2018-08-17 10:02 PDT, Michael Catanzaro
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Catanzaro 2018-08-17 10:01:26 PDT
As suggested by Konstantin, it's good form to set CMAKE_MODULE_LINKER_FLAGS for when enabling asan.
Comment 1 Michael Catanzaro 2018-08-17 10:02:02 PDT
Created attachment 347362 [details]
Patch
Comment 2 Michael Catanzaro 2018-08-17 10:09:06 PDT
Comment on attachment 347362 [details]
Patch

Hm, maybe should also set CMAKE_STATIC_LINKER_FLAGS
Comment 3 Konstantin Tokarev 2018-08-17 10:10:51 PDT
Comment on attachment 347362 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=347362&action=review

> Source/cmake/WebKitCompilerFlags.cmake:177
> +        set(CMAKE_MODULE_LINKER_FLAGS "-lpthread ${CMAKE_MODULE_LINKER_FLAGS} -fsanitize=address")

It would be better to avoid duplication of flags, e.g.

  set(CMAKE_EXE_LINKER_FLAGS "-lpthread ${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address")
  set(CMAKE_SHARED_LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS})
  set(CMAKE_MODULE_LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS})
Comment 4 Konstantin Tokarev 2018-08-17 10:11:24 PDT
(In reply to Michael Catanzaro from comment #2)
> Hm, maybe should also set CMAKE_STATIC_LINKER_FLAGS

No, it's not needed
Comment 5 Michael Catanzaro 2018-08-17 11:06:10 PDT
(In reply to Konstantin Tokarev from comment #3)
> It would be better to avoid duplication of flags, e.g.
> 
>   set(CMAKE_EXE_LINKER_FLAGS "-lpthread ${CMAKE_EXE_LINKER_FLAGS}
> -fsanitize=address")
>   set(CMAKE_SHARED_LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS})
>   set(CMAKE_MODULE_LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS})

Well that's no good, what if the user wants to set different flags?

I checked what ECMEnableSanitizers is doing and it boils down to link_libraries("asan")
Comment 6 Konstantin Tokarev 2018-08-17 11:09:07 PDT
(In reply to Michael Catanzaro from comment #5)
> (In reply to Konstantin Tokarev from comment #3)
> > It would be better to avoid duplication of flags, e.g.
> > 
> >   set(CMAKE_EXE_LINKER_FLAGS "-lpthread ${CMAKE_EXE_LINKER_FLAGS}
> > -fsanitize=address")
> >   set(CMAKE_SHARED_LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS})
> >   set(CMAKE_MODULE_LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS})
> 
> Well that's no good, what if the user wants to set different flags?

Oops. Just wanted to get away without additional variable, but it was surely wrong
Comment 7 Konstantin Tokarev 2018-08-17 11:10:41 PDT
(In reply to Michael Catanzaro from comment #5)
> I checked what ECMEnableSanitizers is doing and it boils down to
> link_libraries("asan")

Yep, it should be fine, at least ECMEnableSanitizers works fine with QtWebKit
Comment 8 Michael Catanzaro 2018-08-17 11:19:04 PDT
Comment on attachment 347362 [details]
Patch

Bringing back this original patch... I was hoping to fix asan under flatpak here, but it's too much work for this bug.
Comment 9 WebKit Commit Bot 2018-08-18 08:00:19 PDT
Comment on attachment 347362 [details]
Patch

Clearing flags on attachment: 347362

Committed r235010: <https://trac.webkit.org/changeset/235010>
Comment 10 WebKit Commit Bot 2018-08-18 08:00:20 PDT
All reviewed patches have been landed.  Closing bug.
Comment 11 Radar WebKit Bug Importer 2018-08-18 08:03:18 PDT
<rdar://problem/43461813>