This is an archive of the discontinued LLVM Phabricator instance.

Fix a bug that -isysroot is completely ignored on Unix
ClosedPublic

Authored by yamaguchi on Mar 30 2017, 7:56 AM.

Details

Summary

-isysroot is the flag which set the system root directory.
This bug report [1] shows that -isysroot is not handled at all on Unix, so fixed this bug.

After this diff, I could get this result [2].

[1] https://bugs.llvm.org//show_bug.cgi?id=11503
[2] https://pastebin.com/TeCmn9mj

Diff Detail

Repository
rL LLVM

Event Timeline

yamaguchi created this revision.Mar 30 2017, 7:56 AM
ruiu edited reviewers, added: ruiu; removed: rui314.Mar 30 2017, 9:24 AM
ruiu edited edge metadata.

Testcase?

yamaguchi edited the summary of this revision. (Show Details)Mar 30 2017, 5:15 PM
yamaguchi retitled this revision from Patch for bug 11503 to Fix a bug that -isysroot is completely ignored on Unix.Mar 30 2017, 5:20 PM
yamaguchi edited the summary of this revision. (Show Details)
v.g.vassilev edited edge metadata.Apr 1 2017, 1:35 AM

@yamaguchi, could you add a testcase? (cd clang_src_folder; git grep isysroot test) would give you an idea how and where to write that test.

Before the change in D31495, I couldn't pass the test and get this result [1]

However after the change in D31495, I could pass the test and get result below.

`--> build/bin/llvm-lit ~/llvm/tools/clang/test/Driver/sysroot-flags.c
llvm-lit: /home/yamaguchi/llvm/tools/clang/test/lit.cfg:200: note: using clang: '/home/yamaguchi/build/./bin/clang'
-- Testing: 1 tests, 1 threads --
PASS: Clang :: Driver/sysroot-flags.c (1 of 1)
Testing Time: 0.06s
  Expected Passes    : 1

So I thought this testcase is correct because -isysroot doesn't pass the test when it is not handled at all, but will pass the test when it is.
I would like to ask for advice.

[1] https://pastebin.com/QPumpsVU

@yamaguchi Please add the testcase to this patch.

I thought this testcase is already exists and working in clang/test/Driver/sysroot-flags.c, but is it not?

sysroot-flags.c

1 // Check for proper handling of --sysroot and -isysroot flags.
2 
3 // RUN: %clang -### -fsyntax-only -isysroot /foo/bar %s 2>&1 | \
4 // RUN:   FileCheck %s -check-prefix=ISYSROOT
5 // ISYSROOT: "-isysroot" "{{[^"]*}}/foo/bar"
yamaguchi updated this revision to Diff 94092.Apr 4 2017, 10:10 AM

Add path to the file.

yamaguchi updated this revision to Diff 95402.Apr 16 2017, 3:12 AM

Add testcase.

This revision is now accepted and ready to land.Apr 30 2017, 4:18 AM
This revision was automatically updated to reflect the committed changes.