All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] Makefile: Symlink lib32 to lib for MIPS64/n32
@ 2013-07-01 10:51 Markos Chandras
  2013-07-02  5:59 ` Arnout Vandecappelle
  0 siblings, 1 reply; 8+ messages in thread
From: Markos Chandras @ 2013-07-01 10:51 UTC (permalink / raw)
  To: buildroot

From: Markos Chandras <markos.chandras@imgtec.com>

gcc hardcodes the uClibc interpreter for MIPS64/n32 as follows:
(gcc-4.7.3, gcc/config/mips/linux64.h):
define UCLIBC_DYNAMIC_LINKERN32 "/lib32/ld-uClibc.so.0"

However, buildroot always creates the $(TARGET_DIR)/lib and
$(TARGET_DIR)/usr/lib directories, therefore for consinstency
reasons, we create a lib32->lib symlink to fix the interpreter
problems for MIPS64/n32.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
---
 Makefile | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/Makefile b/Makefile
index c514e4f..0059d0c 100644
--- a/Makefile
+++ b/Makefile
@@ -436,6 +436,12 @@ $(BUILD_DIR)/.root:
 		--exclude .hg --exclude=CVS --exclude '*~' \
 		$(TARGET_SKELETON)/ $(TARGET_DIR)/
 	cp support/misc/target-dir-warning.txt $(TARGET_DIR_WARNING_FILE)
+ifeq ($(BR2_MIPS_NABI32),y)
+	pushd $(TARGET_DIR) > /dev/null 2>&1; \
+		ln -sfn lib lib32; \
+		ln -sfn lib usr/lib32; \
+		popd > /dev/null 2>&1
+endif
 	touch $@
 
 $(TARGET_DIR): $(BUILD_DIR)/.root
-- 
1.8.2.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [Buildroot] [PATCH] Makefile: Symlink lib32 to lib for MIPS64/n32
  2013-07-01 10:51 [Buildroot] [PATCH] Makefile: Symlink lib32 to lib for MIPS64/n32 Markos Chandras
@ 2013-07-02  5:59 ` Arnout Vandecappelle
  2013-07-02 11:04   ` Markos Chandras
  2013-07-02 13:36   ` Markos Chandras
  0 siblings, 2 replies; 8+ messages in thread
From: Arnout Vandecappelle @ 2013-07-02  5:59 UTC (permalink / raw)
  To: buildroot

On 07/01/13 12:51, Markos Chandras wrote:
> From: Markos Chandras <markos.chandras@imgtec.com>
>
> gcc hardcodes the uClibc interpreter for MIPS64/n32 as follows:
> (gcc-4.7.3, gcc/config/mips/linux64.h):
> define UCLIBC_DYNAMIC_LINKERN32 "/lib32/ld-uClibc.so.0"
>
> However, buildroot always creates the $(TARGET_DIR)/lib and
> $(TARGET_DIR)/usr/lib directories, therefore for consinstency
> reasons, we create a lib32->lib symlink to fix the interpreter
> problems for MIPS64/n32.

  I would say we do it for all 32-bit platforms. If people feel they 
can't afford the overhead of two additional inodes in their rootfs, they 
can still remove the link in a post-build script.

>
> Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
> ---
>   Makefile | 6 ++++++
>   1 file changed, 6 insertions(+)
>
> diff --git a/Makefile b/Makefile
> index c514e4f..0059d0c 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -436,6 +436,12 @@ $(BUILD_DIR)/.root:
>   		--exclude .hg --exclude=CVS --exclude '*~' \
>   		$(TARGET_SKELETON)/ $(TARGET_DIR)/
>   	cp support/misc/target-dir-warning.txt $(TARGET_DIR_WARNING_FILE)
> +ifeq ($(BR2_MIPS_NABI32),y)
> +	pushd $(TARGET_DIR) > /dev/null 2>&1; \
> +		ln -sfn lib lib32; \
> +		ln -sfn lib usr/lib32; \

  No need for the pushd/popd; just:

	ln -sfn lib $(TARGET_DIR)/lib32
	ln -sfn lib $(TARGET_DIR)/usr/lib32


  Regards,
  Arnout

> +		popd > /dev/null 2>&1
> +endif
>   	touch $@
>
>   $(TARGET_DIR): $(BUILD_DIR)/.root
>


