Object file questions

Artur Skawina via D.gnu d.gnu at puremagic.com
Thu Aug 14 11:18:44 PDT 2014


On 08/14/14 19:53, Timo Sintonen via D.gnu wrote:
> On Thursday, 14 August 2014 at 17:13:23 UTC, Johannes Pfau wrote:
>> Am Thu, 14 Aug 2014 10:07:04 +0000
>> schrieb "Timo Sintonen" <t.sintonen at luukku.com>:
>>
>>> I have been looking at object files to see if I can reduce the memory usage for minimum systems. There are two things I have noticed:
>>>
>>> 1. In the data segment there is some source code as ascii text from a template in gcc/atomics.d . This is in the actual data segment and not in debug info segments and goes into the data segment of the executable. I do not see any code using this data. Why is this in the executable and is it possible to remove it?
>>>
>>
>> Strange, could you post a testcase?
> It seems this comes from libdruntime and it exists in object.o and core/atomic.o, Testcase is to compile minlibd library as it is currently in the repo using the makefile as such.
> But I think it will be in any object file that imports gcc.atomics and uses the template in there.

diff --git a/libphobos/libdruntime/gcc/atomics.d b/libphobos/libdruntime/gcc/atomics.d
index 78e644191e8f..ee1a146b680e 100644
--- a/libphobos/libdruntime/gcc/atomics.d
+++ b/libphobos/libdruntime/gcc/atomics.d
@@ -28,7 +28,7 @@ import gcc.builtins;
  */
 private template __sync_op_and(string op1, string op2)
 {
-    const __sync_op_and = `
+    enum __sync_op_and = `
 T __sync_` ~ op1 ~ `_and_` ~ op2 ~ `(T)(const ref shared T ptr, T value)
 {
     static if (T.sizeof == byte.sizeof)

artur


More information about the D.gnu mailing list