mirror of
https://github.com/rui314/mold.git
synced 2024-11-13 09:39:13 +03:00
[Mach-O] wip
This commit is contained in:
parent
2b807ddf83
commit
4a1ec53c24
@ -454,7 +454,7 @@ public:
|
||||
void compute_size(Context &ctx) override;
|
||||
void copy_buf(Context &ctx) override;
|
||||
|
||||
std::string contents{"\0"};
|
||||
std::string contents{1, '\0'};
|
||||
};
|
||||
|
||||
class OutputIndirectSymtabSection : public Chunk {
|
||||
|
31
test/macho/dead-strip.sh
Executable file
31
test/macho/dead-strip.sh
Executable file
@ -0,0 +1,31 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
cd $(dirname $0)
|
||||
mold=`pwd`/../../ld64.mold
|
||||
echo -n "Testing $(basename -s .sh $0) ... "
|
||||
t=$(pwd)/../../out/test/macho/$(basename -s .sh $0)
|
||||
mkdir -p $t
|
||||
|
||||
cat <<EOF | cc -o $t/a.o -c -xc -
|
||||
#include <stdio.h>
|
||||
|
||||
char msg1[] = "Hello world";
|
||||
char msg2[] = "Howdy world";
|
||||
|
||||
void hello() {
|
||||
printf("%s\n", msg1);
|
||||
}
|
||||
|
||||
void howdy() {
|
||||
printf("%s\n", msg2);
|
||||
}
|
||||
|
||||
int main() {
|
||||
hello();
|
||||
}
|
||||
EOF
|
||||
|
||||
clang -fuse-ld=$mold -o $t/exe $t/a.o -Wl,-dead_strip
|
||||
$t/exe | grep -q 'Hello world'
|
||||
|
||||
echo OK
|
Loading…
Reference in New Issue
Block a user