-- 
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Buildroot] [PATCH] Makefile: Symlink lib32 to lib for MIPS64/n32
  2013-07-02  5:59 ` Arnout Vandecappelle
@ 2013-07-02 11:04   ` Markos Chandras
  2013-07-02 13:36   ` Markos Chandras
  1 sibling, 0 replies; 8+ messages in thread
From: Markos Chandras @ 2013-07-02 11:04 UTC (permalink / raw)
  To: buildroot

Hi Arnout,

On 2 July 2013 06:59, Arnout Vandecappelle <arnout@mind.be> wrote:
> On 07/01/13 12:51, Markos Chandras wrote:
>>
>> From: Markos Chandras <markos.chandras@imgtec.com>
>>
>> gcc hardcodes the uClibc interpreter for MIPS64/n32 as follows:
>> (gcc-4.7.3, gcc/config/mips/linux64.h):
>> define UCLIBC_DYNAMIC_LINKERN32 "/lib32/ld-uClibc.so.0"
>>
>> However, buildroot always creates the $(TARGET_DIR)/lib and
>> $(TARGET_DIR)/usr/lib directories, therefore for consinstency
>> reasons, we create a lib32->lib symlink to fix the interpreter
>> problems for MIPS64/n32.
>
>
>  I would say we do it for all 32-bit platforms. If people feel they can't
> afford the overhead of two additional inodes in their rootfs, they can still
> remove the link in a post-build script.

I wouldn't mind doing the symlink for the following architectures:

!mips64/n64 && !x86_64 && !sparc64. It's probably harmless.
Do I forget another architecture?

>> +ifeq ($(BR2_MIPS_NABI32),y)
>> +       pushd $(TARGET_DIR) > /dev/null 2>&1; \
>> +               ln -sfn lib lib32; \
>> +               ln -sfn lib usr/lib32; \
>
>
>  No need for the pushd/popd; just:
>
>         ln -sfn lib $(TARGET_DIR)/lib32
>         ln -sfn lib $(TARGET_DIR)/usr/lib32
>

Thanks. I will fix that in v2

--
Regards,
Markos Chandras

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Buildroot] [PATCH] Makefile: Symlink lib32 to lib for MIPS64/n32
  2013-07-02  5:59 ` Arnout Vandecappelle
  2013-07-02 11:04   ` Markos Chandras
@ 2013-07-02 13:36   ` Markos Chandras
  2013-07-02 16:29     ` Arnout Vandecappelle
  1 sibling, 1 reply; 8+ messages in thread
From: Markos Chandras @ 2013-07-02 13:36 UTC (permalink / raw)
  To: buildroot

Hi Arnout,

On 2 July 2013 06:59, Arnout Vandecappelle <arnout@mind.be> wrote:
> On 07/01/13 12:51, Markos Chandras wrote:
>>
>> From: Markos Chandras <markos.chandras@imgtec.com>
>>
>> gcc hardcodes the uClibc interpreter for MIPS64/n32 as follows:
>> (gcc-4.7.3, gcc/config/mips/linux64.h):
>> define UCLIBC_DYNAMIC_LINKERN32 "/lib32/ld-uClibc.so.0"
>>
>> However, buildroot always creates the $(TARGET_DIR)/lib and
>> $(TARGET_DIR)/usr/lib directories, therefore for consinstency
>> reasons, we create a lib32->lib symlink to fix the interpreter
>> problems for MIPS64/n32.
>
>
>  I would say we do it for all 32-bit platforms. If people feel they can't
> afford the overhead of two additional inodes in their rootfs, they can still
> remove the link in a post-build script.
>

Is this preferred?

+ifeq ($(BR2_MIPS_NABI64)$(BR2_aarch64)$(BR2_sh64)$(BR2_x86_64),)
+       ln -sfn lib $(TARGET_DIR)/lib32; \
+               ln -sfn lib $(TARGET_DIR)/usr/lib32;
+endif

--
Regards,
Markos Chandras

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Buildroot] [PATCH] Makefile: Symlink lib32 to lib for MIPS64/n32
  2013-07-02 13:36   ` Markos Chandras
@ 2013-07-02 16:29     ` Arnout Vandecappelle
  2013-07-02 17:55       ` Markos Chandras
  0 siblings, 1 reply; 8+ messages in thread
