Re: [PATCH] ARC: ldso: don't use _DYNAMIC@gotpc construct to refer to GOT
On 01/09/2017 09:31 AM, Vineet Gupta wrote: > Historically we've used a special construct _DYNAMIC@gotpc to refer to > base address of GOT This has been done with a special hack in binutils > which tools guys now wish to get rid off. > > So rewrite the 2 callers of this construct to use the simpler and more > obvious constructs. There's existing _GLOBAL_OFFSET_TABLE symbols > provided by linker which can be used for same purposes. > > Signed-off-by: Vineet GuptaPlease ignore this one - it is broken with current binutils ! Assembler is also converting _DYNAMIC@pcl into _GLOBAL_OFFSET_TABLE v2 to follow ! -Vineet > --- > ldso/ldso/arc/dl-sysdep.h | 35 --- > 1 file changed, 12 insertions(+), 23 deletions(-) > > diff --git a/ldso/ldso/arc/dl-sysdep.h b/ldso/ldso/arc/dl-sysdep.h > index c6086e68e5c6..361a9bb9c0c3 100644 > --- a/ldso/ldso/arc/dl-sysdep.h > +++ b/ldso/ldso/arc/dl-sysdep.h > @@ -119,37 +119,26 @@ extern unsigned __udivmodsi4(unsigned, unsigned) > attribute_hidden; > | (((type) == R_ARC_COPY) * ELF_RTYPE_CLASS_COPY)) > > /* > - * Get the runtime address of GOT[0] > + * Get build time address of .dynamic as setup in GOT[0] > + * This is called very early in _dl_start() so it has not been relocated to > + * runtime value > */ > static __always_inline Elf32_Addr elf_machine_dynamic(void) > { > - Elf32_Addr dyn; > - > - __asm__("ld %0,[pcl,_DYNAMIC@gotpc]\n\t" : "=r" (dyn)); > - return dyn; > + /* Declaring this hidden ensures that a PC-relative reference is used. */ > + extern const Elf32_Addr _GLOBAL_OFFSET_TABLE_[] attribute_hidden; > + return _GLOBAL_OFFSET_TABLE_[0]; > } > > /* Return the run-time load address of the shared object. */ > static __always_inline Elf32_Addr elf_machine_load_address(void) > { > -/* To find the loadaddr we subtract the runtime addr of a non-local > symbol > - * say _DYNAMIC from it's build-time addr. > - * N.B., gotpc loads get optimized by the linker if it finds the symbol > - * is resolved locally. > - * A more robust - and efficient - solution would be to use a symbol > - * set by the linker. To make it actually save space, we'd have to > - * suppress the unwanted text relocation in the linked dso, though. > - * (I.e. in ldso.so.*, though it's just another dso as far as bfd/ld > - * are concerned.) > - */ > - Elf32_Addr addr, tmp; > - __asm__ ( > -"ld %1, [pcl, _DYNAMIC@gotpc] ;build addr of _DYNAMIC" "\n" > -"add %0, pcl, _DYNAMIC@pcl ;runtime addr of _DYNAMIC" "\n" > -"sub %0, %0, %1;delta""\n" > -: "=" (addr), "=r"(tmp) > -); > - return addr; > + Elf32_Addr build_addr, run_addr; > + > + build_addr = elf_machine_dynamic(); > + __asm__ ("add %0, pcl, _DYNAMIC@pcl \n" : "=r" (run_addr)); > + > + return run_addr - build_addr; > } > > static __always_inline void ___ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc
[PATCH] ARC: ldso: don't use _DYNAMIC@gotpc construct to refer to GOT
Historically we've used a special construct _DYNAMIC@gotpc to refer to base address of GOT This has been done with a special hack in binutils which tools guys now wish to get rid off. So rewrite the 2 callers of this construct to use the simpler and more obvious constructs. There's existing _GLOBAL_OFFSET_TABLE symbols provided by linker which can be used for same purposes. Signed-off-by: Vineet Gupta--- ldso/ldso/arc/dl-sysdep.h | 35 --- 1 file changed, 12 insertions(+), 23 deletions(-) diff --git a/ldso/ldso/arc/dl-sysdep.h b/ldso/ldso/arc/dl-sysdep.h index c6086e68e5c6..361a9bb9c0c3 100644 --- a/ldso/ldso/arc/dl-sysdep.h +++ b/ldso/ldso/arc/dl-sysdep.h @@ -119,37 +119,26 @@ extern unsigned __udivmodsi4(unsigned, unsigned) attribute_hidden; | (((type) == R_ARC_COPY) * ELF_RTYPE_CLASS_COPY)) /* - * Get the runtime address of GOT[0] + * Get build time address of .dynamic as setup in GOT[0] + * This is called very early in _dl_start() so it has not been relocated to + * runtime value */ static __always_inline Elf32_Addr elf_machine_dynamic(void) { - Elf32_Addr dyn; - - __asm__("ld %0,[pcl,_DYNAMIC@gotpc]\n\t" : "=r" (dyn)); - return dyn; + /* Declaring this hidden ensures that a PC-relative reference is used. */ + extern const Elf32_Addr _GLOBAL_OFFSET_TABLE_[] attribute_hidden; + return _GLOBAL_OFFSET_TABLE_[0]; } /* Return the run-time load address of the shared object. */ static __always_inline Elf32_Addr elf_machine_load_address(void) { -/* To find the loadaddr we subtract the runtime addr of a non-local symbol - * say _DYNAMIC from it's build-time addr. - * N.B., gotpc loads get optimized by the linker if it finds the symbol - * is resolved locally. - * A more robust - and efficient - solution would be to use a symbol - * set by the linker. To make it actually save space, we'd have to - * suppress the unwanted text relocation in the linked dso, though. - * (I.e. in ldso.so.*, though it's just another dso as far as bfd/ld - * are concerned.) - */ - Elf32_Addr addr, tmp; - __asm__ ( -"ld %1, [pcl, _DYNAMIC@gotpc] ;build addr of _DYNAMIC" "\n" -"add %0, pcl, _DYNAMIC@pcl ;runtime addr of _DYNAMIC" "\n" -"sub %0, %0, %1;delta""\n" -: "=" (addr), "=r"(tmp) -); - return addr; + Elf32_Addr build_addr, run_addr; + + build_addr = elf_machine_dynamic(); + __asm__ ("add %0, pcl, _DYNAMIC@pcl \n" : "=r" (run_addr)); + + return run_addr - build_addr; } static __always_inline void -- 2.7.4 ___ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc
Re: [PATCH 1/2] arc: rename xCCM sections so they are not merged in global .data/.text
Hi Vineet, On Thu, 2016-12-22 at 16:25 -0800, Vineet Gupta wrote: > On 12/22/2016 06:09 AM, Alexey Brodkin wrote: > > diff --git a/arch/arc/include/asm/linkage.h b/arch/arc/include/asm/linkage.h > > index b29f1a9fd6f7..3a5f13d65ee1 100644 > > --- a/arch/arc/include/asm/linkage.h > > +++ b/arch/arc/include/asm/linkage.h > > @@ -28,7 +28,7 @@ > > /* annotation for data we want in DCCM - if enabled in .config */ > > .macro ARCFP_CODE > > #ifdef CONFIG_ARC_HAS_ICCM > > - .section .text.arcfp, "ax",@progbits > > + .section .text..arcfp, "ax",@progbits > > Why not turn this around and call it arcfp.text and arcfp.data etc - just like > done for other special sections such as sched, cpuidle, lock... Just so we are > consistent with normal kernel convention ! Right that looks much better! Will do so in v2. -Alexey ___ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc
Re: [PATCH 2/2] arc: Fix xCCM size check
Hi Vineet, On Thu, 2016-12-22 at 16:34 -0800, Vineet Gupta wrote: > On 12/22/2016 06:09 AM, Alexey Brodkin wrote: > > > > CONFIG_ARC_ICCM_SZ in menuconfig is specified in kB while > > "cpu->Xccm.sz" contains value in bytes thus direct comparison fails > > leading to boot-time panic like that: > > --->8- > > IDENTITY: ARCVER [0x52] ARCNUM [0x1] CHIPID [ 0x0] > > processor [1] : ARC HS38 R2.1 (ARCv2 ISA) > > Timers : Timer0 Timer1 Local-64-bit-Ctr (not used) > > ISA Extn: atomic ll64 unalign (not used) > > : mpy[opt 9] div_rem norm barrel-shift swap minmax swape > > BPU : full match, cache:2048, Predict Table:16384 > > MMU [v0]: 0k PAGE, JTLB 0 (0x0), uDTLB 0, uITLB 0 > > I-Cache : N/A > > D-Cache : N/A > > Peripherals : 0xf000, IO-Coherency (disabled) > > Vector Table: 0x8000 > > FPU : SP DP > > DEBUG : ActionPoint smaRT RTT > > Extn [CCM] : DCCM @ e000, 256 KB / ICCM: @ 6000, 256 KB > > OS ABI [v4] : 64-bit data any register aligned > > Extn [SMP] : ARConnect (v2): 2 cores with IPI IDU DEBUG GFRC > > Kernel panic - not syncing: Linux built with incorrect DCCM Size > > > > ---[ end Kernel panic - not syncing: Linux built with incorrect DCCM Size > > --->8- > > > > Signed-off-by: Alexey Brodkin> > Cc: Igor Guryanov > > Cc: sta...@vger.kernel.org > > --- > > arch/arc/kernel/setup.c | 4 ++-- > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/arch/arc/kernel/setup.c b/arch/arc/kernel/setup.c > > index ee574f37f365..601dab6fe5e0 100644 > > --- a/arch/arc/kernel/setup.c > > +++ b/arch/arc/kernel/setup.c > > @@ -333,12 +333,12 @@ static void arc_chk_core_config(void) > > if ((unsigned int)__arc_dccm_base != cpu->dccm.base_addr) > > panic("Linux built with incorrect DCCM Base address\n"); > > > > - if (CONFIG_ARC_DCCM_SZ != cpu->dccm.sz) > > + if (CONFIG_ARC_DCCM_SZ != TO_KB(cpu->dccm.sz)) > > Could we just avoid this existing TO_KB non sense in multiple places by > keeping > the *ccm.sz unit consistent with CONFIG_ARC_*CCM_SZ ? > so > -cpu->iccm.sz = 4096 << iccm.sz;/* 8K to 512K */ > +cpu->iccm.sz = 4 << iccm.sz;/* 8K to 512K */ > > Since we only want to keep ccm size to kb granularity > > And while at it, rename @sz placeholder in bcr_(i|d)ccm_arc(v2,compact) to > sz_k Well when I started to look at that I understood that in case of ARCv2 smallest xCCM is 512 bytes which won't fit in our 1kB grained solution. So it looks like instead of moving to "sz_k" we have to stay with what we have and moreover add support of that 512 byte corner-case becase TO_KB(512) = 0. -Alexey ___ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc
Re: [PATCH v2 7/7] uapi: export all headers under uapi directories
On Fri, Jan 06, 2017 at 10:43:59AM +0100, Nicolas Dichtel wrote: > Regularly, when a new header is created in include/uapi/, the developer > forgets to add it in the corresponding Kbuild file. This error is usually > detected after the release is out. > > In fact, all headers under uapi directories should be exported, thus it's > useless to have an exhaustive list. > > After this patch, the following files, which were not exported, are now > exported (with make headers_install_all): ... snip ... > linux/genwqe/.install > linux/genwqe/..install.cmd > linux/cifs/.install > linux/cifs/..install.cmd I'm pretty sure these should not be exported! ___ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc
Re: [PATCH v2 1/7] arm: put types.h in uapi
On Mon, Jan 09, 2017 at 12:33:02PM +0100, Arnd Bergmann wrote: > On Friday, January 6, 2017 10:43:53 AM CET Nicolas Dichtel wrote: > > > > diff --git a/arch/arm/include/asm/types.h b/arch/arm/include/asm/types.h > > index a53cdb8f068c..c48fee3d7b3b 100644 > > --- a/arch/arm/include/asm/types.h > > +++ b/arch/arm/include/asm/types.h > > @@ -1,40 +1,6 @@ > > #ifndef _ASM_TYPES_H > > #define _ASM_TYPES_H > > > > -#include > ... > > -#define __UINTPTR_TYPE__ unsigned long > > -#endif > > +#include > > > > #endif /* _ASM_TYPES_H */ > > > > Moving the file is correct as far as I can tell, but the extra > #include is not necessary here, as the kernel will automatically > search both arch/arm/include/ and arch/arm/include/uapi/. Indeed, I'd like to see the include/asm file gone. -- RMK's Patch system: http://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up according to speedtest.net. ___ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc
Re: [PATCH v2 7/7] uapi: export all headers under uapi directories
On Fri, Jan 06, 2017 at 10:43:59AM +0100, Nicolas Dichtel wrote: > diff --git a/arch/arm/include/uapi/asm/Kbuild > b/arch/arm/include/uapi/asm/Kbuild > index 46a76cd6acb6..607f702c2d62 100644 > --- a/arch/arm/include/uapi/asm/Kbuild > +++ b/arch/arm/include/uapi/asm/Kbuild > @@ -1,23 +1,6 @@ > # UAPI Header export list > include include/uapi/asm-generic/Kbuild.asm > > -header-y += auxvec.h > -header-y += byteorder.h > -header-y += fcntl.h > -header-y += hwcap.h > -header-y += ioctls.h > -header-y += kvm_para.h > -header-y += mman.h > -header-y += perf_regs.h > -header-y += posix_types.h > -header-y += ptrace.h > -header-y += setup.h > -header-y += sigcontext.h > -header-y += signal.h > -header-y += stat.h > -header-y += statfs.h > -header-y += swab.h > -header-y += unistd.h > genhdr-y += unistd-common.h > genhdr-y += unistd-oabi.h > genhdr-y += unistd-eabi.h Acked-by: Russell King-- RMK's Patch system: http://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up according to speedtest.net. ___ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc
Re: [PATCH v2 0/7] uapi: export all headers under uapi directories
On Friday, January 6, 2017 10:43:52 AM CET Nicolas Dichtel wrote: > Here is the v2 of this series. The first 5 patches are just cleanup: some > exported headers were still under a non-uapi directory. Since this is meant as a cleanup, I commented on this to point out a cleaner way to do the same. > The patch 6 was spotted by code review: there is no in-tree user of this > functionality. > The last patch remove the use of header-y. Now all files under an uapi > directory are exported. Very nice! > asm is a bit special, most of architectures export asm//include/uapi/asm > only, but there is two exceptions: > - cris which exports arch/cris/include/uapi/arch-v[10|32]; This is interesting, though not your problem. Maybe someone who understands cris better can comment on this: How is the decision made about which of the arch/user.h headers gets used? I couldn't find that in the sources, but it appears to be based on kernel compile-time settings, which is wrong for user space header files that should be independent of the kernel config. > - tile which exports arch/tile/include/uapi/arch. > Because I don't know if the output of 'make headers_install_all' can be > changed, > I introduce subdir-y in Kbuild file. The headers_install_all target copies all > asm//include/uapi/asm to usr/include/asm- but > arch/cris/include/uapi/arch-v[10|32] and arch/tile/include/uapi/arch are not > prefixed (they are put asis in usr/include/). If it's acceptable to modify the > output of 'make headers_install_all' to export asm headers in > usr/include/asm-/asm, then I could remove this new subdir-y and exports > everything under arch//include/uapi/. I don't know if anyone still uses "make headers_install_all", I suspect distros these days all use "make headers_install", so it probably doesn't matter much. In case of cris, it should be easy enough to move all the contents of the uapi/arch-*/*.h headers into the respective uapi/asm/*.h headers, they only seem to be referenced from there. For tile, I suspect that would not work as the arch/*.h headers are apparently defined as interfaces for both user space and kernel. > Note also that exported files for asm are a mix of files listed by: > - include/uapi/asm-generic/Kbuild.asm; > - arch/x86/include/uapi/asm/Kbuild; > - arch/x86/include/asm/Kbuild. > This complicates a lot the processing (arch/x86/include/asm/Kbuild is also > used by scripts/Makefile.asm-generic). > > This series has been tested with a 'make headers_install' on x86 and a > 'make headers_install_all'. I've checked the result of both commands. > > This patch is built against linus tree. I don't know if it should be > made against antoher tree. The series should probably get merged through the kbuild tree, but testing it on mainline is fine here. Arnd ___ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc
Re: [PATCH v2 1/7] arm: put types.h in uapi
On Friday, January 6, 2017 10:43:53 AM CET Nicolas Dichtel wrote: > > diff --git a/arch/arm/include/asm/types.h b/arch/arm/include/asm/types.h > index a53cdb8f068c..c48fee3d7b3b 100644 > --- a/arch/arm/include/asm/types.h > +++ b/arch/arm/include/asm/types.h > @@ -1,40 +1,6 @@ > #ifndef _ASM_TYPES_H > #define _ASM_TYPES_H > > -#include ... > -#define __UINTPTR_TYPE__ unsigned long > -#endif > +#include > > #endif /* _ASM_TYPES_H */ > Moving the file is correct as far as I can tell, but the extra #include is not necessary here, as the kernel will automatically search both arch/arm/include/ and arch/arm/include/uapi/. The same applies to patches 2 and 4. Arnd ___ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc
Re: [PATCH v2 7/7] uapi: export all headers under uapi directories
On Fri, Jan 06, 2017 at 10:43:59AM +0100, Nicolas Dichtel wrote: > Regularly, when a new header is created in include/uapi/, the developer > forgets to add it in the corresponding Kbuild file. This error is usually > detected after the release is out. > > In fact, all headers under uapi directories should be exported, thus it's > useless to have an exhaustive list. > > After this patch, the following files, which were not exported, are now > exported (with make headers_install_all): > asm-unicore32/shmparam.h > asm-unicore32/ucontext.h > asm-hexagon/shmparam.h > asm-mips/ucontext.h > asm-mips/hwcap.h > asm-mips/reg.h > drm/vgem_drm.h > drm/armada_drm.h > drm/omap_drm.h > drm/etnaviv_drm.h > asm-tile/shmparam.h > asm-blackfin/shmparam.h > asm-blackfin/ucontext.h > asm-powerpc/perf_regs.h > rdma/qedr-abi.h > asm-parisc/kvm_para.h > asm-openrisc/shmparam.h > asm-nios2/kvm_para.h > asm-nios2/ucontext.h > asm-sh/kvm_para.h > asm-sh/ucontext.h > asm-xtensa/kvm_para.h > asm-avr32/kvm_para.h > asm-m32r/kvm_para.h > asm-h8300/shmparam.h > asm-h8300/ucontext.h > asm-metag/kvm_para.h > asm-metag/shmparam.h > asm-metag/ucontext.h > asm-m68k/kvm_para.h > asm-m68k/shmparam.h > linux/bcache.h > linux/kvm.h > linux/kvm_para.h > linux/kfd_ioctl.h > linux/cryptouser.h > linux/kcm.h > linux/kcov.h > linux/seg6_iptunnel.h > linux/stm.h > linux/genwqe > linux/genwqe/.install > linux/genwqe/genwqe_card.h > linux/genwqe/..install.cmd > linux/seg6.h > linux/cifs > linux/cifs/.install > linux/cifs/cifs_mount.h > linux/cifs/..install.cmd > linux/auto_dev-ioctl.h > > Thanks to Julien Floretfor the tip to get all > subdirs with a pure makefile command. > > Signed-off-by: Nicolas Dichtel Makes lots of sense. Acked-by: Daniel Vetter > --- > Documentation/kbuild/makefiles.txt | 41 ++- > arch/alpha/include/uapi/asm/Kbuild | 41 --- > arch/arc/include/uapi/asm/Kbuild| 3 - > arch/arm/include/uapi/asm/Kbuild| 17 - > arch/arm64/include/uapi/asm/Kbuild | 18 -- > arch/avr32/include/uapi/asm/Kbuild | 20 -- > arch/blackfin/include/uapi/asm/Kbuild | 17 - > arch/c6x/include/uapi/asm/Kbuild| 8 - > arch/cris/include/uapi/arch-v10/arch/Kbuild | 5 - > arch/cris/include/uapi/arch-v32/arch/Kbuild | 3 - > arch/cris/include/uapi/asm/Kbuild | 43 +-- > arch/frv/include/uapi/asm/Kbuild| 33 -- > arch/h8300/include/uapi/asm/Kbuild | 28 -- > arch/hexagon/include/asm/Kbuild | 3 - > arch/hexagon/include/uapi/asm/Kbuild| 13 - > arch/ia64/include/uapi/asm/Kbuild | 45 --- > arch/m32r/include/uapi/asm/Kbuild | 31 -- > arch/m68k/include/uapi/asm/Kbuild | 24 -- > arch/metag/include/uapi/asm/Kbuild | 8 - > arch/microblaze/include/uapi/asm/Kbuild | 32 -- > arch/mips/include/uapi/asm/Kbuild | 37 --- > arch/mn10300/include/uapi/asm/Kbuild| 32 -- > arch/nios2/include/uapi/asm/Kbuild | 4 +- > arch/openrisc/include/asm/Kbuild| 3 - > arch/openrisc/include/uapi/asm/Kbuild | 8 - > arch/parisc/include/uapi/asm/Kbuild | 28 -- > arch/powerpc/include/uapi/asm/Kbuild| 45 --- > arch/s390/include/uapi/asm/Kbuild | 52 --- > arch/score/include/asm/Kbuild | 4 - > arch/score/include/uapi/asm/Kbuild | 32 -- > arch/sh/include/uapi/asm/Kbuild | 23 -- > arch/sparc/include/uapi/asm/Kbuild | 48 --- > arch/tile/include/asm/Kbuild| 3 - > arch/tile/include/uapi/arch/Kbuild | 17 - > arch/tile/include/uapi/asm/Kbuild | 19 +- > arch/unicore32/include/uapi/asm/Kbuild | 6 - > arch/x86/include/uapi/asm/Kbuild| 59 > arch/xtensa/include/uapi/asm/Kbuild | 23 -- > include/Kbuild | 2 - > include/asm-generic/Kbuild.asm | 1 - > include/scsi/fc/Kbuild | 0 > include/uapi/Kbuild | 15 - > include/uapi/asm-generic/Kbuild | 36 --- > include/uapi/asm-generic/Kbuild.asm | 62 ++-- > include/uapi/drm/Kbuild | 22 -- > include/uapi/linux/Kbuild | 482 > > include/uapi/linux/android/Kbuild | 2 - > include/uapi/linux/byteorder/Kbuild | 3 - > include/uapi/linux/caif/Kbuild | 3 - > include/uapi/linux/can/Kbuild | 6 - > include/uapi/linux/dvb/Kbuild | 9 - > include/uapi/linux/hdlc/Kbuild | 2 - > include/uapi/linux/hsi/Kbuild | 2 - > include/uapi/linux/iio/Kbuild | 3 - > include/uapi/linux/isdn/Kbuild | 2 - > include/uapi/linux/mmc/Kbuild | 2 - >