summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2015-06-05 22:28:12 -0400
committermidipix <writeonce@midipix.org>2015-06-05 22:28:12 -0400
commit9a309e895bb88a083440228bd32c5766d540e1a7 (patch)
treef5a42dd6125bd536c2210bc7df5907b2b70e60c4
parentd7559106d2d94a78b4c8a718a86c1655931b0429 (diff)
downloadscrap-9a309e895bb88a083440228bd32c5766d540e1a7.tar.bz2
scrap-9a309e895bb88a083440228bd32c5766d540e1a7.tar.xz
weak symbols using mingw toolchain
-rw-r--r--weak/a.c11
-rw-r--r--weak/a.obin0 -> 848 bytes
-rw-r--r--weak/a.o.dis34
-rw-r--r--weak/a_and_b.log2
-rw-r--r--weak/aonly.dll.dis61
-rw-r--r--weak/b.c7
-rw-r--r--weak/b.obin0 -> 700 bytes
-rw-r--r--weak/b.o.dis13
8 files changed, 128 insertions, 0 deletions
diff --git a/weak/a.c b/weak/a.c
new file mode 100644
index 0000000..49f7d57
--- /dev/null
+++ b/weak/a.c
@@ -0,0 +1,11 @@
+int __sym(int x)
+{
+ return x+1;
+}
+
+extern int sym(int x) __attribute__((weak,alias("__sym")));
+
+int same(int x)
+{
+ return sym(x)*3;
+}
diff --git a/weak/a.o b/weak/a.o
new file mode 100644
index 0000000..98fded8
--- /dev/null
+++ b/weak/a.o
Binary files differ
diff --git a/weak/a.o.dis b/weak/a.o.dis
new file mode 100644
index 0000000..f93146b
--- /dev/null
+++ b/weak/a.o.dis
@@ -0,0 +1,34 @@
+
+a.o: Dateiformat pe-x86-64
+
+
+Disassembly of section .text:
+
+0000000000000000 <__sym>:
+ 0: 8d 41 01 lea 0x1(%rcx),%eax
+ 3: c3 retq
+ 4: 66 66 66 2e 0f 1f 84 data32 data32 nopw %cs:0x0(%rax,%rax,1)
+ b: 00 00 00 00 00
+
+0000000000000010 <same>:
+ 10: 48 83 ec 28 sub $0x28,%rsp
+ 14: e8 00 00 00 00 callq 19 <same+0x9>
+ 15: R_X86_64_PC32 sym
+ 19: 8d 04 40 lea (%rax,%rax,2),%eax
+ 1c: 48 83 c4 28 add $0x28,%rsp
+ 20: c3 retq
+ 21: 90 nop
+ 22: 90 nop
+ 23: 90 nop
+ 24: 90 nop
+ 25: 90 nop
+ 26: 90 nop
+ 27: 90 nop
+ 28: 90 nop
+ 29: 90 nop
+ 2a: 90 nop
+ 2b: 90 nop
+ 2c: 90 nop
+ 2d: 90 nop
+ 2e: 90 nop
+ 2f: 90 nop
diff --git a/weak/a_and_b.log b/weak/a_and_b.log
new file mode 100644
index 0000000..e989602
--- /dev/null
+++ b/weak/a_and_b.log
@@ -0,0 +1,2 @@
+a.o:a.c:(.text+0x15): undefined reference to `sym'
+b.o:b.c:(.text+0x5): undefined reference to `sym'
diff --git a/weak/aonly.dll.dis b/weak/aonly.dll.dis
new file mode 100644
index 0000000..3f23601
--- /dev/null
+++ b/weak/aonly.dll.dis
@@ -0,0 +1,61 @@
+
+aonly.dll: file format pei-x86-64
+
+
+Disassembly of section .text:
+
+0000000010001000 <__sym>:
+ 10001000: 8d 41 01 lea 0x1(%rcx),%eax
+ 10001003: c3 retq
+ 10001004: 66 66 66 2e 0f 1f 84 data32 data32 nopw %cs:0x0(%rax,%rax,1)
+ 1000100b: 00 00 00 00 00
+
+0000000010001010 <same>:
+ 10001010: 48 83 ec 28 sub $0x28,%rsp
+ 10001014: e8 e7 ff ff ff callq 10001000 <__sym>
+ 10001019: 8d 04 40 lea (%rax,%rax,2),%eax
+ 1000101c: 48 83 c4 28 add $0x28,%rsp
+ 10001020: c3 retq
+ 10001021: 90 nop
+ 10001022: 90 nop
+ 10001023: 90 nop
+ 10001024: 90 nop
+ 10001025: 90 nop
+ 10001026: 90 nop
+ 10001027: 90 nop
+ 10001028: 90 nop
+ 10001029: 90 nop
+ 1000102a: 90 nop
+ 1000102b: 90 nop
+ 1000102c: 90 nop
+ 1000102d: 90 nop
+ 1000102e: 90 nop
+ 1000102f: 90 nop
+
+0000000010001030 <__CTOR_LIST__>:
+ 10001030: ff (bad)
+ 10001031: ff (bad)
+ 10001032: ff (bad)
+ 10001033: ff (bad)
+ 10001034: ff (bad)
+ 10001035: ff (bad)
+ 10001036: ff (bad)
+ 10001037: ff 00 incl (%rax)
+ 10001039: 00 00 add %al,(%rax)
+ 1000103b: 00 00 add %al,(%rax)
+ 1000103d: 00 00 add %al,(%rax)
+ ...
+
+0000000010001040 <__DTOR_LIST__>:
+ 10001040: ff (bad)
+ 10001041: ff (bad)
+ 10001042: ff (bad)
+ 10001043: ff (bad)
+ 10001044: ff (bad)
+ 10001045: ff (bad)
+ 10001046: ff (bad)
+ 10001047: ff 00 incl (%rax)
+ 10001049: 00 00 add %al,(%rax)
+ 1000104b: 00 00 add %al,(%rax)
+ 1000104d: 00 00 add %al,(%rax)
+ ...
diff --git a/weak/b.c b/weak/b.c
new file mode 100644
index 0000000..c7a1f11
--- /dev/null
+++ b/weak/b.c
@@ -0,0 +1,7 @@
+int sym(int x);
+
+int test(int x)
+{
+ return sym(x)*2;
+}
+
diff --git a/weak/b.o b/weak/b.o
new file mode 100644
index 0000000..45beb82
--- /dev/null
+++ b/weak/b.o
Binary files differ
diff --git a/weak/b.o.dis b/weak/b.o.dis
new file mode 100644
index 0000000..72c0677
--- /dev/null
+++ b/weak/b.o.dis
@@ -0,0 +1,13 @@
+
+b.o: Dateiformat pe-x86-64
+
+
+Disassembly of section .text:
+
+0000000000000000 <test>:
+ 0: 48 83 ec 28 sub $0x28,%rsp
+ 4: e8 00 00 00 00 callq 9 <test+0x9>
+ 5: R_X86_64_PC32 sym
+ 9: 01 c0 add %eax,%eax
+ b: 48 83 c4 28 add $0x28,%rsp
+ f: c3 retq