From: Arnout Vandecappelle @ 2013-07-02 16:29 UTC (permalink / raw)
  To: buildroot

On 07/02/13 15:36, Markos Chandras wrote:
> Hi Arnout,
>
> On 2 July 2013 06:59, Arnout Vandecappelle <arnout@mind.be> wrote:
>> On 07/01/13 12:51, Markos Chandras wrote:
>>>
>>> From: Markos Chandras <markos.chandras@imgtec.com>
>>>
>>> gcc hardcodes the uClibc interpreter for MIPS64/n32 as follows:
>>> (gcc-4.7.3, gcc/config/mips/linux64.h):
>>> define UCLIBC_DYNAMIC_LINKERN32 "/lib32/ld-uClibc.so.0"
>>>
>>> However, buildroot always creates the $(TARGET_DIR)/lib and
>>> $(TARGET_DIR)/usr/lib directories, therefore for consinstency
>>> reasons, we create a lib32->lib symlink to fix the interpreter
>>> problems for MIPS64/n32.
>>
>>
>>   I would say we do it for all 32-bit platforms. If people feel they can't
>> afford the overhead of two additional inodes in their rootfs, they can still
>> remove the link in a post-build script.
>>
>
> Is this preferred?
>
> +ifeq ($(BR2_MIPS_NABI64)$(BR2_aarch64)$(BR2_sh64)$(BR2_x86_64),)

  I was going to say:

ifeq ($(BR2_ARCH_IS_64),)

but only now I realise you're talking about n32 on a 64-bit MIPS. Though 
I must say, I don't understand why we call it BR2_ARCH_IS_64 if the ABI 
is 32 bit - or is it actually a 64-bit ABI that is just called n32 by 
accident?

  I also noticed now that for lib64, we only create the symlinks if they 
exists in the external toolchain, and we remove the lib64 directory in 
the internal toolchain. Perhaps this can be simplified into creating the 
lib64/lib32 links unconditionally after installing the toolchain?


> +       ln -sfn lib $(TARGET_DIR)/lib32; \
> +               ln -sfn lib $(TARGET_DIR)/usr/lib32;

  No need for the semicolon and the backslash, this can be done as two 
separate commands.


  Regards,
  Arnout

> +endif
>
> --
> Regards,
> Markos Chandras
>
>


-- 
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Buildroot] [PATCH] Makefile: Symlink lib32 to lib for MIPS64/n32
  2013-07-02 16:29     ` Arnout Vandecappelle
@ 2013-07-02 17:55       ` Markos Chandras
  2013-07-02 18:12         ` Arnout Vandecappelle
  0 siblings, 1 reply; 8+ messages in thread
From: Markos Chandras @ 2013-07-02 17:55 UTC (permalink / raw)
  To: buildroot

On 2 July 2013 17:29, Arnout Vandecappelle <arnout@mind.be> wrote:
> On 07/02/13 15:36, Markos Chandras wrote:

>> Is this preferred?
>>
>> +ifeq ($(BR2_MIPS_NABI64)$(BR2_aarch64)$(BR2_sh64)$(BR2_x86_64),)
>
>
>  I was going to say:
>
> ifeq ($(BR2_ARCH_IS_64),)
>
> but only now I realise you're talking about n32 on a 64-bit MIPS. Though I
> must say, I don't understand why we call it BR2_ARCH_IS_64 if the ABI is 32
> bit - or is it actually a 64-bit ABI that is just called n32 by accident?

n32 is a 64-bit ABI with 32-bit pointers (something like the new x32 for x86).

>
>  I also noticed now that for lib64, we only create the symlinks if they
> exists in the external toolchain, and we remove the lib64 directory in the
> internal toolchain. Perhaps this can be simplified into creating the
> lib64/lib32 links unconditionally after installing the toolchain?

Whatever works best. I have no strong preference on this.

>
>
>
>> +       ln -sfn lib $(TARGET_DIR)/lib32; \
>> +               ln -sfn lib $(TARGET_DIR)/usr/lib32;
>
>
>  No need for the semicolon and the backslash, this can be done as two
> separate commands.

Ok I will fix that.

--
Regards,
Markos Chandras

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Buildroot] [PATCH] Makefile: Symlink lib32 to lib for MIPS64/n32
  2013-07-02 17:55       ` Markos Chandras
