[PATCH] fix linker name for uClibc
Hi, uClibc-ng can be used for Microblaze architecture. It is regulary tested with qemu-system-microblaze in little and big endian mode. 2016-10-28 Waldemar Brodkorb gcc/ * config/microblaze/linux.h: add UCLIBC_DYNAMIC_LINKER diff --git a/gcc/config/microblaze/linux.h b/gcc/config/microblaze/linux.h index ae8523c..b3bf43a 100644 --- a/gcc/config/microblaze/linux.h +++ b/gcc/config/microblaze/linux.h @@ -29,6 +29,7 @@ #define TLS_NEEDS_GOT 1 #define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1" +#define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0" #if TARGET_BIG_ENDIAN_DEFAULT == 0 /* LE */ #define MUSL_DYNAMIC_LINKER_E "%{mbig-endian:;:el}" best regards Waldemar
[PATCH v2] libgcc/mkmap-symver: support skip_underscore (PR74748)
Hi, Some platforms, such as Blackfin, have a special prefix for assembly symbols as opposed to C symbols. For this reason, a function named "foo()" in C will in fact be visible as a symbol called "_foo" in the ELF binary. The current linker version script logic in libgcc doesn't take into account this situation properly. The Blackfin specific libgcc/config/bfin/libgcc-glibc.ver has an additional "_" in front of every symbol so that it matches the output of "nm" (which gets parsed to produce the final linker version script). But due to this additional "_", ld no longer matches with the symbols since "ld" does the matching with the original symbol name, not the one prefixed with "_". Due to this, none of the symbols in libgcc/config/bfin/libgcc-glibc.ver are actually matched with symbols in libgcc. This causes all libgcc symbols to be left as "LOCAL", which causes lots of "undefined reference" whenever some C or C++ code that calls a function of libgcc is compiled. To address this, this commit introduces a "skip_underscore" variable to the mkmap-symver script. It tells mkmap-symver to ignore the leading underscore from the "nm" output. Note that this new argument is different from the existing "leading_underscore" argument, which *adds* an additional underscore to the generated linker version script. Having this functionality paves the way to using the generic linker version information for Blackfin, instead of using a custom one. Signed-off-by: Thomas Petazzoni Tested-by: Waldemar Brodkorb 2016-11-26 Thomas Petazzoni PR gcc/74748 * libgcc/mkmap-symver.awk: add support for skip_underscore diff --git a/libgcc/mkmap-symver.awk b/libgcc/mkmap-symver.awk index 266832a..0a57d31 100644 --- a/libgcc/mkmap-symver.awk +++ b/libgcc/mkmap-symver.awk @@ -47,7 +47,11 @@ state == "nm" && ($1 == "U" || $2 == "U") { state == "nm" && NF == 3 { split ($3, s, "@") - def[s[1]] = 1; + if (skip_underscore && substr(s[1], 1, 1) == "_") + symname = substr(s[1], 2); + else + symname = s[1]; + def[symname] = 1; sawsymbol = 1; next; } Thanks in advance, Waldemar
[PATCH] add common CPP_SPECS for bfin
Hi, add common defines _REENTRANT and _POSIX_SOURCE for bfin. Patch is used in Buildroot for a while to fix issues compiling some software. See here, why this should be always enabled: https://lists.gnu.org/archive/html/autoconf-archive-maintainers/2016-06/msg1.html 2016-11-29 Waldemar Brodkorb gcc/ * gcc/config/bfin/linux.h: add common CPP_SPEC. diff --git a/gcc/config/bfin/linux.h b/gcc/config/bfin/linux.h index c02ff44..0922493 100644 --- a/gcc/config/bfin/linux.h +++ b/gcc/config/bfin/linux.h @@ -38,6 +38,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see "%{static:--start-group} %{mfast-fp:-lbffastfp} %G %L %{static:--end-group} \ %{!static:%{mfast-fp:-lbffastfp} %G}" +#undef CPP_SPEC +#define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}" + #undef LINK_SPEC #define LINK_SPEC "\ %{mfdpic: -m elf32bfinfd -z text} %{shared} %{pie} \
[PATCH] fix PR71721
Hi, it would be nice if uclinux targets are allowed to enable posix threads. Together with uClibc-ng/uClibc you can build m68k-nommu toolchain and enable old Linuxthreads instead of NPTL/TLS. With following change it is possible to build boost, which checks if gcc is build with threads enabled. Tested with a simple boost application on qemu-system-m68k emulating a coldfire board without MMU. Other noMMU targets as cortex-m3/cortex-m4 will benefit from this change, too. The patch is used in Buildroot for a while without causing issues. 2016-12-02 Waldemar Brodkorb gcc/ * gcc/config.gcc: Enable posix threads. diff --git a/gcc/config.gcc b/gcc/config.gcc index 98267d8..6a95009 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -831,6 +831,9 @@ case ${target} in *-*-uclinux*) extra_options="$extra_options gnu-user.opt" use_gcc_stdint=wrap + case ${enable_threads} in +"" | yes | posix) thread_file='posix' ;; + esac tm_defines="$tm_defines DEFAULT_LIBC=LIBC_UCLIBC SINGLE_LIBC" ;; *-*-rdos*)
[PATCH] fix PR68468
Hi, the following patch fixes PR68468. Patch is used for a while in Buildroot without issues. 2016-11-05 Waldemar Brodkorb PR gcc/68468 * libgcc/unwind-dw2-fde-dip.c: fix build on FDPIC targets. diff --git a/libgcc/unwind-dw2-fde-dip.c b/libgcc/unwind-dw2-fde-dip.c index f7a1c3f..801bce8 100644 --- a/libgcc/unwind-dw2-fde-dip.c +++ b/libgcc/unwind-dw2-fde-dip.c @@ -124,7 +124,11 @@ static struct frame_hdr_cache_element { _Unwind_Ptr pc_low; _Unwind_Ptr pc_high; +#if defined __FRV_FDPIC__ || defined __BFIN_FDPIC__ + struct elf32_fdpic_loadaddr load_base; +#else _Unwind_Ptr load_base; +#endif const ElfW(Phdr) *p_eh_frame_hdr; const ElfW(Phdr) *p_dynamic; struct frame_hdr_cache_element *link; @@ -163,7 +167,7 @@ _Unwind_IteratePhdrCallback (struct dl_phdr_info *info, size_t size, void *ptr) struct unw_eh_callback_data *data = (struct unw_eh_callback_data *) ptr; const ElfW(Phdr) *phdr, *p_eh_frame_hdr, *p_dynamic; long n, match; -#ifdef __FRV_FDPIC__ +#if defined __FRV_FDPIC__ || defined __BFIN_FDPIC__ struct elf32_fdpic_loadaddr load_base; #else _Unwind_Ptr load_base; @@ -347,7 +351,7 @@ _Unwind_IteratePhdrCallback (struct dl_phdr_info *info, size_t size, void *ptr) break; } } -# elif defined __FRV_FDPIC__ && defined __linux__ +# elif (defined __FRV_FDPIC__ || defined __BFIN_FDPIC__) && defined __linux__ data->dbase = load_base.got_value; # else # error What is DW_EH_PE_datarel base on this platform? Best regards Waldemar
[PATCH] libgcc/mkmap-symver: support skip_underscore (PR74748)
Hi, Some platforms, such as Blackfin, have a special prefix for assembly symbols as opposed to C symbols. For this reason, a function named "foo()" in C will in fact be visible as a symbol called "_foo" in the ELF binary. The current linker version script logic in libgcc doesn't take into account this situation properly. The Blackfin specific libgcc/config/bfin/libgcc-glibc.ver has an additional "_" in front of every symbol so that it matches the output of "nm" (which gets parsed to produce the final linker version script). But due to this additional "_", ld no longer matches with the symbols since "ld" does the matching with the original symbol name, not the one prefixed with "_". Due to this, none of the symbols in libgcc/config/bfin/libgcc-glibc.ver are actually matched with symbols in libgcc. This causes all libgcc symbols to be left as "LOCAL", which causes lots of "undefined reference" whenever some C or C++ code that calls a function of libgcc is compiled. To address this, this commit introduces a "skip_underscore" variable to the mkmap-symver script. It tells mkmap-symver to ignore the leading underscore from the "nm" output. Note that this new argument is different from the existing "leading_underscore" argument, which *adds* an additional underscore to the generated linker version script. Having this functionality paves the way to using the generic linker version information for Blackfin, instead of using a custom one. Signed-off-by: Thomas Petazzoni Tested-by: Waldemar Brodkorb 2016-11-06 Thomas Petazzoni PR gcc/74748 * libgcc/mkmap-symver.awk: add support for skip_underscore diff --git a/libgcc/mkmap-symver.awk b/libgcc/mkmap-symver.awk index 266832a..30bb179 100644 --- a/libgcc/mkmap-symver.awk +++ b/libgcc/mkmap-symver.awk @@ -47,7 +47,11 @@ state == "nm" && ($1 == "U" || $2 == "U") { state == "nm" && NF == 3 { split ($3, s, "@") - def[s[1]] = 1; + if (skip_underscore) + symname = substr(s[1], 2); + else + symname = s[1]; + def[symname] = 1; sawsymbol = 1; next; } Thanks in advance, Waldemar
[PATCH] libgcc/config/bfin: use the generic linker version information (PR74748)
Hi, This commit makes the Blackfin platform use the generic linker version information, rather than a completely duplicated file, specific for the Blackfin architecture. This is made possible using the newly introduced skip_underscore variable of the mkmap-symver script. This also allows to get a correct linker version file, with symbol names matching the ones found in libgcc. Thanks to this, the necessary symbols are marked "GLOBAL" instead of "LOCAL", which makes them visible at link time, and solves a large number of "undefined reference" issues. Indeed, the Blackfin specific linker version script had an extra underscore in front of all symbols, which meant none of them matched the symbols in libgcc, and therefore all libgcc symbols were marked as "LOCAL", making them invisible for linking. Signed-off-by: Thomas Petazzoni Tested-by: Waldemar Brodkorb 2016-11-06 Thomas Petazzoni PR gcc/74748 * libgcc/config/bfin/libgcc-glibc.ver, libgcc/config/bfin/t-linux: use generic linker version information on Blackfin. diff --git a/libgcc/config/bfin/libgcc-glibc.ver b/libgcc/config/bfin/libgcc-glibc.ver index b1bd2df..2af3df7 100644 --- a/libgcc/config/bfin/libgcc-glibc.ver +++ b/libgcc/config/bfin/libgcc-glibc.ver @@ -16,1898 +16,8 @@ # along with GCC; see the file COPYING3. If not see # <http://www.gnu.org/licenses/>. -GCC_3.0 { - # libgcc1 integer symbols - ___absvsi2 - ___addvsi3 - ___ashlsi3 - ___ashrsi3 - ___divsi3 - ___lshrsi3 - ___modsi3 - ___mulsi3 - ___mulvsi3 - ___negvsi2 - ___subvsi3 - ___udivsi3 - ___umodsi3 - - # libgcc1 floating point symbols - ___addsf3 - ___adddf3 - ___addxf3 - ___addtf3 - ___divsf3 - ___divdf3 - ___divxf3 - ___divtf3 - ___eqsf2 - ___eqdf2 - ___eqxf2 - ___eqtf2 - ___extenddfxf2 - ___extenddftf2 - ___extendsfdf2 - ___extendsfxf2 - ___extendsftf2 - ___fixsfsi - ___fixdfsi - ___fixxfsi - ___fixtfsi - ___floatsisf - ___floatsidf - ___floatsixf - ___floatsitf - ___gesf2 - ___gedf2 - ___gexf2 - ___getf2 - ___gtsf2 - ___gtdf2 - ___gtxf2 - ___gttf2 - ___lesf2 - ___ledf2 - ___lexf2 - ___letf2 - ___ltsf2 - ___ltdf2 - ___ltxf2 - ___lttf2 - ___mulsf3 - ___muldf3 - ___mulxf3 - ___multf3 - ___negsf2 - ___negdf2 - ___negxf2 - ___negtf2 - ___nesf2 - ___nedf2 - ___nexf2 - ___netf2 - ___subsf3 - ___subdf3 - ___subxf3 - ___subtf3 - ___truncdfsf2 - ___truncxfsf2 - ___trunctfsf2 - ___truncxfdf2 - ___trunctfdf2 - - # libgcc2 DImode arithmetic (for 32-bit targets). - ___absvdi2 - ___addvdi3 - ___ashldi3 - ___ashrdi3 - ___cmpdi2 - ___divdi3 - ___ffsdi2 - ___fixdfdi - ___fixsfdi - ___fixtfdi - ___fixxfdi - ___fixunsdfdi - ___fixunsdfsi - ___fixunssfsi - ___fixunssfdi - ___fixunstfdi - ___fixunstfsi - ___fixunsxfdi - ___fixunsxfsi - ___floatdidf - ___floatdisf - ___floatdixf - ___floatditf - ___lshrdi3 - ___moddi3 - ___muldi3 - ___mulvdi3 - ___negdi2 - ___negvdi2 - ___subvdi3 - ___ucmpdi2 - ___udivdi3 - ___udivmoddi4 - ___umoddi3 - - # libgcc2 TImode arithmetic (for 64-bit targets). - ___ashlti3 - ___ashrti3 - ___cmpti2 - ___divti3 - ___ffsti2 - ___fixdfti - ___fixsfti - ___fixtfti - ___fixxfti - ___lshrti3 - ___modti3 - ___multi3 - ___negti2 - ___ucmpti2 - ___udivmodti4 - ___udivti3 - ___umodti3 - ___fixunsdfti - ___fixunssfti - ___fixunstfti - ___fixunsxfti - ___floattidf - ___floattisf - ___floattixf - ___floattitf - - # Used to deal with trampoline initialization on some platforms - ___clear_cache - - # EH symbols - __Unwind_DeleteException - __Unwind_Find_FDE - __Unwind_ForcedUnwind - __Unwind_GetGR - __Unwind_GetIP - __Unwind_GetLanguageSpecificData - __Unwind_GetRegionStart - __Unwind_GetTextRelBase - __Unwind_GetDataRelBase - __Unwind_RaiseException - __Unwind_Resume - __Unwind_SetGR - __Unwind_SetIP - ___deregister_frame - ___deregister_frame_info - ___deregister_frame_info_bases - ___register_frame - ___register_frame_info - ___register_frame_info_bases - ___register_frame_info_table - ___register_frame_info_table_bases - ___register_frame_table - - # SjLj EH symbols - __Unwind_SjLj_Register - __Unwind_SjLj_Unregister - __Unwind_SjLj_RaiseException - __Unwind_SjLj_ForcedUnwind - __Unwind_SjLj_Resume -} - -%inherit GCC_3.3 GCC_3.0 -GCC_3.3 { - __Unwind_FindEnclosingFunction - __Unwind_GetCFA - __Unwind_Backtrace - __Unwind_Resume_or_Rethrow - __Unwind_SjLj_Resume_or_Rethrow -} - -%inherit GCC_3.3.1 GCC_3.3 -GCC_3.3.1 { - ___gcc_personality_sj0 - ___gcc_personality_v0 -} - -%inherit GCC_3.3.2 GCC_3.3.1 -GCC_3.3.2 { -} -%inherit GCC_3.3.4 GCC_3.3.2 -GCC_3.3.4 { - ___unorddf2 - ___unordsf2 -} - -%inherit GCC_3.4 GCC_3.3.4 -GCC_3.4 { - # bit scanning and counting built-ins - ___clzsi2 - ___clzdi2 - ___clzti2 - ___ctzsi2 - ___ctzdi2 - ___ctzti2 - ___popcountsi2 - ___popcountdi2 - ___popcountti2 - ___paritysi2 - ___pari
Re: [PATCH] fix PR68468
Hi, Jakub Jelinek wrote, > On Wed, Nov 09, 2016 at 04:08:39PM +0100, Bernd Schmidt wrote: > > On 11/05/2016 06:14 PM, Waldemar Brodkorb wrote: > > >Hi, > > > > > >the following patch fixes PR68468. > > >Patch is used for a while in Buildroot without issues. > > > > > >2016-11-05 Waldemar Brodkorb > > Two spaces before < instead of just one. > > > > > > PR gcc/68468 > > PR libgcc/68468 > instead. > > > > * libgcc/unwind-dw2-fde-dip.c: fix build on FDPIC targets. > > Capital F in Fix. > No libgcc/ prefix for files in libgcc/ChangeLog. > > > This is ok. > > I think Waldemar does not have SVN write access, are you going to check it > in or who will do that? Should I resend the patch with the suggested fixes or will someone with write access fix it up for me? Thanks Waldemar
Re: [PATCH] fix PR68468
Hi Jakub, Jakub Jelinek wrote, > On Wed, Nov 16, 2016 at 07:31:59AM +0100, Waldemar Brodkorb wrote: > > > On Wed, Nov 09, 2016 at 04:08:39PM +0100, Bernd Schmidt wrote: > > > > On 11/05/2016 06:14 PM, Waldemar Brodkorb wrote: > > > > >Hi, > > > > > > > > > >the following patch fixes PR68468. > > > > >Patch is used for a while in Buildroot without issues. > > > > > > > > > >2016-11-05 Waldemar Brodkorb > > > > > > Two spaces before < instead of just one. > > > > > > > > > > PR gcc/68468 > > > > > > PR libgcc/68468 > > > instead. > > > > > > > > * libgcc/unwind-dw2-fde-dip.c: fix build on FDPIC targets. > > > > > > Capital F in Fix. > > > No libgcc/ prefix for files in libgcc/ChangeLog. > > > > > > > This is ok. > > > > > > I think Waldemar does not have SVN write access, are you going to check it > > > in or who will do that? > > > > Should I resend the patch with the suggested fixes or will someone > > with write access fix it up for me? > > As nobody committed it yet, I've made the changes and committed it for you. Thanks! Waldemar