New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 811764 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Last visit > 30 days ago
Closed: Feb 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 1
Type: Bug

Blocking:
issue 776284



Sign in to add a comment

empty_main target doesn't build with ASan etc.

Project Member Reported by h...@chromium.org, Feb 13 2018

Issue description

Several of our Clang ToT bots are red due to this, e.g. https://ci.chromium.org/buildbot/chromium.clang/ToTLinuxASan/1404

FAILED: empty_main 
python "../../build/toolchain/gcc_link_wrapper.py" --output="./empty_main" -- ../../third_party/llvm-build/Release+Asserts/bin/clang++ -fPIC -Wl,-z,noexecstack -Wl,-z,now -Wl,-z,relro -fuse-ld=lld -m64 -Werror -Wl,-O2 -Wl,--gc-sections -Wl,--fatal-warnings -nostdlib++ --sysroot=../../build/linux/debian_stretch_amd64-sysroot -L../../build/linux/debian_stretch_amd64-sysroot/lib/x86_64-linux-gnu -Wl,-rpath-link=../../build/linux/debian_stretch_amd64-sysroot/lib/x86_64-linux-gnu -L../../build/linux/debian_stretch_amd64-sysroot/usr/lib/x86_64-linux-gnu -Wl,-rpath-link=../../build/linux/debian_stretch_amd64-sysroot/usr/lib/x86_64-linux-gnu -fsanitize=address -fsanitize-address-use-after-scope -fsanitize=leak -Wl,-rpath-link=. -Wl,--disable-new-dtags -Wl,-rpath=\$ORIGIN/. -Wl,-rpath-link=. -o "./empty_main" -Wl,--start-group @"./empty_main.rsp"  -Wl,--end-group   -ldl -lpthread -lrt 
/b/c/b/ToTLinuxASan/src/out/Release/../../third_party/llvm-build/Release+Asserts/bin/ld.lld: error: undefined symbol: typeinfo for __cxxabiv1::__si_class_type_info
>>> referenced by ubsan_type_hash_itanium.cc:163 (/b/c/b/ToTLinuxASan/src/third_party/llvm/compiler-rt/lib/ubsan/ubsan_type_hash_itanium.cc:163)
>>>               ubsan_type_hash_itanium.cc.o:(findBaseAtOffset(__cxxabiv1::__class_type_info const*, long)) in archive /b/c/b/ToTLinuxASan/src/third_party/llvm-build/Release+Asserts/lib/clang/7.0.0/lib/linux/libclang_rt.asan_cxx-x86_64.a
...

The failures started when the new target was introduced, by https://chromium-review.googlesource.com/876010

Patrik, maybe the new target should be guarded by if(!is_clang)?
 

Comment 1 by phoglund@google.com, Feb 13 2018

Oh, sorry about that. Feel free to revert my patch if you want to green up your bots. Wrapping in !is_clang also SGTM. It's EOD over here so I will take a look tomorrow.

Comment 2 by h...@chromium.org, Feb 13 2018

It's getting close to EOD here too :-) I'll revert for now, https://chromium-review.googlesource.com/c/chromium/src/+/916441
Ok, thanks.

I find it strange that

int main(int argc, char** argv) {
  return 0;
}

fails to link on ANY linker. That doesn't make a lot of sense. Does ASAN require some code to be linked into an an instrumented binary?

Anyway, wrapping in !is_clang is a good-enough workaround since we only need this target for gcc.
Blocking: 776284

Comment 5 by h...@chromium.org, Feb 14 2018

> I find it strange that
>
> int main(int argc, char** argv) {
>   return 0;
> }
>
> fails to link on ANY linker. That doesn't make a lot of sense. Does ASAN require some code to be linked into an an instrumented binary?

Yes, the ASan, UBSan etc. builds require additional runtime libraries to be linked in. That should happen automatically though, so I'm not sure what's causing a problem for this specific build target.

But it also sounds like the point of this is to test building with gcc, so I think wrapping in !is_clang makes sense in general.
Project Member

Comment 6 by bugdroid1@chromium.org, Feb 14 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/d80ab10ecaa1039887b2c0ba37de0bf702d651f9

commit d80ab10ecaa1039887b2c0ba37de0bf702d651f9
Author: Patrik Höglund <phoglund@chromium.org>
Date: Wed Feb 14 09:46:28 2018

Wrap empty_main with not is_clang.

This target is only needed by the GCC bot anyway. I hope this will
green up the clang ToT bots.

TBR=dpranke@chromium.org

Bug:  chromium:811764 
Change-Id: Icd1d12f52387adc9b1b81d50f4cb75dc3f3b8694
Reviewed-on: https://chromium-review.googlesource.com/918441
Reviewed-by: Patrik Höglund <phoglund@chromium.org>
Reviewed-by: Hans Wennborg <hans@chromium.org>
Commit-Queue: Patrik Höglund <phoglund@chromium.org>
Cr-Commit-Position: refs/heads/master@{#536689}
[modify] https://crrev.com/d80ab10ecaa1039887b2c0ba37de0bf702d651f9/BUILD.gn
[modify] https://crrev.com/d80ab10ecaa1039887b2c0ba37de0bf702d651f9/testing/BUILD.gn

Status: Fixed (was: Assigned)
The bot greened up now.

Comment 8 by h...@chromium.org, Feb 15 2018

Cc: phoglund@chromium.org
Owner: h...@chromium.org
Status: Assigned (was: Fixed)
dpranke suggested on the review that we should get to the bottom of the problem instead. I'll take a look.
Owner: phoglund@chromium.org
No, I'll take a look! :)
Project Member

Comment 10 by bugdroid1@chromium.org, Feb 19 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/d9dfb671fa036c084434eadfcf6f9af0c925d2a4

commit d9dfb671fa036c084434eadfcf6f9af0c925d2a4
Author: Patrik Höglund <phoglund@chromium.org>
Date: Mon Feb 19 11:55:36 2018

Make empty_main work on clang ASAN.

Bug:  chromium:811764 
Change-Id: I2d41e6941135dc9bd23f840a0ed7d992b85afa95
Reviewed-on: https://chromium-review.googlesource.com/920992
Reviewed-by: Hans Wennborg <hans@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Commit-Queue: Patrik Höglund <phoglund@chromium.org>
Cr-Commit-Position: refs/heads/master@{#537629}
[modify] https://crrev.com/d9dfb671fa036c084434eadfcf6f9af0c925d2a4/BUILD.gn
[modify] https://crrev.com/d9dfb671fa036c084434eadfcf6f9af0c925d2a4/testing/BUILD.gn

Status: Fixed (was: Assigned)

Sign in to add a comment