@ 2013-07-02 18:12         ` Arnout Vandecappelle
  2013-07-02 18:19           ` Markos Chandras
  0 siblings, 1 reply; 8+ messages in thread
From: Arnout Vandecappelle @ 2013-07-02 18:12 UTC (permalink / raw)
  To: buildroot

On 07/02/13 19:55, Markos Chandras wrote:
> On 2 July 2013 17:29, Arnout Vandecappelle <arnout@mind.be> wrote:
>> On 07/02/13 15:36, Markos Chandras wrote:
>
>>> Is this preferred?
>>>
>>> +ifeq ($(BR2_MIPS_NABI64)$(BR2_aarch64)$(BR2_sh64)$(BR2_x86_64),)
>>
>>
>>   I was going to say:
>>
>> ifeq ($(BR2_ARCH_IS_64),)
>>
>> but only now I realise you're talking about n32 on a 64-bit MIPS. Though I
>> must say, I don't understand why we call it BR2_ARCH_IS_64 if the ABI is 32
>> bit - or is it actually a 64-bit ABI that is just called n32 by accident?
>
> n32 is a 64-bit ABI with 32-bit pointers (something like the new x32 for x86).

  Okay, so it's a 64-bit ABI that is called n32 by accident :-)

  Since it's not clear if lib32 is needed for other architectures, and 
since we don't always do it for the 64-bit architectures, it's probably 
better to keep your original condition on $(BR2_MIPS_NABI32).


>>   I also noticed now that for lib64, we only create the symlinks if they
>> exists in the external toolchain, and we remove the lib64 directory in the
>> internal toolchain. Perhaps this can be simplified into creating the
>> lib64/lib32 links unconditionally after installing the toolchain?
>
> Whatever works best. I have no strong preference on this.

  Probably it's best if your patch goes in as is, and it can be 
refactored later.

>>> +       ln -sfn lib $(TARGET_DIR)/lib32; \
>>> +               ln -sfn lib $(TARGET_DIR)/usr/lib32;
>>

  By the way, shouldn't the same be done in STAGING_DIR?


  Regards,
  Arnout

>>
>>   No need for the semicolon and the backslash, this can be done as two
>> separate commands.
>
> Ok I will fix that.
>
> --
> Regards,
> Markos Chandras
>
>


-- 
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Buildroot] [PATCH] Makefile: Symlink lib32 to lib for MIPS64/n32
  2013-07-02 18:12         ` Arnout Vandecappelle
@ 2013-07-02 18:19           ` Markos Chandras
  0 siblings, 0 replies; 8+ messages in thread
From: Markos Chandras @ 2013-07-02 18:19 UTC (permalink / raw)
  To: buildroot

On 2 July 2013 19:12, Arnout Vandecappelle <arnout@mind.be> wrote:
>>
>>
>> n32 is a 64-bit ABI with 32-bit pointers (something like the new x32 for
>> x86).
>
>
>  Okay, so it's a 64-bit ABI that is called n32 by accident :-)
>
>  Since it's not clear if lib32 is needed for other architectures, and since
> we don't always do it for the 64-bit architectures, it's probably better to
> keep your original condition on $(BR2_MIPS_NABI32).

Ok :)

>>>> +       ln -sfn lib $(TARGET_DIR)/lib32; \
>>>> +               ln -sfn lib $(TARGET_DIR)/usr/lib32;
>>>
>>>
>
>  By the way, shouldn't the same be done in STAGING_DIR?

I am not sure. The only problem I found was with the interpreter path
during runtime.
I can't see why lib32->lib is needed for the STAGING_DIR. Everything
in buildroot seems to depend
on lib and usr/lib and uClibc also uses MULTILIB_DIR="lib". I wouldn't
touch the STAGING_DIR for
now until I hit a real problem.

--
Regards,
Markos Chandras

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2013-07-02 18:19 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-01 10:51 [Buildroot] [PATCH] Makefile: Symlink lib32 to lib for MIPS64/n32 Markos Chandras
2013-07-02  5:59 ` Arnout Vandecappelle
2013-07-02 11:04   ` Markos Chandras
2013-07-02 13:36   ` Markos Chandras
2013-07-02 16:29     ` Arnout Vandecappelle
2013-07-02 17:55       ` Markos Chandras
2013-07-02 18:12         ` Arnout Vandecappelle
2013-07-02 18:19           ` Markos Chandras

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.