This is an archive of the discontinued LLVM Phabricator instance.

[gn build] Don't pass -Wl,-z,defs for sanitizer builds
ClosedPublic

Authored by aeubanks on Sep 20 2021, 10:47 AM.

Diff Detail

Event Timeline

aeubanks requested review of this revision.Sep 20 2021, 10:47 AM
aeubanks created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptSep 20 2021, 10:47 AM
aeubanks edited the summary of this revision. (Show Details)Sep 20 2021, 10:49 AM
thakis added inline comments.Sep 20 2021, 10:55 AM
llvm/utils/gn/build/BUILD.gn
374

Only on Linux (or non-win non-mac non-ios i guess. Maybe non-android non-fuchsia too, not sure there without looking it up)

Also, do we need a separate config for this? Can we edit llvm/utils/gn/build/BUILD.gn around line 91 and put something like

if (current_os != "ios" && current_os != "mac" && !(current_os == "linux" && (use_asan || use_tsan || use_ubsan))) {
  ldflags += [ "-Wl,-z,defs" ]
}

there?

(Things only go in configs if some configs need to opt out of them, which here doesn't seem to be the case as far as I can tell.)

aeubanks updated this revision to Diff 373662.Sep 20 2021, 11:07 AM
aeubanks edited the summary of this revision. (Show Details)

check current_os

llvm/utils/gn/build/BUILD.gn
374

I initially did put it there, but that adds -Wl,-z,defs to static links as well, which doesn't change anything but makes the command line a bit longer. If that's fine with you though I can do that.

thakis accepted this revision.Sep 20 2021, 11:35 AM

Oh I see, that makes sense.

This revision is now accepted and ready to land.Sep 20 2021, 11:35 AM
This revision was landed with ongoing or failed builds.Sep 20 2021, 11:39 AM
This revision was automatically updated to reflect the committed changes.