Skip to contentSkip to conversation

klibc: Add clang's -rtlib to known options

PATCH In review Khem Raj 2 participants 2 messages Jun 11, 2021

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH 1/1 klibc: Add clang's -rtlib to known options

This helps in ensuring that we always link klibc apps with libgcc as compiler-rt does not work for klibc due to missing libssp functions e.g. __stack_chk_guard and __stack_chk_guard which it expects in libc

Cc Andrea Adami <[email protected]>
---
 .../klibc/files/klcc-cross-accept-clang-options.patch        | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
meta-initramfs/recipes-devtools/klibc/files/klcc-cross-accept-clang-options.patch +4 -1
index 56905a5159..431c75e3af 100644
@@ -5,7 +5,7 @@ Signed-off-by: Khem Raj <[email protected]>
 
 --- a/klcc/klcc.in
 +++ b/klcc/klcc.in
-@@ -207,6 +207,24 @@ while ( defined($a = shift(@ARGV)) ) {
+@@ -207,6 +207,27 @@ while ( defined($a = shift(@ARGV)) ) {
      } elsif ( $a =~ /^--([sysroot=])(.*)$/ ) {
  	# Override gcc encoded sysroot
  	push(@ccopt, $a);
@@ -26,6 +26,9 @@ Signed-off-by: Khem Raj <[email protected]>
 +	push(@ccopt, $a);
 +    } elsif ( $a =~ '--unwindlib=.*' ) {
 +	# Allow clang options
++	push(@ccopt, $a);
++    } elsif ( $a =~ '-rtlib=.*' ) {
++	# Allow clang options
 +	push(@ccopt, $a);
      } else {
  	die "$0: unknown option: $a\n";
Signature · 1 line
2.32.0
#1 lore raw

Thanks, I'll plan to do more testing with clang/llvm.

BTW there is now klibc 2.0.9.
Cheers
Andrea

Quoted 37 lines · Khem Raj

This helps in ensuring that we always link klibc apps with libgcc as compiler-rt does not work for klibc due to missing libssp functions e.g. __stack_chk_guard and __stack_chk_guard which it expects in libc

Cc Andrea Adami <[email protected]>
---
 .../klibc/files/klcc-cross-accept-clang-options.patch        | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
meta-initramfs/recipes-devtools/klibc/files/klcc-cross-accept-clang-options.patch +4 -2
index 56905a5159..431c75e3af 100644
@@ -5,7 +5,7 @@ Signed-off-by: Khem Raj <[email protected]>
 
 --- a/klcc/klcc.in
 +++ b/klcc/klcc.in
-@@ -207,6 +207,24 @@ while ( defined($a = shift(@ARGV)) ) {
+@@ -207,6 +207,27 @@ while ( defined($a = shift(@ARGV)) ) {
      } elsif ( $a =~ /^--([sysroot=])(.*)$/ ) {
        # Override gcc encoded sysroot
        push(@ccopt, $a);
@@ -26,6 +26,9 @@ Signed-off-by: Khem Raj <[email protected]>
 +      push(@ccopt, $a);
 +    } elsif ( $a =~ '--unwindlib=.*' ) {
 +      # Allow clang options
++      push(@ccopt, $a);
++    } elsif ( $a =~ '-rtlib=.*' ) {
++      # Allow clang options
 +      push(@ccopt, $a);
      } else {
        die "$0: unknown option: $a\n";
--

2.32.0