[lld] 227d18b - [lld][macho][NFC] Make MachO/start-end.s test less britle by checking for _main:

Puyan Lotfi via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 25 19:24:15 PST 2022


Author: Puyan Lotfi
Date: 2022-01-25T19:23:51-08:00
New Revision: 227d18b3a87a7bb544b76276a77def10294d1f0a

URL: https://github.com/llvm/llvm-project/commit/227d18b3a87a7bb544b76276a77def10294d1f0a
DIFF: https://github.com/llvm/llvm-project/commit/227d18b3a87a7bb544b76276a77def10294d1f0a.diff

LOG: [lld][macho][NFC] Make MachO/start-end.s test less britle by checking for _main:

In start-end.s there is a lit check line `# SEG: _main` to begin the
check at the start of the function main where `_main` is the Darwin name
mangling for C main. Because the text file that FileCheck is getting as
input has the path of the compiler build in it from llvm-mc and
llvm-objdump, and because of the lack of a trailing colon in this check
line we end up inadvertently matching against the line of text with the
compiler path in it in the case where said path contains "_main" some
place. This can be very likely if the compiler branch has "main" or
"_main" in it.

To fix this I include the training : since that will match on the
function label and not the path line.

Added: 
    

Modified: 
    lld/test/MachO/start-end.s

Removed: 
    


################################################################################
diff  --git a/lld/test/MachO/start-end.s b/lld/test/MachO/start-end.s
index f8f389ddf0ac0..ba02a1a643270 100644
--- a/lld/test/MachO/start-end.s
+++ b/lld/test/MachO/start-end.s
@@ -276,7 +276,7 @@
 # SEG-NEXT:   vmaddr 0x[[#%x, ASDFSTART:]]
 # SEG-NEXT:   vmsize 0x0000000000000000
 
-# SEG: _main
+# SEG: _main:
 
 ## segment$start$__TEXT / segment$end$__TEXT
 # SEG:      [[#%x, PC1:]]:


        


More information about the llvm-commits mailing list